mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 12:06:34 +00:00
23 lines
770 B
C#
23 lines
770 B
C#
using Azaion.Common.Entities;
|
|
using FluentValidation;
|
|
|
|
namespace Azaion.Common.Requests;
|
|
|
|
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.");
|
|
}
|
|
} |