Skip to content

Commit 172861c

Browse files
committed
♻️
use integrationEntitiyType for changed contactsData
1 parent a22f40e commit 172861c

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/models/adapter.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ export interface Adapter {
8484
req: Request,
8585
res?: Response,
8686
) => Promise<{ apiKey: string; apiUrl: string }>;
87-
handleWebhook?: (body: unknown) => Promise<ContactsChangedData>;
87+
handleWebhook?: (req: Request) => Promise<ContactsChangedData>;
8888
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
import { IntegrationEntityType } from './integration-entity.model';
2+
13
export type ContactsChangedData = {
24
integrationName: string;
35
data: {
46
integrationAccountId: string;
57
type: ContactsChangedDataType;
68
contactId: string;
9+
contactType: IntegrationEntityType;
710
}[];
811
};
912

10-
export type ContactsChangedDataType = 'UPDATE' | 'CREATE' | 'DELETE';
13+
export enum ContactsChangedDataType {
14+
UPDATE = 'UPDATE',
15+
CREATE = 'CREATE',
16+
DELETE = 'DELETE',
17+
}

src/models/controller.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ export class Controller {
13561356
}
13571357

13581358
const contactsChangedData: ContactsChangedData =
1359-
await this.adapter.handleWebhook(req.body);
1359+
await this.adapter.handleWebhook(req);
13601360

13611361
console.log('sending webhook to pubsub', contactsChangedData);
13621362
this.pubSubContactsChangedClient?.publishMessage(contactsChangedData);

0 commit comments

Comments
 (0)