User Loader functionality for Viber adapter - #34
Conversation
|
what did we have before? Beforehand was it using an in memory loader or something like that? Or it didn't provide the user at all? |
We only had the IUser data and we return just the sender attributes not even a database user object. function convertViberSenderToUser(sender: IViberSender): IUser {
return {
id: sender.id,
firstName: sender.name,
lastName: sender.name,
data: {
country: sender.country,
avatar: sender.avatar,
api_version: sender.api_version,
language: sender.language
}
};
} |
| export function addTextRule<U extends User<any>>( | ||
| module: Module<U>, | ||
| action: (user: U, payload?: IPayload, ...args: any[]) => Promise<any>, | ||
| action: (user: U, payload: IPayload, ...args: any[]) => Promise<any>, |
There was a problem hiding this comment.
what will the payload be like there?
| authToken: string; | ||
| welcomeMessage?: Record<string, unknown>; | ||
| userLoader?: (userData: IUser) => Promise<U>; | ||
| webhookHanlers?: IViberWebhookHandlers; |
There was a problem hiding this comment.
typo: webhookHanlers -> webhookHandlers
| public sender; | ||
|
|
||
| private welcomeMessage?: Record<string, unknown>; | ||
| private webhookHanlers?: IViberWebhookHandlers; |
There was a problem hiding this comment.
typo webhookHanlers -> webhookHandlers
| return; | ||
| case 'unsubscribed': | ||
| console.log('unsubscribed'); | ||
| if (webhooks?.unsubscribeWebhook) webhooks.unsubscribeWebhook(body); |
| { | ||
| "name": "@ebenos/framework", | ||
| "version": "4.0.0-alpha.29", | ||
| "name": "@ebonydevcopy/framework", |
There was a problem hiding this comment.
shouldn't these references be changed here?
There was a problem hiding this comment.
Yes this pull request is just to keep track of the changes in the copy package. I'll make a new one with the correct changes for review and merging OTD
Added User loader in viber adaptor
Also change the type of the tracking data to be more broad