fixed errors
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Supplier.Response;
|
namespace PyroFetes.DTO.Supplier.Response;
|
||||||
|
|
||||||
public class GetSupplierDto
|
public class GetSupplierDto
|
||||||
@@ -10,4 +12,5 @@ public class GetSupplierDto
|
|||||||
public string? ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
public string? City { get; set; }
|
public string? City { get; set; }
|
||||||
public int DeliveryDelay { get; set; }
|
public int DeliveryDelay { get; set; }
|
||||||
|
public List<GetProductDto>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using PyroFetes.DTO.User.Request;
|
|||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
using PyroFetes.Repositories;
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
@@ -19,6 +20,14 @@ public class CreateUserEndpoint(
|
|||||||
|
|
||||||
public override async Task HandleAsync(CreateUserDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateUserDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
|
User? ckeckName = await usersRepository.FirstOrDefaultAsync(new GetUserByNameSpec(req.Name!), ct);
|
||||||
|
|
||||||
|
if (ckeckName != null)
|
||||||
|
{
|
||||||
|
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
||||||
|
|
||||||
User user = new User()
|
User user = new User()
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class UpdateUserEndpoint(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ckeckName != null)
|
if (ckeckName != null && ckeckName.Id != user.Id)
|
||||||
{
|
{
|
||||||
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
|
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user