phx-node
Version:
PHX NODE
91 lines (90 loc) • 2.87 kB
TypeScript
import { HttpService } from "@nestjs/axios";
import { ConfigService } from "@nestjs/config";
export interface IGroupRequestType {
group: string;
count?: number;
items?: {
label: string;
count: number;
}[];
}
export declare enum EmailType {
TRANSACTION_BASIC = "transaction-basic",
HRM_REMIND = "hrm-remind",
ORDER_SUCCESS = "order-success",
FREESTYLE_CAMPAIGN = "freestyle-campaign"
}
export declare enum NotificationType {
SYSTEM = "SYSTEM",
TO_ME = "TO_ME"
}
export interface Attachment {
filename: string;
pathname: string;
}
export declare const ACTION_CODES: readonly ["hrm-checkin-remote-don-cho-duyet", "hrm-checkin-remote-phe-duyet-don", "hrm-checkin-overtime-don-cho-duyet", "hrm-checkin-overtime-phe-duyet-don", "hrm-checkin-leave-don-cho-duyet", "hrm-checkin-leave-phe-duyet-don", "hrm-checkin-late-early-don-cho-duyet", "hrm-checkin-late-early-phe-duyet-don", "hrm-checkin-explanation-don-cho-duyet", "hrm-checkin-explanation-phe-duyet-don", "hrm-checkin-shift-duty-don-cho-duyet", "hrm-checkin-shift-duty-phe-duyet-don"];
type LiteralUnion<LiteralType extends BaseType, BaseType = string> = LiteralType | (BaseType & {});
export type ActionCode = LiteralUnion<(typeof ACTION_CODES)[number], string>;
export interface PushNotiMobile {
title: string;
message: string;
module_code: string;
app: string;
payload: any;
related_id?: string;
content?: string;
}
export interface SendEmailV3 {
emailType: EmailType;
subject: string;
to: string;
title: string;
previewText: string;
callToActionURL?: string;
callToActionText?: string;
footerMessage?: string;
content?: string;
listRequests?: IGroupRequestType[];
description?: string;
schoolId?: number;
tag?: string;
attachments?: Attachment[];
}
export interface RequireAction {
task_target_id: string;
due_date?: string;
}
export interface CompleteRequiredAction {
hostname: string;
user_id: number;
app?: string;
action_code: string;
task_target_id: string;
}
export interface PushInappNoti {
hostname: string;
user_id: number;
student_id?: number;
action_code: ActionCode;
type?: NotificationType;
pushNotiMobile?: PushNotiMobile;
sendEmailV3?: SendEmailV3;
requiredAction?: RequireAction;
}
export declare class PHXPushNotificationService {
private readonly httpService;
private readonly configService;
private readonly logger;
constructor(httpService: HttpService, configService: ConfigService);
private pushNoti;
private complete;
send(payload: PushInappNoti): Promise<{
status: string;
message: string;
}>;
completeRequireAction(payload: CompleteRequiredAction): Promise<{
status: string;
message: string;
}>;
}
export {};