medicalHistory: deletion when patient is deleted
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Core.Entities;
|
||||
|
||||
namespace Application.Endpoints.Appointments;
|
||||
@@ -7,8 +7,8 @@ namespace Application.Endpoints.Appointments;
|
||||
public class AppointmentManagementHandler
|
||||
{
|
||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
|
||||
public AppointmentManagementHandler(IAppointmentsMongoDbService appointmentsMongoDbService,
|
||||
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
|
||||
@@ -41,18 +41,18 @@ public class AppointmentManagementHandler
|
||||
var appointmentId = IdentifierGenerator.GenerateId(dto.DoctorId, dto.PatientId);
|
||||
var criteria = new List<(string FieldName, string Value)>
|
||||
{
|
||||
("_id", appointmentId),
|
||||
("_id", appointmentId)
|
||||
};
|
||||
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
||||
|
||||
if(!appointments.Any())
|
||||
|
||||
if (!appointments.Any())
|
||||
{
|
||||
var appointment = new Appointment();
|
||||
appointment.SetId(appointmentId);
|
||||
appointment.SetDoctorIid(dto.DoctorId.ToString());
|
||||
appointment.SetPatientId(dto.PatientId.ToString());
|
||||
appointment.AddAppointment(dto.Appointment);
|
||||
|
||||
|
||||
await _appointmentsMongoDbService.AddAsync(appointment);
|
||||
}
|
||||
else
|
||||
@@ -62,14 +62,14 @@ public class AppointmentManagementHandler
|
||||
await _appointmentsMongoDbService.ModifyAsync("_id", appointmentId, appointment);
|
||||
}
|
||||
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.Created,
|
||||
Message = "Appointment successfully created.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public async Task<BaseResponse> HandleDeleteAppointment(AppointmentManagementDto dto)
|
||||
{
|
||||
var validation = new DeleteAppointmentValidator(_appointmentsMongoDbService,
|
||||
@@ -89,29 +89,27 @@ public class AppointmentManagementHandler
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var appointmentId = IdentifierGenerator.GenerateId(dto.DoctorId, dto.PatientId);
|
||||
var criteria = new List<(string FieldName, string Value)>
|
||||
{
|
||||
("_id", appointmentId),
|
||||
("_id", appointmentId)
|
||||
};
|
||||
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
||||
|
||||
if(!appointments.Any())
|
||||
{
|
||||
return new BaseResponse()
|
||||
|
||||
if (!appointments.Any())
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.NotFound,
|
||||
Message = "Appointment not found in system.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var appointment = appointments[0];
|
||||
appointment.RemoveAppointment(dto.Appointment);
|
||||
await _appointmentsMongoDbService.ModifyAsync("_id", appointmentId, appointment);
|
||||
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.OK,
|
||||
Message = "Appointment successfully removed.",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Appointments;
|
||||
@@ -9,7 +9,7 @@ public class CreateAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
|
||||
|
||||
public CreateAppointmentValidator(IAppointmentsMongoDbService appointmentsMongoDbService,
|
||||
IDoctorRepository doctorRepository, IPatientRepository patientRepository)
|
||||
{
|
||||
@@ -17,7 +17,7 @@ public class CreateAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
.NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MustAsync(IsDoctorRegistered).WithMessage("Doctor is not registered in system")
|
||||
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
|
||||
|
||||
|
||||
RuleFor(x => x.PatientId)
|
||||
.NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MustAsync(IsPatientRegistered).WithMessage("Patient is not registered in system")
|
||||
@@ -30,18 +30,18 @@ public class CreateAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
RuleFor(x => x)
|
||||
.MustAsync(IsAppointmentUnique).WithMessage("Appointment already in system.")
|
||||
.WithErrorCode(HttpStatusCodes.Conflict.ToString());
|
||||
|
||||
|
||||
_appointmentsMongoDbService = appointmentsMongoDbService;
|
||||
_doctorRepository = doctorRepository;
|
||||
_patientRepository = patientRepository;
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> IsDoctorRegistered(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
var doctor = await _doctorRepository.GetByIdAsync(id);
|
||||
return doctor != null;
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> IsPatientRegistered(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
var patient = await _patientRepository.GetByIdAsync(id);
|
||||
@@ -50,9 +50,9 @@ public class CreateAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
|
||||
private bool IsAppointmentValidFormat(DateTime appointment)
|
||||
{
|
||||
if (appointment == default(DateTime))
|
||||
if (appointment == default)
|
||||
return false;
|
||||
|
||||
|
||||
if (appointment.Date < DateTime.UtcNow.Date)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Core.Entities;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Appointments;
|
||||
@@ -10,7 +9,7 @@ public class DeleteAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
|
||||
|
||||
public DeleteAppointmentValidator(IAppointmentsMongoDbService appointmentsMongoDbService,
|
||||
IDoctorRepository doctorRepository, IPatientRepository patientRepository)
|
||||
{
|
||||
@@ -18,7 +17,7 @@ public class DeleteAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
.NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MustAsync(IsDoctorRegistered).WithMessage("Doctor is not registered in system")
|
||||
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
|
||||
|
||||
|
||||
RuleFor(x => x.PatientId)
|
||||
.NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MustAsync(IsPatientRegistered).WithMessage("Patient is not registered in system")
|
||||
@@ -31,18 +30,18 @@ public class DeleteAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
RuleFor(x => x)
|
||||
.MustAsync(DoesAppointmentExists).WithMessage("Appointment not found in system")
|
||||
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
|
||||
|
||||
|
||||
_appointmentsMongoDbService = appointmentsMongoDbService;
|
||||
_doctorRepository = doctorRepository;
|
||||
_patientRepository = patientRepository;
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> IsDoctorRegistered(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
var doctor = await _doctorRepository.GetByIdAsync(id);
|
||||
return doctor != null;
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> IsPatientRegistered(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
var patient = await _patientRepository.GetByIdAsync(id);
|
||||
@@ -51,9 +50,9 @@ public class DeleteAppointmentValidator : AbstractValidator<AppointmentManagemen
|
||||
|
||||
private bool IsAppointmentValidFormat(DateTime appointment)
|
||||
{
|
||||
if (appointment == default(DateTime))
|
||||
if (appointment == default)
|
||||
return false;
|
||||
|
||||
|
||||
if (appointment.Date < DateTime.UtcNow.Date)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Core.Entities;
|
||||
|
||||
namespace Application.Endpoints.Chats;
|
||||
@@ -7,8 +7,8 @@ namespace Application.Endpoints.Chats;
|
||||
public class ChatHandler
|
||||
{
|
||||
private readonly IChatMongoDbService _chatMongoDbService;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
|
||||
public ChatHandler(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
|
||||
IDoctorRepository doctorRepository)
|
||||
@@ -38,30 +38,26 @@ public class ChatHandler
|
||||
}
|
||||
|
||||
if (!await CheckForUsersExistence(sendMessageDto.Sender, sendMessageDto.Receiver))
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.BadRequest,
|
||||
Message = "Users can't be found in the system.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
var chatId = IdentifierGenerator.GenerateId(sendMessageDto.Sender, sendMessageDto.Receiver);
|
||||
|
||||
|
||||
var criteria = new List<(string, string)>();
|
||||
criteria.Add(("_id", chatId));
|
||||
|
||||
var documents = await _chatMongoDbService.FindAsync<Chat>(criteria);
|
||||
if (!documents.Any())
|
||||
{
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.NotFound,
|
||||
Message = "Access to medical history not found.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
var chat = documents[0].Messages;
|
||||
chat.Add(new Message(sendMessageDto.Sender, sendMessageDto.Message));
|
||||
@@ -71,7 +67,7 @@ public class ChatHandler
|
||||
newChat.SetMessages(chat);
|
||||
|
||||
await _chatMongoDbService.ModifyAsync("_id", chatId, newChat);
|
||||
|
||||
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.NoContent,
|
||||
@@ -100,20 +96,18 @@ public class ChatHandler
|
||||
}
|
||||
|
||||
if (!await CheckForUsersExistence(getConversationDto.IdUser1, getConversationDto.IdUser2))
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.BadRequest,
|
||||
Message = "Users can't be found in the system.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
var chatId = IdentifierGenerator.GenerateId(getConversationDto.IdUser1, getConversationDto.IdUser2);
|
||||
|
||||
|
||||
var criteria = new List<(string, string)>();
|
||||
criteria.Add(("_id", chatId));
|
||||
|
||||
|
||||
Chat? chat = null;
|
||||
|
||||
var documents = await _chatMongoDbService.FindAsync<Chat>(criteria);
|
||||
@@ -128,7 +122,7 @@ public class ChatHandler
|
||||
{
|
||||
chat = documents[0];
|
||||
}
|
||||
|
||||
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.OK,
|
||||
@@ -141,7 +135,7 @@ public class ChatHandler
|
||||
{
|
||||
var firstCheck = await _patientRepository.GetByIdAsync(idUser1) != null &&
|
||||
await _doctorRepository.GetByIdAsync(idUser2) != null;
|
||||
|
||||
|
||||
var secondCheck = await _patientRepository.GetByIdAsync(idUser2) != null &&
|
||||
await _doctorRepository.GetByIdAsync(idUser1) != null;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class SendMessageValidator : AbstractValidator<SendMessageDto>
|
||||
|
||||
RuleFor(x => x.Receiver)
|
||||
.NotEmpty().WithMessage("Receiver Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
||||
|
||||
|
||||
RuleFor(x => x.Message)
|
||||
.NotEmpty().WithMessage("Message is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
|
||||
namespace Application.Endpoints.Doctors.Login;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Doctors.Login;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
|
||||
namespace Application.Endpoints.Doctors.Profile;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Doctors.Profile;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
using Core.Entities;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Doctors.Registration;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
|
||||
namespace Application.Endpoints.Doctors.ResetPassword;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Doctors.ResetPassword;
|
||||
|
||||
@@ -5,12 +5,12 @@ public class IdentifierGenerator
|
||||
public static string GenerateId(Guid id1, Guid id2)
|
||||
{
|
||||
// Convert GUIDs to strings
|
||||
string strId1 = id1.ToString();
|
||||
string strId2 = id2.ToString();
|
||||
var strId1 = id1.ToString();
|
||||
var strId2 = id2.ToString();
|
||||
|
||||
// Sort the GUID strings
|
||||
string firstId = strId1.CompareTo(strId2) < 0 ? strId1 : strId2;
|
||||
string secondId = strId1.CompareTo(strId2) < 0 ? strId2 : strId1;
|
||||
var firstId = strId1.CompareTo(strId2) < 0 ? strId1 : strId2;
|
||||
var secondId = strId1.CompareTo(strId2) < 0 ? strId2 : strId1;
|
||||
|
||||
// Combine them to get a symmetric string
|
||||
return firstId + "-" + secondId;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Core.Entities;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
||||
|
||||
public class MedicalHistoryFileManagementHandler
|
||||
{
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
|
||||
public MedicalHistoryFileManagementHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
||||
|
||||
+15
-23
@@ -1,13 +1,13 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
|
||||
|
||||
public class MedicalHistoryManageAuthorizationHandler
|
||||
{
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
|
||||
public MedicalHistoryManageAuthorizationHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
||||
IMedicalHistoryMongoDbService medicalHistoryMongoDbService, IDoctorRepository doctorRepository)
|
||||
@@ -41,28 +41,24 @@ public class MedicalHistoryManageAuthorizationHandler
|
||||
|
||||
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
|
||||
if (!documents.Any())
|
||||
{
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.NotFound,
|
||||
Message = "Access to medical history not found.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var authorisations = documents[0].Authorisation;
|
||||
if (authorisations.Contains(infoDto.ToString()))
|
||||
{
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.Conflict,
|
||||
Message = "Access to medical history already granted.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
authorisations.Add(infoDto.DoctorId.ToString());
|
||||
var authorizationModel = new MedicalHistoryAuthorisationModel()
|
||||
var authorizationModel = new MedicalHistoryAuthorisationModel
|
||||
{
|
||||
Id = infoDto.MedicalRecordId.ToString(),
|
||||
Authorisation = authorisations
|
||||
@@ -70,7 +66,7 @@ public class MedicalHistoryManageAuthorizationHandler
|
||||
|
||||
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
|
||||
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.OK,
|
||||
Message = "Access to medical history granted.",
|
||||
@@ -102,28 +98,24 @@ public class MedicalHistoryManageAuthorizationHandler
|
||||
|
||||
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
|
||||
if (!documents.Any())
|
||||
{
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.NotFound,
|
||||
Message = "Access to medical history not found.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var authorisations = documents[0].Authorisation;
|
||||
if (!authorisations.Contains(infoDto.DoctorId.ToString()))
|
||||
{
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.Conflict,
|
||||
Message = "Access to medical history already revoked.",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
authorisations.Remove(infoDto.DoctorId.ToString());
|
||||
var authorizationModel = new MedicalHistoryAuthorisationModel()
|
||||
var authorizationModel = new MedicalHistoryAuthorisationModel
|
||||
{
|
||||
Id = infoDto.MedicalRecordId.ToString(),
|
||||
Authorisation = authorisations
|
||||
@@ -131,7 +123,7 @@ public class MedicalHistoryManageAuthorizationHandler
|
||||
|
||||
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
|
||||
|
||||
return new BaseResponse()
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.OK,
|
||||
Message = "Access to medical history granted.",
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
|
||||
|
||||
public class MedicalHistoryManageAuthorizationValidation : AbstractValidator<MedicalHistoryManageAuthorizationDoctorDto>
|
||||
{
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
|
||||
public MedicalHistoryManageAuthorizationValidation(IMedicalHistoryRepository medicalHistoryRepository,
|
||||
IDoctorRepository doctorRepository)
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
public class MedicalHistoryAuthorisationModel
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public List<string> Authorisation { get; set; } = new List<string>();
|
||||
public List<string> Authorisation { get; set; } = new();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Core.Entities;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories;
|
||||
|
||||
public class MedicalHistoryHandler
|
||||
{
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
|
||||
public MedicalHistoryHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
||||
@@ -80,7 +80,7 @@ public class MedicalHistoryHandler
|
||||
UserId = medicalHistoryCreateDto.UserId,
|
||||
Content = medicalHistoryCreateDto.Content
|
||||
};
|
||||
|
||||
|
||||
var medicalHistoryId = medicalHistory.Id;
|
||||
var newMedicalHistory = new MedicalHistoryAuthorisationModel
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.MedicalHistories;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
|
||||
namespace Application.Endpoints.Patients.Login;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Patients.Login;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
|
||||
namespace Application.Endpoints.Patients.Profile;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Patients.Profile;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
using Core.Entities;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Patients.Registration;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using Application.Services.HashingAlgorithms;
|
||||
|
||||
namespace Application.Endpoints.Patients.ResetPassword;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.PostgreSQL;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Application.Endpoints.Patients.ResetPassword;
|
||||
|
||||
Reference in New Issue
Block a user