forked from sanchezvem/PyroFetes
correction types warehouses, products et suppliers
This commit is contained in:
@@ -6,7 +6,7 @@ namespace PyroFetes.DTO.Product.Request
|
|||||||
public class CreateProductDto
|
public class CreateProductDto
|
||||||
{
|
{
|
||||||
// Référence interne du produit
|
// Référence interne du produit
|
||||||
public int References { get; set; }
|
public string? Reference { get; set; }
|
||||||
|
|
||||||
// Nom du produit
|
// Nom du produit
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
@@ -18,7 +18,7 @@ namespace PyroFetes.DTO.Product.Request
|
|||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
|
|
||||||
// Numéro d’homologation
|
// Numéro d’homologation
|
||||||
public int ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
|
|
||||||
// Poids du produit
|
// Poids du produit
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace PyroFetes.DTO.Product.Request
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
// Référence interne du produit
|
// Référence interne du produit
|
||||||
public int References { get; set; }
|
public string? Reference { get; set; }
|
||||||
|
|
||||||
// Nom du produit
|
// Nom du produit
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
@@ -21,7 +21,7 @@ namespace PyroFetes.DTO.Product.Request
|
|||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
|
|
||||||
// Numéro d’homologation
|
// Numéro d’homologation
|
||||||
public int ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
|
|
||||||
// Poids du produit
|
// Poids du produit
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace PyroFetes.DTO.Product.Response
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
// Référence interne du produit
|
// Référence interne du produit
|
||||||
public int Reference { get; set; }
|
public string? Reference { get; set; }
|
||||||
|
|
||||||
// Nom du produit
|
// Nom du produit
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
@@ -22,7 +22,7 @@ namespace PyroFetes.DTO.Product.Response
|
|||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
|
|
||||||
// Numéro d’homologation
|
// Numéro d’homologation
|
||||||
public int ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
|
|
||||||
// Poids du produit
|
// Poids du produit
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|||||||
@@ -4,22 +4,22 @@
|
|||||||
public class CreateSupplierDto
|
public class CreateSupplierDto
|
||||||
{
|
{
|
||||||
// Nom du fournisseur
|
// Nom du fournisseur
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
// Email du fournisseur
|
// Email du fournisseur
|
||||||
public string Email { get; set; }
|
public string? Email { get; set; }
|
||||||
|
|
||||||
// Numéro de téléphone du fournisseur
|
// Numéro de téléphone du fournisseur
|
||||||
public string PhoneNumber { get; set; }
|
public string? PhoneNumber { get; set; }
|
||||||
|
|
||||||
// Adresse du fournisseur
|
// Adresse du fournisseur
|
||||||
public string Adress { get; set; }
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
// Code postal de l'adresse
|
// Code postal de l'adresse
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
// Ville de l'adresse
|
// 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
|
// Liste des produits fournis par ce fournisseur dans la classe SupplierProductPriceDto
|
||||||
public List<SupplierProductPriceDto>? Products { get; set; }
|
public List<SupplierProductPriceDto>? Products { get; set; }
|
||||||
|
|||||||
@@ -7,22 +7,22 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
// Nom du fournisseur
|
// Nom du fournisseur
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
// Email du fournisseur
|
// Email du fournisseur
|
||||||
public string Email { get; set; }
|
public string? Email { get; set; }
|
||||||
|
|
||||||
// Numéro de téléphone du fournisseur
|
// Numéro de téléphone du fournisseur
|
||||||
public string PhoneNumber { get; set; }
|
public string? PhoneNumber { get; set; }
|
||||||
|
|
||||||
// Adresse du fournisseur
|
// Adresse du fournisseur
|
||||||
public string Adress { get; set; }
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
// Code postal de l'adresse
|
// Code postal de l'adresse
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
// Ville de l'adresse
|
// 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
|
// Liste des produits fournis par ce fournisseur relié à la classe SupplierProductPriceDto
|
||||||
public List<SupplierProductPriceDto>? Products { get; set; }
|
public List<SupplierProductPriceDto>? Products { get; set; }
|
||||||
|
|||||||
@@ -9,22 +9,22 @@ namespace PyroFetes.DTO.Supplier.Response
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
// Nom du fournisseur
|
// Nom du fournisseur
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
// Email du fournisseur
|
// Email du fournisseur
|
||||||
public string Email { get; set; }
|
public string? Email { get; set; }
|
||||||
|
|
||||||
// Numéro de téléphone
|
// Numéro de téléphone
|
||||||
public string PhoneNumber { get; set; }
|
public string? PhoneNumber { get; set; }
|
||||||
|
|
||||||
// Adresse du fournisseur
|
// Adresse du fournisseur
|
||||||
public string Adress { get; set; }
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
// Code postal
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
// Ville
|
// Ville
|
||||||
public string City { get; set; }
|
public string? City { get; set; }
|
||||||
|
|
||||||
// Liste des produits fournis par la classe SupplierProductPriceDto
|
// Liste des produits fournis par la classe SupplierProductPriceDto
|
||||||
public List<SupplierProductPriceDto> Products { get; set; } = new();
|
public List<SupplierProductPriceDto> Products { get; set; } = new();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
public class CreateWarehouseDto
|
public class CreateWarehouseDto
|
||||||
{
|
{
|
||||||
// Nom de l'entrepôt
|
// Nom de l'entrepôt
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
// Poids maximal que l'entrepôt peut contenir
|
// Poids maximal que l'entrepôt peut contenir
|
||||||
public int MaxWeight { get; set; }
|
public int MaxWeight { get; set; }
|
||||||
@@ -16,13 +16,13 @@
|
|||||||
public int MinWeight { get; set; }
|
public int MinWeight { get; set; }
|
||||||
|
|
||||||
// Adresse de l'entrepôt
|
// Adresse de l'entrepôt
|
||||||
public string Adress { get; set; }
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
// Code postal
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
// Ville
|
// 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
|
// Liste des produits à stocker dans cet entrepôt venant de la classe en dessous
|
||||||
public List<CreateWarehouseProductDto>? Products { get; set; }
|
public List<CreateWarehouseProductDto>? Products { get; set; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
// Nom de l'entrepôt
|
// Nom de l'entrepôt
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
// Poids maximal que l'entrepôt peut contenir
|
// Poids maximal que l'entrepôt peut contenir
|
||||||
public int MaxWeight { get; set; }
|
public int MaxWeight { get; set; }
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
public int MinWeight { get; set; }
|
public int MinWeight { get; set; }
|
||||||
|
|
||||||
// Adresse de l'entrepôt
|
// Adresse de l'entrepôt
|
||||||
public string Adress { get; set; }
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
// Code postal
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
// Ville
|
// Ville
|
||||||
public string City { get; set; }
|
public string? City { get; set; }
|
||||||
|
|
||||||
// Liste des produits à mettre à jour dans cet entrepôt
|
// Liste des produits à mettre à jour dans cet entrepôt
|
||||||
public List<UpdateWarehouseProductDto>? Products { get; set; }
|
public List<UpdateWarehouseProductDto>? Products { get; set; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
// Nom de l'entrepôt
|
// Nom de l'entrepôt
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
// Poids maximal que l'entrepôt peut contenir
|
// Poids maximal que l'entrepôt peut contenir
|
||||||
public int MaxWeight { get; set; }
|
public int MaxWeight { get; set; }
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
public int MinWeight { get; set; }
|
public int MinWeight { get; set; }
|
||||||
|
|
||||||
// Adresse de l'entrepôt
|
// Adresse de l'entrepôt
|
||||||
public string Adress { get; set; }
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
// Code postal
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
// Ville
|
// Ville
|
||||||
public string City { get; set; }
|
public string? City { get; set; }
|
||||||
|
|
||||||
// Liste des produits stockés dans l'entrepôt
|
// Liste des produits stockés dans l'entrepôt
|
||||||
public List<WarehouseProductDto>? Products { get; set; }
|
public List<WarehouseProductDto>? Products { get; set; }
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class CreateProductEndpoint(PyroFetesDbContext db)
|
|||||||
{
|
{
|
||||||
var product = new Models.Product
|
var product = new Models.Product
|
||||||
{
|
{
|
||||||
Reference = req.References.ToString(),
|
Reference = req.Reference,
|
||||||
Name = req.Name!,
|
Name = req.Name!,
|
||||||
Duration = req.Duration,
|
Duration = req.Duration,
|
||||||
Caliber = req.Caliber,
|
Caliber = req.Caliber,
|
||||||
@@ -75,7 +75,7 @@ public class CreateProductEndpoint(PyroFetesDbContext db)
|
|||||||
var response = new GetProductDto
|
var response = new GetProductDto
|
||||||
{
|
{
|
||||||
Id = product.Id,
|
Id = product.Id,
|
||||||
Reference = req.References,
|
Reference = req.Reference,
|
||||||
Name = req.Name,
|
Name = req.Name,
|
||||||
Duration = req.Duration,
|
Duration = req.Duration,
|
||||||
Caliber = req.Caliber,
|
Caliber = req.Caliber,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class GetAllProductsEndpoint(PyroFetesDbContext db)
|
|||||||
// Inclure toutes les relations nécessaires : Prices + WarehouseProducts + Warehouse
|
// Inclure toutes les relations nécessaires : Prices + WarehouseProducts + Warehouse
|
||||||
var products = await db.Products
|
var products = await db.Products
|
||||||
.Include(p => p.Prices)
|
.Include(p => p.Prices)
|
||||||
.Include(p => p.WarehouseProducts)
|
.Include(p => p.WarehouseProducts)!
|
||||||
.ThenInclude(wp => wp.Warehouse)
|
.ThenInclude(wp => wp.Warehouse)
|
||||||
.ToListAsync(ct);
|
.ToListAsync(ct);
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ public class GetAllProductsEndpoint(PyroFetesDbContext db)
|
|||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
// Le modèle Product contient "Reference" (string) — pas "References" (int)
|
// 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,
|
Name = p.Name,
|
||||||
Duration = p.Duration,
|
Duration = p.Duration,
|
||||||
Caliber = p.Caliber,
|
Caliber = p.Caliber,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class GetProductEndpoint(PyroFetesDbContext db)
|
|||||||
Id = product.Id,
|
Id = product.Id,
|
||||||
|
|
||||||
// Le modèle Product contient "Reference" (string), pas "References" (int)
|
// 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,
|
Name = product.Name,
|
||||||
Duration = product.Duration,
|
Duration = product.Duration,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class UpdateProductEndpoint(PyroFetesDbContext db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mise à jour des propriétés principales du produit
|
// 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.Name = req.Name;
|
||||||
product.Duration = req.Duration;
|
product.Duration = req.Duration;
|
||||||
product.Caliber = req.Caliber;
|
product.Caliber = req.Caliber;
|
||||||
@@ -77,7 +77,7 @@ public class UpdateProductEndpoint(PyroFetesDbContext db)
|
|||||||
var response = new GetProductDto
|
var response = new GetProductDto
|
||||||
{
|
{
|
||||||
Id = product.Id,
|
Id = product.Id,
|
||||||
Reference = req.References, // DTO garde int pour cohérence
|
Reference = req.Reference, // DTO garde int pour cohérence
|
||||||
Name = req.Name,
|
Name = req.Name,
|
||||||
Duration = req.Duration,
|
Duration = req.Duration,
|
||||||
Caliber = req.Caliber,
|
Caliber = req.Caliber,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class GetWarehouseEndpoint(PyroFetesDbContext db)
|
|||||||
{
|
{
|
||||||
// 🔹 Inclut les produits associés à cet entrepôt
|
// 🔹 Inclut les produits associés à cet entrepôt
|
||||||
var warehouse = await db.Warehouses
|
var warehouse = await db.Warehouses
|
||||||
.Include(w => w.WarehouseProducts)
|
.Include(w => w.WarehouseProducts)!
|
||||||
.ThenInclude(wp => wp.Product)
|
.ThenInclude(wp => wp.Product)
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace PyroFetes.Models
|
|||||||
[Required, MaxLength(100)] public string? Name { get; set; }
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required] public decimal Duration {get; set;}
|
[Required] public decimal Duration {get; set;}
|
||||||
[Required] public decimal Caliber { 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 Weight { get; set; }
|
||||||
[Required] public decimal Nec { get; set; }
|
[Required] public decimal Nec { get; set; }
|
||||||
[Required] public string? Image { get; set; }
|
[Required] public string? Image { get; set; }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class Supplier
|
|||||||
[Required, MaxLength(100)] public string? Email { get; set; }
|
[Required, MaxLength(100)] public string? Email { get; set; }
|
||||||
[Required, MaxLength(30)] public string? Phone { get; set; }
|
[Required, MaxLength(30)] public string? Phone { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Address { 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, MaxLength(100)] public string? City { get; set; }
|
||||||
[Required] public int DeliveryDelay { get; set; }
|
[Required] public int DeliveryDelay { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class Warehouse
|
|||||||
[Required] public int Current {get; set;}
|
[Required] public int Current {get; set;}
|
||||||
[Required] public int MinWeight {get; set;}
|
[Required] public int MinWeight {get; set;}
|
||||||
[Required, MaxLength(100)] public string? Address { 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, MaxLength(100)] public string? City { get; set; }
|
||||||
|
|
||||||
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user