fixed errors

This commit is contained in:
2025-11-27 17:24:48 +01:00
parent 50a5f371dd
commit 5c6798a647
3 changed files with 13 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
using PyroFetes.DTO.Product.Response;
namespace PyroFetes.DTO.Supplier.Response;
public class GetSupplierDto
@@ -10,4 +12,5 @@ public class GetSupplierDto
public string? ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
public List<GetProductDto>? Products { get; set; }
}

View File

@@ -4,6 +4,7 @@ using PyroFetes.DTO.User.Request;
using PyroFetes.DTO.User.Response;
using PyroFetes.Models;
using PyroFetes.Repositories;
using PyroFetes.Specifications.Users;
namespace PyroFetes.Endpoints.Users;
@@ -19,6 +20,14 @@ public class CreateUserEndpoint(
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();
User user = new User()

View File

@@ -30,7 +30,7 @@ public class UpdateUserEndpoint(
return;
}
if (ckeckName != null)
if (ckeckName != null && ckeckName.Id != user.Id)
{
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
return;