first commit
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
import { FilterQuery } from "mongoose";
|
||||
|
||||
export type FindSystemNotificationsParams = {
|
||||
id?: string;
|
||||
userId?: string;
|
||||
companyId?: string;
|
||||
serviceId?: string;
|
||||
conversationId?: string;
|
||||
notificationDate?: Date;
|
||||
readed?: boolean;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type ToggleStateSystemNotificationsParams = {
|
||||
state: boolean;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type PaginateSystemNotificationsParams = {
|
||||
query?: string;
|
||||
userId?: string;
|
||||
companyId?: string;
|
||||
serviceId?: string;
|
||||
conversationId?: string;
|
||||
dateFrom?: Date;
|
||||
dateTo?: Date;
|
||||
readed?: boolean;
|
||||
page: number;
|
||||
limit: number;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type UnreadNotificationResults = {
|
||||
count: number;
|
||||
};
|
||||
|
||||
export type PaginateSystemNotificationsResults = {
|
||||
data: ISystemNotification[];
|
||||
page: number;
|
||||
pages: number;
|
||||
};
|
||||
|
||||
export enum NotificationType {
|
||||
APPOINTMENT = 'APPOINTMENT',
|
||||
COMPANY = 'COMPANY',
|
||||
EMPLOYEE = 'EMPLOYEE',
|
||||
SCHEDULE = 'SCHEDULE',
|
||||
SCHEDULE_EXCEPTION = 'SCHEDULE_EXCEPTION',
|
||||
SCHEDULE_RESTRICTION = 'SCHEDULE_RESTRICTION',
|
||||
MESSAGE = 'MESSAGE',
|
||||
BILLING = 'BILLING',
|
||||
SYSTEM = 'SYSTEM'
|
||||
}
|
||||
|
||||
export type CreateSystemNotificationParams = {
|
||||
userId?: string;
|
||||
companyId?: string;
|
||||
serviceId?: number;
|
||||
conversationId?: string;
|
||||
subject: string;
|
||||
message: string;
|
||||
type?: string;
|
||||
code?: string;
|
||||
};
|
||||
|
||||
export type UpdateSystemNotificationParams = {
|
||||
id: string;
|
||||
readed: boolean;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type DeleteSystemNotificationParams = {
|
||||
id: string;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type DeleteSystemNotificationsByConversation = {
|
||||
conversationId: string;
|
||||
userId: string;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type DeleteNotificationsByUserParams = {
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export type DeleteNotificationsByDateParams = {
|
||||
userId: string;
|
||||
dateFrom?: Date;
|
||||
dateTo?: Date;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export interface ISystemNotification {
|
||||
id?: string;
|
||||
userId?: string;
|
||||
companyId?: string;
|
||||
serviceId?: string;
|
||||
conversationId?: string;
|
||||
subject: string;
|
||||
message: string;
|
||||
notificationDate: Date;
|
||||
readed: boolean;
|
||||
type?: string;
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export interface ISystemNotificationsAdapter {
|
||||
create(data: CreateSystemNotificationParams): Promise<ISystemNotification>;
|
||||
update(data: UpdateSystemNotificationParams): Promise<void>;
|
||||
delete(id: string): Promise<void>;
|
||||
deleteMany(data: Omit<DeleteSystemNotificationsByConversation, "sessionUser">): Promise<void>;
|
||||
find(filters: FindSystemNotificationsParams): Promise<ISystemNotification[]>;
|
||||
findOne(filters: FindSystemNotificationsParams): Promise<ISystemNotification | null>;
|
||||
paginate(filters: PaginateSystemNotificationsParams): Promise<PaginateSystemNotificationsResults>;
|
||||
deleteByQuery(data: FilterQuery<ISystemNotification>): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ISystemNotificationsManager {
|
||||
notifications: ISystemNotificationsAdapter;
|
||||
createNotification(data: CreateSystemNotificationParams): Promise<ISystemNotification>;
|
||||
updateNotification(data: UpdateSystemNotificationParams): Promise<void>;
|
||||
deleteNotification(data: DeleteSystemNotificationParams): Promise<void>;
|
||||
deleteConversationNotifications(data: DeleteSystemNotificationsByConversation): Promise<void>;
|
||||
paginateNotifications(
|
||||
data: PaginateSystemNotificationsParams
|
||||
): Promise<PaginateSystemNotificationsResults>;
|
||||
finUnreadNotifications(data: FindSystemNotificationsParams): Promise<UnreadNotificationResults>;
|
||||
deleteNotificationsByUser(data: DeleteNotificationsByUserParams): Promise<void>;
|
||||
setStateByUser(data: ToggleStateSystemNotificationsParams): Promise<void>;
|
||||
deleteNotificationsByDate(data: DeleteNotificationsByDateParams): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user