-
-
Save richartkeil/1cd9733cf922f21f6ade1091f80e6285 to your computer and use it in GitHub Desktop.
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
const processUser = functions.firestore | |
.document("accounts/{accountId}/users/{userId}") | |
.onCreate(async (snapshot, context) => { | |
try { | |
await processTheUser(snapshot); | |
const event = new UserProcessed(snapshot); | |
await new Account(context.params.accountId).addEvent(event); | |
} catch (error) { | |
const event = new UserProcessingFailed(snapshot, error); | |
await new Account(context.params.accountId).addEvent(event); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment