Maj Warehouse et Supplier

This commit is contained in:
2025-10-09 15:39:10 +02:00
parent d1fa3aca68
commit 08bf910437
11 changed files with 124 additions and 94 deletions

View File

@@ -1,5 +1,7 @@
namespace API.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
namespace API.DTO.Product.Request
{
public class CreateProductDto
{
public int References { get; set; }
@@ -12,25 +14,13 @@ public class CreateProductDto
public decimal SellingPrice { get; set; }
public string? Image { get; set; }
public string? Link { get; set; }
public int ClassificationId { get; set;}
public int ProductCategoryId { get; set; }
// Liste des fournisseurs liés au produit
public List<ProductSupplierPriceDto>? Suppliers { get; set; }
// Liste des entrepôts liés au produit (ajoutée ici)
// Liste des entrepôts liés au produit
public List<CreateProductWarehouseDto>? Warehouses { get; set; }
}
public class ProductSupplierPriceDto
{
public int SupplierId { get; set; }
public decimal SellingPrice { get; set; }
}
public class CreateProductWarehouseDto
{
public int WarehouseId { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,5 +1,7 @@
namespace API.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
namespace API.DTO.Product.Request
{
public class UpdateProductDto
{
public int Id { get; set; }
@@ -17,16 +19,9 @@ public class UpdateProductDto
public int ProductCategoryId { get; set; }
// Liste des fournisseurs associés
public List<ProductSupplierPriceDto> Suppliers { get; set; }
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
// Liste des entrepôts associés (corrigé ici)
public List<UpdateProductWarehouseDto> Warehouses { get; set; }
// Liste des entrepôts associés
public List<UpdateProductWarehouseDto> Warehouses { get; set; } = new();
}
// DTO pour la mise à jour des entrepôts liés
public class UpdateProductWarehouseDto
{
public int WarehouseId { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,7 +1,9 @@
using API.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
namespace API.DTO.Product.Response;
namespace API.DTO.Product.Response
{
public class GetProductDto
{
public int Id { get; set; }
@@ -18,24 +20,10 @@ public class GetProductDto
public int ClassificationId { get; set; }
public int ProductCategoryId { get; set; }
// Liste des fournisseurs liés avec leur prix de vente
public List<ProductSupplierPriceDto> Suppliers { get; set; }
// Fournisseurs liés
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
// Entrepôts liés
public List<GetProductWarehouseDto> Warehouses { get; set; } = new();
}
public class GetProductSupplierDto
{
public int SupplierId { get; set; }
public string SupplierName { get; set; } = string.Empty;
public decimal SellingPrice { get; set; }
}
public class GetProductWarehouseDto
{
public int WarehouseId { get; set; }
public string WarehouseName { get; set; } = string.Empty;
public int Quantity { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace PyroFetes.DTO.Product.Request
{
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Supplier
public class ProductSupplierPriceDto
{
public int ProductId { get; set; } // Id du produit (pour update)
public int SupplierId { get; set; } // Id du fournisseur
public decimal SellingPrice { get; set; } // Prix de vente
}
}

View File

@@ -0,0 +1,11 @@
namespace PyroFetes.DTO.Product.Response
{
// DTO pour la lecture des fournisseurs liés à un produit
public class GetProductSupplierDto
{
public int ProductId { get; set; }
public int SupplierId { get; set; }
public string SupplierName { get; set; } = string.Empty;
public decimal SellingPrice { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
namespace PyroFetes.DTO.Product.Request
{
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Warehouse
public class CreateProductWarehouseDto
{
public int WarehouseId { get; set; }
public int ProductId { get; set; }
public int Quantity { get; set; }
}
public class UpdateProductWarehouseDto
{
public int WarehouseId { get; set; }
public int ProductId { get; set; }
public int Quantity { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace PyroFetes.DTO.Product.Response
{
// DTO pour la lecture des entrepôts liés à un produit
public class GetProductWarehouseDto
{
public int WarehouseId { get; set; }
public int ProductId { get; set; }
public string WarehouseName { get; set; } = string.Empty;
public int Quantity { get; set; }
}
}

View File

@@ -2,6 +2,8 @@
using API.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;

View File

@@ -2,6 +2,8 @@
using API.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;

View File

@@ -2,6 +2,8 @@
using API.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;

View File

@@ -2,6 +2,8 @@
using API.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;