get resource works

This commit is contained in:
Alex Bezdieniezhnykh
2024-11-13 00:24:09 +02:00
parent ddbf8114ba
commit 4445fcd673
6 changed files with 58 additions and 11 deletions
@@ -1,4 +1,5 @@
using Azaion.Common.Entities;
using FluentValidation;
namespace Azaion.Common.Requests;
@@ -7,4 +8,16 @@ public class GetResourceRequest
public string Password { get; set; } = null!;
public string HardwareId { get; set; } = null!;
public ResourceEnum ResourceEnum { get; set; }
}
public class GetResourceRequestValidator : AbstractValidator<GetResourceRequest>
{
public GetResourceRequestValidator()
{
RuleFor(r => r.Password)
.MinimumLength(8).WithErrorCode(ExceptionEnum.PasswordLengthIncorrect.ToString()).WithMessage("Password should be at least 8 characters.");
RuleFor(r => r.HardwareId)
.NotEmpty().WithErrorCode(ExceptionEnum.HardwareIdMismatch.ToString()).WithMessage("Hardware Id should be not empty.");
}
}