Skip to content

Commit

Permalink
Merge pull request #39 from advanced-computer-lab-2023/VCP-10
Browse files Browse the repository at this point in the history
fixing the problem with user id
  • Loading branch information
YehiaFarghaly authored Oct 14, 2023
2 parents 5340ce3 + 29de931 commit ed489fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion client/src/routes/MainRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const MainRoutes = {
element: <Account />,
},
{

path: 'admins',
element: <LazyAdmins />,
},
Expand Down Expand Up @@ -103,8 +104,9 @@ const MainRoutes = {
},
],
},

{
path: 'listOfPatients',
path: 'My Patients',
element: <LazyDoctorListofPatients />,
},
],
Expand Down
15 changes: 8 additions & 7 deletions clinic/src/database/repository/appointment-repository.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import AppointmentModel from '../models/Appointment.js';
import mongoose from 'mongoose';

class AppointmentRepository {
async findAppointmentsByUserId(id) {
// const objectId = mongoose.Types.ObjectId(id)
// console.log(objectId);
const appointments = await AppointmentModel.find({});
return appointments.filter((appointment) => appointment.patientId.toString() === id.toString()
);
}
async findAppointmentsByUserId(id) {
const userID = new mongoose.Types.ObjectId(id);
const appointments = await AppointmentModel.find({
$or: [{ patientId: userID }, { doctorId: userID }],
});
return appointments;
}
}

export default AppointmentRepository;

0 comments on commit ed489fa

Please sign in to comment.