29 lines
878 B
TypeScript
29 lines
878 B
TypeScript
import {
|
|
CreateJobParams,
|
|
INotificationJob,
|
|
} from "./NotificationJobs.Interface";
|
|
import { NotificationJobsAdapterMongoose } from "./NotificationJobs.Adapter.Mongoose";
|
|
|
|
class NotificationJobManager {
|
|
adapter: NotificationJobsAdapterMongoose;
|
|
|
|
constructor() {
|
|
this.adapter = new NotificationJobsAdapterMongoose();
|
|
}
|
|
|
|
public async createJob(data: CreateJobParams): Promise<INotificationJob> {
|
|
return this.adapter.create(data);
|
|
}
|
|
|
|
public async cancelByAppointment(appointmentId: string): Promise<void> {
|
|
return this.adapter.cancelByAppointment(appointmentId);
|
|
}
|
|
|
|
public async findByAppointment(appointmentId: string): Promise<INotificationJob[]> {
|
|
return this.adapter.findByAppointment(appointmentId);
|
|
}
|
|
}
|
|
|
|
const NotificationJobsList = new NotificationJobManager();
|
|
export default NotificationJobsList;
|