correction types warehouses, products et suppliers

This commit is contained in:
2025-11-27 14:52:09 +01:00
parent 038b0aa26d
commit cd7bfe618a
17 changed files with 47 additions and 47 deletions

View File

@@ -6,7 +6,7 @@ namespace PyroFetes.DTO.Product.Request
public class CreateProductDto
{
// Référence interne du produit
public int References { get; set; }
public string? Reference { get; set; }
// Nom du produit
public string? Name { get; set; }
@@ -18,7 +18,7 @@ namespace PyroFetes.DTO.Product.Request
public decimal Caliber { get; set; }
// Numéro dhomologation
public int ApprovalNumber { get; set; }
public string? ApprovalNumber { get; set; }
// Poids du produit
public decimal Weight { get; set; }

View File

@@ -9,7 +9,7 @@ namespace PyroFetes.DTO.Product.Request
public int Id { get; set; }
// Référence interne du produit
public int References { get; set; }
public string? Reference { get; set; }
// Nom du produit
public string? Name { get; set; }
@@ -21,7 +21,7 @@ namespace PyroFetes.DTO.Product.Request
public decimal Caliber { get; set; }
// Numéro dhomologation
public int ApprovalNumber { get; set; }
public string? ApprovalNumber { get; set; }
// Poids du produit
public decimal Weight { get; set; }

View File

@@ -10,7 +10,7 @@ namespace PyroFetes.DTO.Product.Response
public int Id { get; set; }
// Référence interne du produit
public int Reference { get; set; }
public string? Reference { get; set; }
// Nom du produit
public string? Name { get; set; }
@@ -22,7 +22,7 @@ namespace PyroFetes.DTO.Product.Response
public decimal Caliber { get; set; }
// Numéro dhomologation
public int ApprovalNumber { get; set; }
public string? ApprovalNumber { get; set; }
// Poids du produit
public decimal Weight { get; set; }

View File

@@ -4,22 +4,22 @@
public class CreateSupplierDto
{
// Nom du fournisseur
public string Name { get; set; }
public string? Name { get; set; }
// Email du fournisseur
public string Email { get; set; }
public string? Email { get; set; }
// Numéro de téléphone du fournisseur
public string PhoneNumber { get; set; }
public string? PhoneNumber { get; set; }
// Adresse du fournisseur
public string Adress { get; set; }
public string? Adress { get; set; }
// Code postal de l'adresse
public int ZipCode { get; set; }
public string? ZipCode { get; set; }
// Ville de l'adresse
public string City { get; set; }
public string? City { get; set; }
// Liste des produits fournis par ce fournisseur dans la classe SupplierProductPriceDto
public List<SupplierProductPriceDto>? Products { get; set; }

View File

@@ -7,22 +7,22 @@
public int Id { get; set; }
// Nom du fournisseur
public string Name { get; set; }
public string? Name { get; set; }
// Email du fournisseur
public string Email { get; set; }
public string? Email { get; set; }
// Numéro de téléphone du fournisseur
public string PhoneNumber { get; set; }
public string? PhoneNumber { get; set; }
// Adresse du fournisseur
public string Adress { get; set; }
public string? Adress { get; set; }
// Code postal de l'adresse
public int ZipCode { get; set; }
public string? ZipCode { get; set; }
// Ville de l'adresse
public string City { get; set; }
public string? City { get; set; }
// Liste des produits fournis par ce fournisseur relié à la classe SupplierProductPriceDto
public List<SupplierProductPriceDto>? Products { get; set; }

View File

@@ -9,22 +9,22 @@ namespace PyroFetes.DTO.Supplier.Response
public int Id { get; set; }
// Nom du fournisseur
public string Name { get; set; }
public string? Name { get; set; }
// Email du fournisseur
public string Email { get; set; }
public string? Email { get; set; }
// Numéro de téléphone
public string PhoneNumber { get; set; }
public string? PhoneNumber { get; set; }
// Adresse du fournisseur
public string Adress { get; set; }
public string? Adress { get; set; }
// Code postal
public int ZipCode { get; set; }
public string? ZipCode { get; set; }
// Ville
public string City { get; set; }
public string? City { get; set; }
// Liste des produits fournis par la classe SupplierProductPriceDto
public List<SupplierProductPriceDto> Products { get; set; } = new();

View File

@@ -4,7 +4,7 @@
public class CreateWarehouseDto
{
// Nom de l'entrepôt
public string Name { get; set; }
public string? Name { get; set; }
// Poids maximal que l'entrepôt peut contenir
public int MaxWeight { get; set; }
@@ -16,13 +16,13 @@
public int MinWeight { get; set; }
// Adresse de l'entrepôt
public string Adress { get; set; }
public string? Adress { get; set; }
// Code postal
public int ZipCode { get; set; }
public string? ZipCode { get; set; }
// Ville
public string City { get; set; }
public string? City { get; set; }
// Liste des produits à stocker dans cet entrepôt venant de la classe en dessous
public List<CreateWarehouseProductDto>? Products { get; set; }

View File

@@ -7,7 +7,7 @@
public int Id { get; set; }
// Nom de l'entrepôt
public string Name { get; set; }
public string? Name { get; set; }
// Poids maximal que l'entrepôt peut contenir
public int MaxWeight { get; set; }
@@ -19,13 +19,13 @@
public int MinWeight { get; set; }
// Adresse de l'entrepôt
public string Adress { get; set; }
public string? Adress { get; set; }
// Code postal
public int ZipCode { get; set; }
public string? ZipCode { get; set; }
// Ville
public string City { get; set; }
public string? City { get; set; }
// Liste des produits à mettre à jour dans cet entrepôt
public List<UpdateWarehouseProductDto>? Products { get; set; }

View File

@@ -7,7 +7,7 @@
public int Id { get; set; }
// Nom de l'entrepôt
public string Name { get; set; }
public string? Name { get; set; }
// Poids maximal que l'entrepôt peut contenir
public int MaxWeight { get; set; }
@@ -19,13 +19,13 @@
public int MinWeight { get; set; }
// Adresse de l'entrepôt
public string Adress { get; set; }
public string? Adress { get; set; }
// Code postal
public int ZipCode { get; set; }
public string? ZipCode { get; set; }
// Ville
public string City { get; set; }
public string? City { get; set; }
// Liste des produits stockés dans l'entrepôt
public List<WarehouseProductDto>? Products { get; set; }

View File

@@ -19,7 +19,7 @@ public class CreateProductEndpoint(PyroFetesDbContext db)
{
var product = new Models.Product
{
Reference = req.References.ToString(),
Reference = req.Reference,
Name = req.Name!,
Duration = req.Duration,
Caliber = req.Caliber,
@@ -75,7 +75,7 @@ public class CreateProductEndpoint(PyroFetesDbContext db)
var response = new GetProductDto
{
Id = product.Id,
Reference = req.References,
Reference = req.Reference,
Name = req.Name,
Duration = req.Duration,
Caliber = req.Caliber,

View File

@@ -20,7 +20,7 @@ public class GetAllProductsEndpoint(PyroFetesDbContext db)
// Inclure toutes les relations nécessaires : Prices + WarehouseProducts + Warehouse
var products = await db.Products
.Include(p => p.Prices)
.Include(p => p.WarehouseProducts)
.Include(p => p.WarehouseProducts)!
.ThenInclude(wp => wp.Warehouse)
.ToListAsync(ct);
@@ -28,7 +28,7 @@ public class GetAllProductsEndpoint(PyroFetesDbContext db)
{
Id = p.Id,
// Le modèle Product contient "Reference" (string) — pas "References" (int)
Reference = int.TryParse(p.Reference, out var refInt) ? refInt : 0,
Reference = p.Reference,
Name = p.Name,
Duration = p.Duration,
Caliber = p.Caliber,

View File

@@ -41,7 +41,7 @@ public class GetProductEndpoint(PyroFetesDbContext db)
Id = product.Id,
// Le modèle Product contient "Reference" (string), pas "References" (int)
Reference = int.TryParse(product.Reference, out var refInt) ? refInt : 0,
Reference = product.Reference,
Name = product.Name,
Duration = product.Duration,

View File

@@ -35,7 +35,7 @@ public class UpdateProductEndpoint(PyroFetesDbContext db)
}
// Mise à jour des propriétés principales du produit
product.Reference = req.References.ToString(); // Converti int → string
product.Reference = req.Reference; // Converti int → string
product.Name = req.Name;
product.Duration = req.Duration;
product.Caliber = req.Caliber;
@@ -77,7 +77,7 @@ public class UpdateProductEndpoint(PyroFetesDbContext db)
var response = new GetProductDto
{
Id = product.Id,
Reference = req.References, // DTO garde int pour cohérence
Reference = req.Reference, // DTO garde int pour cohérence
Name = req.Name,
Duration = req.Duration,
Caliber = req.Caliber,

View File

@@ -24,7 +24,7 @@ public class GetWarehouseEndpoint(PyroFetesDbContext db)
{
// 🔹 Inclut les produits associés à cet entrepôt
var warehouse = await db.Warehouses
.Include(w => w.WarehouseProducts)
.Include(w => w.WarehouseProducts)!
.ThenInclude(wp => wp.Product)
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);

View File

@@ -9,7 +9,7 @@ namespace PyroFetes.Models
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public decimal Duration {get; set;}
[Required] public decimal Caliber { get; set; }
[Required] public int ApprovalNumber { get; set; }
[Required] public string? ApprovalNumber { get; set; }
[Required] public decimal Weight { get; set; }
[Required] public decimal Nec { get; set; }
[Required] public string? Image { get; set; }

View File

@@ -9,7 +9,7 @@ public class Supplier
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(30)] public string? Phone { get; set; }
[Required, MaxLength(100)] public string? Address { get; set; }
[Required] public int ZipCode { get; set; }
[Required] public string? ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
[Required] public int DeliveryDelay { get; set; }

View File

@@ -10,7 +10,7 @@ public class Warehouse
[Required] public int Current {get; set;}
[Required] public int MinWeight {get; set;}
[Required, MaxLength(100)] public string? Address { get; set; }
[Required] public int ZipCode { get; set; }
[Required] public string? ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
public List<WarehouseProduct>? WarehouseProducts { get; set; }