Skip to content

Commit 24474c6

Browse files
author
Boaz Sender
committed
Address additional review feedback.
1 parent 92fccb3 commit 24474c6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

functions/src/webhooks/transcription.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export const transcription = functions.https.onRequest(async (req, res) => {
2929
const authenticatedEventIds = [] as string[]
3030
const hashedToken = sha256(String(req.headers["x-maple-webhook"]))
3131

32-
maybeEventsInDb.docs.forEach(async doc => {
32+
for (const index in maybeEventsInDb.docs){
33+
const doc = maybeEventsInDb.docs[index]
34+
3335
const tokenDocInDb = await db
3436
.collection("events")
3537
.doc(doc.id)
@@ -42,7 +44,7 @@ export const transcription = functions.https.onRequest(async (req, res) => {
4244
if (hashedToken === tokenDataInDb) {
4345
authenticatedEventIds.push(doc.id)
4446
}
45-
})
47+
}
4648

4749
if (authenticatedEventIds.length === 1) {
4850
// If there is one authenticated event, pull out the parts we want to
@@ -85,7 +87,15 @@ export const transcription = functions.https.onRequest(async (req, res) => {
8587
// Delete the hashed webhook auth token from our db now that
8688
// we're done.
8789
authenticatedEventIds.forEach(async docId => {
88-
await db.doc(docId).set({ ["x-maple-webhook"]: null })
90+
91+
await db.collection("events")
92+
.doc(docId)
93+
.collection("private")
94+
.doc("webhookAuth")
95+
.set({
96+
videoAssemblyWebhookToken: null
97+
})
98+
8999
})
90100
} catch (error) {
91101
console.log(error)

0 commit comments

Comments
 (0)