Dashboard Page - Appointments:

- create separate dashboard components for doctor and patient
- add appointments to dashboard components
- add code to backend for appointments retrieval
This commit is contained in:
ElenitaMLG
2024-04-30 12:48:19 +03:00
parent 1ff7f51aa6
commit 7e38d60802
17 changed files with 665 additions and 30 deletions
@@ -116,4 +116,50 @@ public class AppointmentManagementHandler
Data = null
};
}
public async Task<BaseResponse> HandleGetAppointmentsByPatientId(Guid patientId)
{
var criteria = new List<(string FieldName, string Value)>
{
("PatientId", patientId.ToString())
};
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
if (appointments.Count == 0)
return new BaseResponse
{
StatusCode = HttpStatusCodes.NotFound,
Message = $"Appointments not found in system for patient with id {patientId}.",
Data = null
};
return new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = $"Appointments for patient with id {patientId} successfully retrieved.",
Data = appointments
};
}
public async Task<BaseResponse> HandleGetAppointmentsByDoctorId(Guid doctorId)
{
var criteria = new List<(string FieldName, string Value)>
{
("DoctorId", doctorId.ToString())
};
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
if (appointments.Count == 0)
return new BaseResponse
{
StatusCode = HttpStatusCodes.NotFound,
Message = $"Appointments not found in system for doctor with id {doctorId}.",
Data = null
};
return new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = $"Appointments for doctor with id {doctorId} successfully retrieved.",
Data = appointments
};
}
}