-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import INotification from "../../domain/entities/INotification"; | ||
import INotificationRepository from "../../domain/interface/repositories/INotificationRepository"; | ||
import IValidatorService from "../../domain/interface/services/IValidatorService"; | ||
|
||
export default class NotificationUseCae { | ||
constructor( | ||
private notificationRepository: INotificationRepository, | ||
private validatorService: IValidatorService | ||
) { }; | ||
|
||
async clearAll(notificationIds:string[]):Promise<void>{ | ||
this.validatorService.validateMultipleIds(notificationIds) | ||
await this.notificationRepository.clearAll(notificationIds) | ||
} | ||
async clearOn(notificationId:string):Promise<void>{ | ||
this.validatorService.validateIdFormat(notificationId); | ||
await this.notificationRepository.clear(notificationId) | ||
} | ||
|
||
async getAllPatient(patientId: string): Promise<INotification[] | null> { | ||
this.validatorService.validateIdFormat(patientId) | ||
return await this.notificationRepository.findByPatientId(patientId); | ||
} | ||
async getAllDoctor(doctorId: string): Promise<INotification[] | null> { | ||
this.validatorService.validateIdFormat(doctorId); | ||
return await this.notificationRepository.findByDoctorId(doctorId) | ||
} | ||
} |