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,36 +1,26 @@
namespace API.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
public class CreateProductDto
namespace API.DTO.Product.Request
{
public int References { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice { get; set; }
public string? Image { get; set; }
public string? Link { get; set; }
public class CreateProductDto
{
public int References { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
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; }
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 fournisseurs liés au produit
public List<ProductSupplierPriceDto>? Suppliers { get; set; }
// Liste des entrepôts liés au produit (ajoutée ici)
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; }
// Liste des entrepôts liés au produit
public List<CreateProductWarehouseDto>? Warehouses { get; set; }
}
}

View File

@@ -1,32 +1,27 @@
namespace API.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
public class UpdateProductDto
namespace API.DTO.Product.Request
{
public int Id { get; set; }
public int References { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
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; }
public class UpdateProductDto
{
public int Id { get; set; }
public int References { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
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 associés
public List<ProductSupplierPriceDto> Suppliers { get; set; }
// Liste des entrepôts associés (corrigé ici)
public List<UpdateProductWarehouseDto> Warehouses { get; set; }
}
// DTO pour la mise à jour des entrepôts liés
public class UpdateProductWarehouseDto
{
public int WarehouseId { get; set; }
public int Quantity { get; set; }
// Liste des fournisseurs associés
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
// Liste des entrepôts associés
public List<UpdateProductWarehouseDto> Warehouses { get; set; } = new();
}
}

View File

@@ -1,41 +1,29 @@
using API.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
namespace API.DTO.Product.Response;
public class GetProductDto
namespace API.DTO.Product.Response
{
public int Id { get; set; }
public int Reference { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
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; }
public class GetProductDto
{
public int Id { get; set; }
public int Reference { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
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 avec leur prix de vente
public List<ProductSupplierPriceDto> Suppliers { get; set; }
// Fournisseurs liés
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
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; }
// Entrepôts liés
public List<GetProductWarehouseDto> Warehouses { get; set; } = new();
}
}

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;