From 27735f7310615d428b33cd09d31ceb89c0fe355e Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 25 Mar 2022 13:50:43 +0800 Subject: [PATCH] add page id in updated page json file in gcs (#319) --- packages/api/src/datalayer/pubsub.ts | 6 +++--- packages/api/src/elastic/index.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/api/src/datalayer/pubsub.ts b/packages/api/src/datalayer/pubsub.ts index fa2e86625..690e9376b 100644 --- a/packages/api/src/datalayer/pubsub.ts +++ b/packages/api/src/datalayer/pubsub.ts @@ -37,9 +37,9 @@ export const createPubSubClient = (): PubsubClient => { Buffer.from(JSON.stringify({ userId, email, name, username })) ) }, - pageSaved: (page: Partial, userId: string): Promise => { + pageUpdated: (page: Partial, userId: string): Promise => { return publish( - 'pageSaved', + 'pageUpdated', Buffer.from(JSON.stringify({ ...page, userId })) ) }, @@ -73,7 +73,7 @@ export interface PubsubClient { username: string ) => Promise pageCreated: (page: Page) => Promise - pageSaved: (page: Partial, userId: string) => Promise + pageUpdated: (page: Partial, userId: string) => Promise pageDeleted: (id: string, userId: string) => Promise reportSubmitted( submitterId: string | undefined, diff --git a/packages/api/src/elastic/index.ts b/packages/api/src/elastic/index.ts index 5844270fb..4165e687b 100644 --- a/packages/api/src/elastic/index.ts +++ b/packages/api/src/elastic/index.ts @@ -206,7 +206,7 @@ export const updatePage = async ( if (body.result !== 'updated') return false - await ctx.pubsub.pageSaved(page, ctx.uid) + await ctx.pubsub.pageUpdated({ ...page, id }, ctx.uid) return true } catch (e) {