Manage Appointments DONE!

This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 21:29:18 +03:00
parent 8663a186a0
commit 13bfa2bdd9
91 changed files with 762 additions and 52 deletions
@@ -13,7 +13,7 @@ public class PatientProfileValidation : AbstractValidator<PatientProfileDto>
RuleFor(x => x.Id)
.NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
.MustAsync(IsPatientRegistered).WithMessage("Patient is registered in system")
.MustAsync(IsPatientRegistered).WithMessage("Patient is not registered in system")
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
RuleFor(x => x.Email)
@@ -35,8 +35,8 @@ public class PatientProfileValidation : AbstractValidator<PatientProfileDto>
private async Task<bool> IsPatientRegistered(Guid id, CancellationToken cancellationToken)
{
var doctor = await _patientRepository.GetByIdAsync(id);
return doctor == null;
var patient = await _patientRepository.GetByIdAsync(id);
return patient != null;
}
private async Task<bool> BeUniqueEmail(string email, CancellationToken cancellationToken)