Created
December 21, 2022 09:19
-
-
Save saileshbro/ca2d8f3c6d8135bc81ce34f47abe45fa 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 _updateStreamFeed = async ( | |
prediction: Prediction, | |
toUpdate: Record<string, unknown>, | |
) => { | |
try { | |
const streamClient = getStreamClient(); | |
const ref: firestore.DocumentReference = prediction.ref; | |
const time = new Date().toISOString(); | |
const activity: ActivityPartialChanges<DefaultGenerics> = { | |
foreign_id: ref.id, | |
time, | |
set: { | |
...toUpdate, | |
}, | |
}; | |
const updated = await streamClient.activityPartialUpdate(activity); | |
console.log('Updated stream feed', updated); | |
return; | |
} catch (error) { | |
console.error('Error updating stream feed', error); | |
return Promise.reject(error); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment