-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User Loader functionality for Viber adapter #34
base: main
Are you sure you want to change the base?
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
}
};
} |
@@ -79,7 +79,7 @@ export function addBaseLocationRule<U extends User<any>>( | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what will the payload be like there?
route?: string; | ||
authToken: string; | ||
welcomeMessage?: Record<string, unknown>; | ||
userLoader?: (userData: IUser) => Promise<U>; | ||
webhookHanlers?: IViberWebhookHandlers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: webhookHanlers -> webhookHandlers
@@ -31,25 +45,41 @@ export default class ViberAdapter extends GenericAdapter { | |||
public sender; | |||
|
|||
private welcomeMessage?: Record<string, unknown>; | |||
private webhookHanlers?: IViberWebhookHandlers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo webhookHanlers -> webhookHandlers
console.log('subscribed'); | ||
return; | ||
case 'unsubscribed': | ||
console.log('unsubscribed'); | ||
if (webhooks?.unsubscribeWebhook) webhooks.unsubscribeWebhook(body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add brackets ({}) on all ifs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't references to @ebonydevcopy be changed to @ebenos?
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@ebenos/framework", | |||
"version": "4.0.0-alpha.29", | |||
"name": "@ebonydevcopy/framework", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't these references be changed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
Added User loader in viber adaptor
Also change the type of the tracking data to be more broad