-
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.
appointment creation and slot fecthing for appointment logics updated
- Loading branch information
Showing
14 changed files
with
48 additions
and
70 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
This file was deleted.
Oops, something went wrong.
18 changes: 12 additions & 6 deletions
18
server/src/infrastructure/repositories/AppointmentRepository.ts
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 |
---|---|---|
@@ -1,27 +1,33 @@ | ||
import IAppointment, { AppointmentStatus } from "../../domain/entities/IAppointment"; | ||
import IAppointmentRepository from "../../domain/interface/repositories/IAppointmentRepository"; | ||
import AppointmentModel from "../database/AppointmentModel"; | ||
import { isValidObjectId } from "../database/isValidObjId"; | ||
|
||
export default class AppointmentRepository implements IAppointmentRepository { | ||
model = AppointmentModel | ||
async create(appointment: IAppointment): Promise<void> { | ||
await this.model.create(appointment) | ||
} | ||
async update(appointment: IAppointment): Promise<void> { | ||
if (!isValidObjectId(appointment._id!)) throw new Error("Invalid Object Id"); | ||
await this.model.findByIdAndUpdate(appointment._id,appointment,{new:true}) | ||
await this.model.findByIdAndUpdate(appointment._id, appointment, { new: true }) | ||
} | ||
|
||
async findOneBySlotId(slotId: string): Promise<IAppointment | null> { | ||
return await this.model.findOne({slotId}); | ||
return await this.model.findOne({ slotId }); | ||
} | ||
|
||
async findManyByDateAndDoctorId(appointmentDate: string, doctorId: string): Promise<IAppointment[] | null> { | ||
return await this.model.find({appointmentDate,doctorId}); | ||
} | ||
async findByDateAndSlot(appointmentDate: string, slotId: string): Promise<IAppointment | null> { | ||
return await this.model.findOne({ appointmentDate, slotId }) | ||
} | ||
|
||
async updateStatusMany(appointmentIds: string[], status: AppointmentStatus): Promise<void> { | ||
await this.model.updateMany({_id:{$in:appointmentIds}},{status}) | ||
await this.model.updateMany({ _id: { $in: appointmentIds } }, { status }) | ||
} | ||
|
||
async updateManyBySlotIds(slotIds: string[], fields: Partial<IAppointment>): Promise<void> { | ||
await this.model.updateMany({ slotId: { $in: slotIds } }, fields); | ||
} | ||
|
||
} |
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
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
21 changes: 0 additions & 21 deletions
21
server/src/presentation/validators/AppointmentValidator.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
3612e13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
avm-care – ./
avm-care-git-main-sinans-projects-8d312afe.vercel.app
avm-care.vercel.app
avm-care-sinans-projects-8d312afe.vercel.app