medicalHistory: deletion when patient is deleted

This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 22:06:01 +03:00
parent 13bfa2bdd9
commit 7b24c178b3
62 changed files with 321 additions and 356 deletions
@@ -1,7 +1,7 @@
using Application.Endpoints;
using Application.Endpoints.Appointments;
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Application.Services.Database.PostgreSQL;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
@@ -9,8 +9,8 @@ namespace API.Controllers;
public class AppointmentsController : BaseApiController
{
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
private readonly IPatientRepository _patientRepository;
public AppointmentsController(IAppointmentsMongoDbService appointmentsMongoDbService,
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
@@ -23,7 +23,8 @@ public class AppointmentsController : BaseApiController
[HttpPost]
public async Task<ActionResult<BaseResponse>> CreateAppointment(AppointmentManagementDto dto)
{
var handler = new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
var handler =
new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
var response = await handler.HandleCreateAppointment(dto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}
@@ -31,7 +32,8 @@ public class AppointmentsController : BaseApiController
[HttpDelete]
public async Task<ActionResult<BaseResponse>> DeleteAppointment(AppointmentManagementDto dto)
{
var handler = new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
var handler =
new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
var response = await handler.HandleDeleteAppointment(dto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}