Created
July 9, 2022 15:06
-
-
Save MaxLarue/cdc6f7218b8bb43953f361b2c5df10ec to your computer and use it in GitHub Desktop.
appointment-rating
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
@Injectable() | |
export class AppointmentService { | |
constructor(@InjectRepository(Appointment) private readonly repository: Repository<Appointment>, | |
@Inject(QuotationService) private readonly quotationService: QuotationService, | |
@Inject(WorkOrderService) private readonly workOrderService: WorkOrderService, | |
@Inject(NotificationService) private readonly notificationService: NotificationService, | |
@Inject(StatusChangeHistoryService) private readonly statusChangeHistoryService: StatusChangeHistoryService, | |
@Inject(AppointmentPermissionService) private readonly appointmentPermissionService: AppointmentPermissionService, | |
@Inject(RatingServiceGateway) private readonly ratingServiceGateway: RatingServiceGateway) {} | |
async create(values: DeepPartial<Appointment>, currentUser: User) { | |
await this.appointmentPermissionService.verifyCanCreate(currentUser, values) | |
const appointment = await this.repository.save(values) | |
await this.quotationService.onAppointmentCreated(appointment) | |
await this.workOrderService.onAppointmentCreated(appointment) | |
await this.statusChangeHistoryService.onAppointmentCreated(appointment) | |
await this.notificationService.onAppointmentCreated(appointment) | |
await this.ratingServicegateway.onAppointmentCreated(appointment) | |
return appointment | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment