58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
export enum NotifChannelEnum {
|
|
IN_APP = 'in-app',
|
|
SMS = 'sms',
|
|
PUSH = 'push',
|
|
}
|
|
|
|
export enum NotifEvent {
|
|
NEW_REQUEST = 'newRequest',
|
|
INVOICED = 'invoiced',
|
|
NEW_ORDER = 'newOrder', // for chapkhane sms bere
|
|
DESIGNER_ASSIGN = 'designerAssign',
|
|
PAYMENT_SUCCESS = 'paymentSuccess',
|
|
NEW_CRITICISM = 'newCriticism',
|
|
}
|
|
export type recipientType = { userId: string } | { adminId: string };
|
|
|
|
export interface NotifRequestMessage {
|
|
title: NotifEvent;
|
|
content: string;
|
|
sms: {
|
|
templateId: string;
|
|
parameters?: Record<string, string>;
|
|
};
|
|
}
|
|
|
|
export interface NotifRequest {
|
|
// notifType: NotifTypeEnum;
|
|
channels: NotifChannelEnum[];
|
|
recipients: recipientType[];
|
|
message: NotifRequestMessage;
|
|
}
|
|
//************************************************ */
|
|
interface INotifySmsPayload {
|
|
[key: string]: string | number | Date;
|
|
}
|
|
interface INotifySms {
|
|
phone: string;
|
|
subject: NotifEvent;
|
|
}
|
|
export interface IInAppNotificationPayload {
|
|
notificationId: string;
|
|
subject: NotifEvent;
|
|
body: string;
|
|
}
|
|
|
|
// 2. Payment Success
|
|
interface IPaymentSuccessSmsNotifyPayload extends INotifySmsPayload {
|
|
amount: number;
|
|
date: Date;
|
|
}
|
|
|
|
interface IPaymentSuccessSmsNotify extends INotifySms {
|
|
subject: NotifEvent.PAYMENT_SUCCESS;
|
|
payload: IPaymentSuccessSmsNotifyPayload;
|
|
}
|
|
|
|
export type ISmsNotifyPayload = IPaymentSuccessSmsNotify;
|