firebase / firebase/snippets-ios
A social network for athlete enthusiasts.
- Dominant language
- Objective-C
- Stars
- 132
- Forks
- 66
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
const { onDocumentCreated } = require("firebase-functions/v2/firestore");
const admin = require("firebase-admin");
admin.initializeApp();
exports.fanoutActivity = onDocumentCreated("activities/{activityId}", async (event) => {
const activityData = event.data.data();
const authorId = activityData.userId;
// 1. Get all followers of the athlete
const followersSnapshot = await admin.firestore()
.collection(`users/${authorId}/followers`).get();
const batch = admin.firestore().batch();
// 2. Queue up the fanned-out write for each follower
followersSnapshot.forEach((doc) => {
const followerId = doc.id;
const feedRef = admin.firestore()
.doc(`users/${followerId}/feeds/${event.params.activityId}`);
batch.set(feedRef, activityData);
});
// 3. Commit the batch write in a single operation
return batch.commit();
});
Contributor guide
Research direction
The issue provides a Firebase Functions snippet using Firestore, but names no repository file, test, or entry point. First clarify whether this is a requested feature and define the expected social-network behavior, data model, and completion criteria before attempting implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, javascript
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100