Created
July 18, 2021 14:40
-
-
Save danahartweg/64ce2aff04f5909e71e6d56d668627a6 to your computer and use it in GitHub Desktop.
Create user Cloud Function - Unit testing Cloud Firestore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { auth } from 'firebase-functions'; | |
import { getFirestore } from '../admin'; | |
export const create = auth.user().onCreate(async (userRecord) => { | |
const db = getFirestore(); | |
return db | |
.collection('users') | |
.doc(userRecord.uid) | |
.set({ | |
displayName: userRecord.displayName ?? '', | |
email: userRecord.email ?? '', | |
homesteads: {}, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment