Skip to content

Commit f1f947c

Browse files
committed
Remove utterance sequential ids and words all together.
1 parent 5c4a21b commit f1f947c

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

functions/src/webhooks/transcription.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,17 @@ export const transcription = functions.https.onRequest(async (req, res) => {
5555
const writer = db.bulkWriter()
5656
for (let utterance of utterances) {
5757
const { speaker, confidence, start, end, text } = utterance
58-
writer.set(
59-
db.doc(
60-
`/transcriptions/${transcript.id}/utterances/${utterance.start}`
61-
),
62-
{ speaker, confidence, start, end, text }
63-
)
64-
}
65-
66-
await writer.close()
67-
}
6858

69-
if (words) {
70-
const writer = db.bulkWriter()
71-
for (let word of words) {
7259
writer.set(
73-
db.doc(
74-
`/transcriptions/${transcript.id}/words/${word.start}`
75-
),
76-
word
60+
db.doc(`/transcriptions/${transcript.id}/utterances/`),
61+
{ speaker, confidence, start, end, text }
7762
)
7863
}
7964

8065
await writer.close()
8166
}
8267

8368
const batch = db.batch()
84-
batch.set(db.collection("transcriptions").doc(transcript.id), {
85-
_timestamp: Timestamp.now(),
86-
...transcript
87-
})
8869
authenticatedEventsInDb.forEach(doc => {
8970
batch.update(doc.ref, { ["x-maple-webhook"]: null })
9071
})

0 commit comments

Comments
 (0)