Skip to content

Instantly share code, notes, and snippets.

@saileshbro
Created December 21, 2022 09:19
Show Gist options
  • Save saileshbro/ca2d8f3c6d8135bc81ce34f47abe45fa to your computer and use it in GitHub Desktop.
Save saileshbro/ca2d8f3c6d8135bc81ce34f47abe45fa to your computer and use it in GitHub Desktop.
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