diff --git a/server/src/domain/entities/IAppointment.ts b/server/src/domain/entities/IAppointment.ts index d096d751..a543ce53 100644 --- a/server/src/domain/entities/IAppointment.ts +++ b/server/src/domain/entities/IAppointment.ts @@ -1,5 +1,5 @@ import IDoctor from "./IDoctor"; -import IPatient from "./IPatient"; +import IPatient from "./IPatient"; import ISlot from "./ISlot"; export enum AppointmentStatus { @@ -21,7 +21,7 @@ export default interface IAppointment { readonly createdAt?: string; readonly updatedAt?: string; readonly appointmentType?: AppointmentType; - readonly appointmentDate?: string; + readonly appointmentDate?: string | Date; readonly reason?: string; readonly notes?: string; readonly paymentId?: string; diff --git a/server/src/use_case/appointment/CreateAppointmentUseCase.ts b/server/src/use_case/appointment/CreateAppointmentUseCase.ts index 45537000..acc12b45 100644 --- a/server/src/use_case/appointment/CreateAppointmentUseCase.ts +++ b/server/src/use_case/appointment/CreateAppointmentUseCase.ts @@ -29,7 +29,7 @@ export default class AppointmentUseCase { if (slot.status === "booked") { const bookedAppointment = await this.appointmentRepository.findByDateAndSlot( - appointmentData.appointmentDate!, + appointmentData.appointmentDate! as string, appointmentData.slotId! ); if (bookedAppointment) throw new CustomError("Slot already booked", StatusCode.Conflict); @@ -111,7 +111,7 @@ export default class AppointmentUseCase { this.validatorService.validateIdFormat(slotId!); this.validatorService.validateIdFormat(patientId!); this.validatorService.validateEnum(appointmentType!, Object.values(AppointmentType)); - this.validatorService.validateDateFormat(appointmentDate!); + this.validatorService.validateDateFormat(appointmentDate! as string); this.validatorService.validateLength(reason!, 1, 255); if (notes) this.validatorService.validateLength(notes, 0, 255);