Ajout de Login et du model réuni avec tout les autres Sujet

This commit is contained in:
2025-10-16 16:30:17 +02:00
parent b3347fe163
commit 2112605cf3
20 changed files with 340 additions and 36 deletions

View File

@@ -1,9 +1,7 @@
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
using PyroFetes.DTO.Product.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
using PyroFetes.Models;
namespace PyroFetes.Endpoints.Product;
@@ -41,14 +39,20 @@ public class GetProductEndpoint(PyroFetesDbContext db)
var responseDto = new GetProductDto
{
Id = product.Id,
Reference = product.References,
// Le modèle Product contient "Reference" (string), pas "References" (int)
Reference = int.TryParse(product.Reference, out var refInt) ? refInt : 0,
Name = product.Name,
Duration = product.Duration,
Caliber = product.Caliber,
ApprovalNumber = product.ApprovalNumber,
Weight = product.Weight,
Nec = product.Nec,
SellingPrice = product.SellingPrice,
// Le prix de vente nest pas dans Product → récupéré via Price
SellingPrice = product.Prices.FirstOrDefault()?.SellingPrice ?? 0,
Image = product.Image,
Link = product.Link,
ClassificationId = product.ClassificationId,
@@ -72,4 +76,4 @@ public class GetProductEndpoint(PyroFetesDbContext db)
await Send.OkAsync(responseDto, ct);
}
}
}