Add CRUDs and validation/controllers
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using FluentValidation;
|
||||
using Imprink.Application.Domains.Users;
|
||||
|
||||
namespace Imprink.Application.Validation.Users;
|
||||
|
||||
public class SetUserFullNameCommandValidator : AbstractValidator<SetUserFullNameCommand>
|
||||
{
|
||||
public SetUserFullNameCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.FirstName)
|
||||
.NotEmpty().WithMessage("FirstName is required.")
|
||||
.Length(1, 50).WithMessage("FirstName must be between 1 and 50 characters.");
|
||||
|
||||
RuleFor(x => x.LastName)
|
||||
.NotEmpty().WithMessage("LastName is required.")
|
||||
.Length(1, 50).WithMessage("LastName must be between 1 and 50 characters.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using FluentValidation;
|
||||
using Imprink.Application.Domains.Users;
|
||||
|
||||
namespace Imprink.Application.Validation.Users;
|
||||
|
||||
public class SetUserPhoneCommandValidator : AbstractValidator<SetUserPhoneCommand>
|
||||
{
|
||||
public SetUserPhoneCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.PhoneNumber)
|
||||
.NotEmpty().WithMessage("PhoneNumber is required.")
|
||||
.Matches(@"^\+?[1-9]\d{1,14}$").WithMessage("PhoneNumber must be a valid phone number format.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user