api v2.1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace Application.Endpoints.MedicalHistories;
|
||||
|
||||
public class MedicalHistoryAuthorisationModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public List<Guid> Authorisation { get; set; } = new List<Guid>();
|
||||
}
|
||||
@@ -84,6 +84,15 @@ public class MedicalHistoryHandler
|
||||
|
||||
//TODO add to MongoDB
|
||||
|
||||
var medicalHistoryId = medicalHistory.Id;
|
||||
var newMedicalHistory = new MedicalHistoryAuthorisationModel
|
||||
{
|
||||
Id = medicalHistoryId,
|
||||
Authorisation = new List<Guid>()
|
||||
};
|
||||
|
||||
await _mongoDbService.AddAsync("MedicalHistory", newMedicalHistory);
|
||||
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.Created,
|
||||
|
||||
+7
-4
@@ -14,16 +14,19 @@ public class PatientRegistrationValidation : AbstractValidator<PatientRegistrati
|
||||
RuleFor(x => x.Email)
|
||||
.NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MustAsync(BeUniqueEmail).WithMessage("Email already exists.").WithErrorCode(HttpStatusCodes.Conflict.ToString());
|
||||
|
||||
.MustAsync(BeUniqueEmail).WithMessage("Email already exists.")
|
||||
.WithErrorCode(HttpStatusCodes.Conflict.ToString());
|
||||
|
||||
|
||||
RuleFor(x => x.Password)
|
||||
.NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MinimumLength(8).WithMessage("Password must be at least 8 characters long.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
||||
.MinimumLength(8).WithMessage("Password must be at least 8 characters long.")
|
||||
.WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
||||
|
||||
RuleFor(x => x.Name)
|
||||
.NotEmpty().WithMessage("Name is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
|
||||
.MinimumLength(3).WithMessage("Name must be at least 3 characters long.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
||||
.MinimumLength(3).WithMessage("Name must be at least 3 characters long.")
|
||||
.WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
||||
}
|
||||
|
||||
private async Task<bool> BeUniqueEmail(string email, CancellationToken cancellationToken)
|
||||
|
||||
Reference in New Issue
Block a user