Add project files.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using Core.Cerberos.Application.UseCases.Roles.Input;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Core.Cerberos.Application.UseCases.Roles.Validator
|
||||
{
|
||||
public class ChangeRoleStatusValidator : AbstractValidator<ChangeRoleStatusRequest>
|
||||
{
|
||||
public ChangeRoleStatusValidator()
|
||||
{
|
||||
RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Role ID").WithMessage("Role ID is Obligatory.");
|
||||
RuleFor(i => i.Status).NotNull().OverridePropertyName(x => x.Status).WithName("Status").WithMessage("Status is Obligatory.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Core.Cerberos.Application.UseCases.Roles.Input;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Core.Cerberos.Application.UseCases.Roles.Validator
|
||||
{
|
||||
public class CreateRoleValidator : AbstractValidator<CreateRoleRequest>
|
||||
{
|
||||
public CreateRoleValidator()
|
||||
{
|
||||
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Role Name").WithMessage("Role Name is Obligatory.");
|
||||
RuleFor(i => i.Description).NotEmpty().NotNull().OverridePropertyName(x => x.Description).WithName("Role Description").WithMessage("Role Description is Obligatory.");
|
||||
RuleFor(i => i.Applications).NotNull().OverridePropertyName(x => x.Applications).WithName("AccesLevel").WithMessage("Role must have at least one application.");
|
||||
RuleFor(i => i.Permissions).NotEmpty().NotNull().OverridePropertyName(x => x.Applications).WithName("Role permissions").WithMessage("Role Permissions are Obligatory.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Core.Cerberos.Application.UseCases.Roles.Input;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Core.Cerberos.Application.UseCases.Roles.Validator
|
||||
{
|
||||
public class UpdateRoleValidator : AbstractValidator<UpdateRoleRequest>
|
||||
{
|
||||
public UpdateRoleValidator()
|
||||
{
|
||||
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Role Name").WithMessage("Role Name is Obligatory.");
|
||||
RuleFor(i => i.Description).NotEmpty().NotNull().OverridePropertyName(x => x.Description).WithName("Role Description").WithMessage("Role Description is Obligatory.");
|
||||
RuleFor(i => i.Applications).NotEmpty().NotNull().OverridePropertyName(x => x.Applications).WithName("Role applications").WithMessage("Role Applications are Obligatory.");
|
||||
RuleFor(i => i.Permissions).NotEmpty().NotNull().OverridePropertyName(x => x.Applications).WithName("Role permissions").WithMessage("Role Permissions are Obligatory.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user