Compare commits
3 Commits
da1407579d
...
3065bba7fb
| Author | SHA1 | Date | |
|---|---|---|---|
| 3065bba7fb | |||
| 697e1431d9 | |||
| de6a1c5385 |
@@ -12,7 +12,7 @@ public class UpdateDelivererEndpoint(DeliverersRepository deliverersRepository,
|
|||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/deliverers/{@Id}", x => new { x.Id });
|
Put("/deliverers/{@Id}", x => new { x.Id });
|
||||||
Roles("Admin");
|
Roles("Admin", "Employe");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateDelivererDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateDelivererDto req, CancellationToken ct)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DeleteProductFromQuotationEndpoint(QuotationProductsRepository quot
|
|||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/quotations/{@ProductId}/{@QuotationId}", x => new { x.ProductId, x.QuotationId });
|
Delete("/quotations/{@ProductId}/{@QuotationId}", x => new { x.ProductId, x.QuotationId });
|
||||||
Roles("Admin");
|
Roles("Admin", "Employe");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteQuotationProductRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteQuotationProductRequest req, CancellationToken ct)
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using FluentValidation;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
|
||||||
|
namespace PyroFetes.Validators.Users;
|
||||||
|
|
||||||
|
public class ConnectUserDtoValidator : Validator<ConnectUserDto>
|
||||||
|
{
|
||||||
|
public ConnectUserDtoValidator()
|
||||||
|
{
|
||||||
|
RuleFor(x => x.Name)
|
||||||
|
.NotEmpty()
|
||||||
|
.WithMessage("Username is required")
|
||||||
|
.MaximumLength(50)
|
||||||
|
.WithMessage("Username cannot exceed 50 characters")
|
||||||
|
.MinimumLength(2)
|
||||||
|
.WithMessage("Username must exceed 2 characters");
|
||||||
|
|
||||||
|
RuleFor(x => x.Password)
|
||||||
|
.NotEmpty()
|
||||||
|
.WithMessage("Password is required");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using FluentValidation;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
|
||||||
|
namespace PyroFetes.Validators.Users;
|
||||||
|
|
||||||
|
public class CreateUpdateUserDtoValidator: Validator<UpdateUserDto>
|
||||||
|
{
|
||||||
|
public CreateUpdateUserDtoValidator()
|
||||||
|
{
|
||||||
|
RuleFor(x => x.Email)
|
||||||
|
.NotEmpty()
|
||||||
|
.WithMessage("L'email est requis")
|
||||||
|
.MaximumLength(100)
|
||||||
|
.WithMessage("L'email ne doit pas dépasser plus de 100 caractères")
|
||||||
|
.EmailAddress()
|
||||||
|
.WithMessage("Adresse email invalide");
|
||||||
|
|
||||||
|
RuleFor(x => x.Password)
|
||||||
|
.NotEmpty()
|
||||||
|
.WithMessage("Le mot de passe est requis")
|
||||||
|
.MinimumLength(12)
|
||||||
|
.WithMessage("Le mot de passe doit contenir au minimum 12 caractères")
|
||||||
|
.Matches(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*?[#?_!@$%^&*-])");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using FluentValidation;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
|
||||||
|
namespace PyroFetes.Validators.Users;
|
||||||
|
|
||||||
|
public class CreateUserDtoValidator : Validator<CreateUserDto>
|
||||||
|
{
|
||||||
|
public CreateUserDtoValidator()
|
||||||
|
{
|
||||||
|
RuleFor(x => x.Email)
|
||||||
|
.NotEmpty()
|
||||||
|
.WithMessage("L'email est requis")
|
||||||
|
.MaximumLength(100)
|
||||||
|
.WithMessage("L'email ne doit pas dépasser plus de 100 caractères")
|
||||||
|
.EmailAddress()
|
||||||
|
.WithMessage("Adresse email invalide");
|
||||||
|
|
||||||
|
RuleFor(x => x.Password)
|
||||||
|
.NotEmpty()
|
||||||
|
.WithMessage("Le mot de passe est requis")
|
||||||
|
.MinimumLength(12)
|
||||||
|
.WithMessage("Le mot de passe doit contenir au minimum 12 caractères")
|
||||||
|
.Matches(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*?[#?_!@$%^&*-])");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user