Skip to content

Instantly share code, notes, and snippets.

View raviganwal's full-sized avatar
🎯
Flutter in focus

raviganwal

🎯
Flutter in focus
View GitHub Profile
@threetwotwo
threetwotwo / fanOutPostWrite.ts
Last active February 5, 2021 10:20
Cloud function - fan out post write
export const fanOutPostWrite = functions.firestore
.document('users/{uid}/posts/{postId}')
.onWrite(async (change, context) => {
const postId = context.params.postId;
const uploader = context.params.uid;
const followerRefs = await firestore
.collection('users').doc(uploader)
.collection('followers').get();