mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 21:36:33 +00:00
f5e466108a
add ToHash for encryption Key
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using Azaion.Common.Entities;
|
|
using FluentValidation;
|
|
|
|
namespace Azaion.Common.Requests;
|
|
|
|
public class GetResourceRequest
|
|
{
|
|
public string Password { get; set; } = null!;
|
|
public HardwareInfo Hardware { get; set; } = null!;
|
|
public string FileName { get; set; } = null!;
|
|
}
|
|
|
|
public class GetResourceRequestValidator : AbstractValidator<GetResourceRequest>
|
|
{
|
|
public GetResourceRequestValidator()
|
|
{
|
|
RuleFor(r => r.Password)
|
|
.MinimumLength(8)
|
|
.WithErrorCode(ExceptionEnum.PasswordLengthIncorrect.ToString())
|
|
.WithMessage(_ => BusinessException.GetMessage(ExceptionEnum.PasswordLengthIncorrect));
|
|
|
|
RuleFor(r => r.Hardware)
|
|
.NotEmpty()
|
|
.WithMessage(_ => BusinessException.GetMessage(ExceptionEnum.BadHardware));
|
|
|
|
RuleFor(r => r.FileName)
|
|
.NotEmpty()
|
|
.WithErrorCode(ExceptionEnum.WrongResourceName.ToString())
|
|
.WithMessage(_ => BusinessException.GetMessage(ExceptionEnum.WrongResourceName));
|
|
}
|
|
} |