forked from sanchezvem/PyroFetes
Compare commits
27 Commits
7e3eaa3b51
...
master
Author | SHA1 | Date | |
---|---|---|---|
e336a50c4e | |||
e63be6e1f1 | |||
5a36c0ff2f | |||
014646d35c | |||
8371423b16 | |||
f7931fbed6 | |||
feb12b8c3b | |||
5ea5edaea6 | |||
aa65139b69 | |||
9be4fa67e6 | |||
e69ca1898d | |||
15526d1589 | |||
a27cb5cf2a | |||
ddbd662c2a | |||
464869e3ca | |||
25d1407bd2 | |||
a262fb094c | |||
f0ec7cd4d4 | |||
d0f20e08f0 | |||
b1d2d3d1a1 | |||
64fd223a63 | |||
59ddb9f7b2 | |||
2d42fa1017 | |||
b859e53f95 | |||
3cc96c4ebf | |||
6a813fc35a | |||
a93d399942 |
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Brand.Request;
|
|
||||||
|
|
||||||
public class CreateBrandDto
|
|
||||||
{
|
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.Brand.Request;
|
|
||||||
|
|
||||||
public class UpdateBrandDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.Brand.Response;
|
|
||||||
|
|
||||||
public class GetBrandDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Classification.Request;
|
|
||||||
|
|
||||||
public class CreateClassificationDto
|
|
||||||
{
|
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.Classification.Request;
|
|
||||||
|
|
||||||
public class UpdateClassificationDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.Classification.Response;
|
|
||||||
|
|
||||||
public class GetClassificationDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace API.DTO.Color.Request;
|
|
||||||
|
|
||||||
public class CreateColorDto
|
|
||||||
{
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Color.Request;
|
|
||||||
|
|
||||||
public class UpdateColorDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Color.Response;
|
|
||||||
|
|
||||||
public class GetColorDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace API.DTO.Effect.Request;
|
|
||||||
|
|
||||||
public class CreateEffectDto
|
|
||||||
{
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Effect.Request;
|
|
||||||
|
|
||||||
public class UpdateEffectDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Effect.Response;
|
|
||||||
|
|
||||||
public class GetEffectDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.Material.Request;
|
|
||||||
|
|
||||||
public class CreateMaterialDto
|
|
||||||
{
|
|
||||||
public string? Label { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.Material.Request;
|
|
||||||
|
|
||||||
public class UpdateMaterialDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.Material.Response;
|
|
||||||
|
|
||||||
public class GetMaterialDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
namespace API.DTO.Movement.Request;
|
|
||||||
|
|
||||||
public class CreateMovementDto
|
|
||||||
{
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public DateTime Start {get; set;}
|
|
||||||
public DateTime Arrival {get; set;}
|
|
||||||
public int Quantity {get; set;}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
namespace API.DTO.Movement.Request;
|
|
||||||
|
|
||||||
public class UpdateMovementDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public DateTime Start {get; set;}
|
|
||||||
public DateTime Arrival {get; set;}
|
|
||||||
public int Quantity {get; set;}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
namespace API.DTO.Movement.Response;
|
|
||||||
|
|
||||||
public class GetMovementDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public DateTime Start {get; set;}
|
|
||||||
public DateTime Arrival {get; set;}
|
|
||||||
public int Quantity {get; set;}
|
|
||||||
|
|
||||||
}
|
|
27
PyroFetes/DTO/Price/Request/CreatePriceDto.cs
Normal file
27
PyroFetes/DTO/Price/Request/CreatePriceDto.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
namespace PyroFetes.DTO.Price.Request;
|
||||||
|
|
||||||
|
public class CreatePriceDto
|
||||||
|
{
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
|
public int SupplierId { get; set; }
|
||||||
|
public string? SupplierName { get; set; }
|
||||||
|
public string? SupplierEmail { get; set; }
|
||||||
|
public string? SupplierPhone { get; set; }
|
||||||
|
public string? SupplierAddress { get; set; }
|
||||||
|
public int SupplierZipCode { get; set; }
|
||||||
|
public string? SupplierCity { get; set; }
|
||||||
|
public int SupplierDeliveryDelay { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
7
PyroFetes/DTO/Price/Request/PatchPriceSellingPriceDto.cs
Normal file
7
PyroFetes/DTO/Price/Request/PatchPriceSellingPriceDto.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.Price.Request;
|
||||||
|
|
||||||
|
public class PatchPriceSellingPriceDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
}
|
28
PyroFetes/DTO/Price/Request/UpdatePriceDto.cs
Normal file
28
PyroFetes/DTO/Price/Request/UpdatePriceDto.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
namespace PyroFetes.DTO.Price.Request;
|
||||||
|
|
||||||
|
public class UpdatePriceDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
|
public int SupplierId { get; set; }
|
||||||
|
public string? SupplierName { get; set; }
|
||||||
|
public string? SupplierEmail { get; set; }
|
||||||
|
public string? SupplierPhone { get; set; }
|
||||||
|
public string? SupplierAddress { get; set; }
|
||||||
|
public int SupplierZipCode { get; set; }
|
||||||
|
public string? SupplierCity { get; set; }
|
||||||
|
public int SupplierDeliveryDelay { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
28
PyroFetes/DTO/Price/Response/GetPriceDto.cs
Normal file
28
PyroFetes/DTO/Price/Response/GetPriceDto.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
namespace PyroFetes.DTO.Price.Response;
|
||||||
|
|
||||||
|
public class GetPriceDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
|
public int SupplierId { get; set; }
|
||||||
|
public string? SupplierName { get; set; }
|
||||||
|
public string? SupplierEmail { get; set; }
|
||||||
|
public string? SupplierPhone { get; set; }
|
||||||
|
public string? SupplierAddress { get; set; }
|
||||||
|
public int SupplierZipCode { get; set; }
|
||||||
|
public string? SupplierCity { get; set; }
|
||||||
|
public int SupplierDeliveryDelay { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -1,21 +1,15 @@
|
|||||||
using PyroFetes.Models;
|
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Product.Request;
|
namespace PyroFetes.DTO.Product.Request;
|
||||||
|
|
||||||
public class CreateProductDto
|
public class CreateProductDto
|
||||||
{
|
{
|
||||||
public int References { get; set; }
|
public int References { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public decimal Duration { get; set; }
|
public decimal Duration {get; set;}
|
||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
public int ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
public decimal SellingPrice {get; set;}
|
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
public string? Link { get; set; }
|
public string? Link { get; set; }
|
||||||
|
public int MinimalQuantity { get; set; }
|
||||||
public int ClassificationId { get; set;}
|
|
||||||
public int ProductCategoryId { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.Product.Request;
|
||||||
|
|
||||||
|
public class PatchProductMinimalStockDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int MinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -1,20 +1,16 @@
|
|||||||
using PyroFetes.Models;
|
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Product.Request;
|
namespace PyroFetes.DTO.Product.Request;
|
||||||
|
|
||||||
public class UpdateProductDto
|
public class UpdateProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Reference { get; set; }
|
public int References { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public decimal Duration { get; set; }
|
public decimal Duration {get; set;}
|
||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
public int ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
public decimal SellingPrice {get; set;}
|
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
public string? Link { get; set; }
|
public string? Link { get; set; }
|
||||||
public int ClassificationId { get; set;}
|
public int MinimalQuantity { get; set; }
|
||||||
public int ProductCategoryId { get; set; }
|
|
||||||
}
|
}
|
@@ -1,23 +1,16 @@
|
|||||||
using PyroFetes.Models;
|
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Product.Response;
|
namespace PyroFetes.DTO.Product.Response;
|
||||||
|
|
||||||
public class GetProductDto
|
public class GetProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Reference { get; set; }
|
public int References { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public decimal Duration { get; set; }
|
public decimal Duration {get; set;}
|
||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
public int ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
public decimal SellingPrice {get; set;}
|
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
public string? Link { get; set; }
|
public string? Link { get; set; }
|
||||||
public int ClassificationId { get; set;}
|
public int MinimalQuantity { get; set; }
|
||||||
public string? ClassificationLabel { get; set; }
|
|
||||||
public int ProductCategoryId { get; set; }
|
|
||||||
public string? ProductCategoryLabel { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
@@ -1,6 +0,0 @@
|
|||||||
namespace API.DTO.ProductCategory.Request;
|
|
||||||
|
|
||||||
public class CreateProductCategoryDto
|
|
||||||
{
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace API.DTO.ProductCategory.Request;
|
|
||||||
|
|
||||||
public class UpdateProductCategoryDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace API.DTO.ProductCategory.Response;
|
|
||||||
|
|
||||||
public class GetProductCategoryDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
}
|
|
@@ -0,0 +1,22 @@
|
|||||||
|
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
|
||||||
|
public class CreatePurchaseProductDto
|
||||||
|
{
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public int PurchaseOrderId { get; set; }
|
||||||
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
|
||||||
|
public class PatchPurchaseProductQuantityDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
|
||||||
|
public class UpdatePurchaseProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public int PurchaseOrderId { get; set; }
|
||||||
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,24 @@
|
|||||||
|
namespace PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
|
||||||
|
public class GetPurchaseProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public decimal ProductSellingPrice { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public int PurchaseOrderId { get; set; }
|
||||||
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
namespace PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
|
||||||
|
public class CreateQuotationProductDto
|
||||||
|
{
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int QuotationId { get; set; }
|
||||||
|
public string? QuotationMessage { get; set; }
|
||||||
|
public string? QuotationConditionsSale { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
|
||||||
|
public class PatchQuotationProductQuantityDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
namespace PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
|
||||||
|
public class UpdateQuotationProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int QuotationId { get; set; }
|
||||||
|
public string? QuotationMessage { get; set; }
|
||||||
|
public string? QuotationConditionsSale { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
namespace PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
|
||||||
|
public class GetQuotationProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int QuotationId { get; set; }
|
||||||
|
public string? QuotationMessage { get; set; }
|
||||||
|
public string? QuotationConditionsSale { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
7
PyroFetes/DTO/SettingDTO/Request/CreateSettingDto.cs
Normal file
7
PyroFetes/DTO/SettingDTO/Request/CreateSettingDto.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
|
||||||
|
public class CreateSettingDto
|
||||||
|
{
|
||||||
|
public string? ElectronicSignature { get; set; }
|
||||||
|
public string? Logo { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
|
||||||
|
public class PatchSettingElectronicSignatureDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? ElectronicSignature { get; set; }
|
||||||
|
}
|
7
PyroFetes/DTO/SettingDTO/Request/PatchSettingLogoDto.cs
Normal file
7
PyroFetes/DTO/SettingDTO/Request/PatchSettingLogoDto.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
|
||||||
|
public class PatchSettingLogoDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? Logo { get; set; }
|
||||||
|
}
|
8
PyroFetes/DTO/SettingDTO/Response/GetSettingDto.cs
Normal file
8
PyroFetes/DTO/SettingDTO/Response/GetSettingDto.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
|
||||||
|
public class GetSettingDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? ElectronicSignature { get; set; }
|
||||||
|
public string? Logo { get; set; }
|
||||||
|
}
|
@@ -1,11 +1,12 @@
|
|||||||
namespace API.DTO.Supplier.Request;
|
namespace PyroFetes.DTO.Supplier.Request;
|
||||||
|
|
||||||
public class CreateSupplierDto
|
public class CreateSupplierDto
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public string Email { get; set; }
|
public string? Email { get; set; }
|
||||||
public string PhoneNumber { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string Adress { get; set; }
|
public string? Address { get; set; }
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
public string City { get; set; }
|
public string? City { get; set; }
|
||||||
|
public int DeliveryDelay { get; set; }
|
||||||
}
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.Supplier.Request;
|
||||||
|
|
||||||
|
public class PatchSupplierDeliveryDelayDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int DeliveryDelay { get; set; }
|
||||||
|
}
|
@@ -1,12 +1,13 @@
|
|||||||
namespace API.DTO.Supplier.Request;
|
namespace PyroFetes.DTO.Supplier.Request;
|
||||||
|
|
||||||
public class UpdateSupplierDto
|
public class UpdateSupplierDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public string Email { get; set; }
|
public string? Email { get; set; }
|
||||||
public string PhoneNumber { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string Adress { get; set; }
|
public string? Address { get; set; }
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
public string City { get; set; }
|
public string? City { get; set; }
|
||||||
|
public int DeliveryDelay { get; set; }
|
||||||
}
|
}
|
@@ -1,12 +1,13 @@
|
|||||||
namespace API.DTO.Supplier.Response;
|
namespace PyroFetes.DTO.Supplier.Response;
|
||||||
|
|
||||||
public class GetSupplierDto
|
public class GetSupplierDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public string Email { get; set; }
|
public string? Email { get; set; }
|
||||||
public string PhoneNumber { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string Adress { get; set; }
|
public string? Address { get; set; }
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
public string City { get; set; }
|
public string? City { get; set; }
|
||||||
|
public int DeliveryDelay { get; set; }
|
||||||
}
|
}
|
10
PyroFetes/DTO/User/Request/CreateUserDto.cs
Normal file
10
PyroFetes/DTO/User/Request/CreateUserDto.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PyroFetes.DTO.User.Request;
|
||||||
|
|
||||||
|
public class CreateUserDto
|
||||||
|
{
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
public string? Salt { get; set; }
|
||||||
|
public string? Fonction { get; set; }
|
||||||
|
public string? Email { get; set; }
|
||||||
|
}
|
10
PyroFetes/DTO/User/Request/UpdateUserDto.cs
Normal file
10
PyroFetes/DTO/User/Request/UpdateUserDto.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PyroFetes.DTO.User.Request;
|
||||||
|
|
||||||
|
public class UpdateUserDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
public string? Fonction { get; set; }
|
||||||
|
public string? Email { get; set; }
|
||||||
|
}
|
11
PyroFetes/DTO/User/Response/GetUserDto.cs
Normal file
11
PyroFetes/DTO/User/Response/GetUserDto.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PyroFetes.DTO.User.Response;
|
||||||
|
|
||||||
|
public class GetUserDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
public string? Salt { get; set; }
|
||||||
|
public string? Fonction { get; set; }
|
||||||
|
public string? Email { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
namespace PyroFetes.DTO.WareHouseProduct.Request;
|
||||||
|
|
||||||
|
public class CreateWareHouseProductDto
|
||||||
|
{
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int WareHouseId { get; set; }
|
||||||
|
public string? WareHouseName {get; set;}
|
||||||
|
public int WareHouseMaxWeight {get; set;}
|
||||||
|
public int WareHouseCurrent {get; set;}
|
||||||
|
public int WareHouseMinWeight {get; set;}
|
||||||
|
public string? WareHouseAddress { get; set; }
|
||||||
|
public int WareHouseZipCode { get; set; }
|
||||||
|
public string? WareHouseCity { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.WareHouseProduct.Request;
|
||||||
|
|
||||||
|
public class PatchWareHouseProductQuantityDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
namespace PyroFetes.DTO.WareHouseProduct.Request;
|
||||||
|
|
||||||
|
public class UpdateWareHouseProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int WareHouseId { get; set; }
|
||||||
|
public string? WareHouseName {get; set;}
|
||||||
|
public int WareHouseMaxWeight {get; set;}
|
||||||
|
public int WareHouseCurrent {get; set;}
|
||||||
|
public int WareHouseMinWeight {get; set;}
|
||||||
|
public string? WareHouseAddress { get; set; }
|
||||||
|
public int WareHouseZipCode { get; set; }
|
||||||
|
public string? WareHouseCity { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
namespace PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
|
|
||||||
|
public class GetWareHouseProductDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public int WareHouseId { get; set; }
|
||||||
|
public string? WareHouseName {get; set;}
|
||||||
|
public int WareHouseMaxWeight {get; set;}
|
||||||
|
public int WareHouseCurrent {get; set;}
|
||||||
|
public int WareHouseMinWeight {get; set;}
|
||||||
|
public string? WareHouseAddress { get; set; }
|
||||||
|
public int WareHouseZipCode { get; set; }
|
||||||
|
public string? WareHouseCity { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int ProductReferences { get; set; }
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
public decimal ProductDuration {get; set;}
|
||||||
|
public decimal ProductCaliber { get; set; }
|
||||||
|
public int ProductApprovalNumber { get; set; }
|
||||||
|
public decimal ProductWeight { get; set; }
|
||||||
|
public decimal ProductNec { get; set; }
|
||||||
|
public string? ProductImage { get; set; }
|
||||||
|
public string? ProductLink { get; set; }
|
||||||
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
}
|
@@ -1,12 +0,0 @@
|
|||||||
namespace API.DTO.Warehouse.Request;
|
|
||||||
|
|
||||||
public class CreateWarehouseDto
|
|
||||||
{
|
|
||||||
public string Name {get; set;}
|
|
||||||
public int MaxWeight {get; set;}
|
|
||||||
public int Current {get; set;}
|
|
||||||
public int MinWeight {get; set;}
|
|
||||||
public string Adress { get; set; }
|
|
||||||
public int ZipCode { get; set; }
|
|
||||||
public string City { get; set; }
|
|
||||||
}
|
|
@@ -1,13 +0,0 @@
|
|||||||
namespace API.DTO.Warehouse.Request;
|
|
||||||
|
|
||||||
public class UpdateWarehouseDto
|
|
||||||
{
|
|
||||||
public int Id {get; set;}
|
|
||||||
public string Name {get; set;}
|
|
||||||
public int MaxWeight {get; set;}
|
|
||||||
public int Current {get; set;}
|
|
||||||
public int MinWeight {get; set;}
|
|
||||||
public string Adress { get; set; }
|
|
||||||
public int ZipCode { get; set; }
|
|
||||||
public string City { get; set; }
|
|
||||||
}
|
|
@@ -1,13 +0,0 @@
|
|||||||
namespace API.DTO.Warehouse.Response;
|
|
||||||
|
|
||||||
public class GetWarehouseDto
|
|
||||||
{
|
|
||||||
public int Id {get; set;}
|
|
||||||
public string Name {get; set;}
|
|
||||||
public int MaxWeight {get; set;}
|
|
||||||
public int Current {get; set;}
|
|
||||||
public int MinWeight {get; set;}
|
|
||||||
public string Adress { get; set; }
|
|
||||||
public int ZipCode { get; set; }
|
|
||||||
public string City { get; set; }
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
using API.DTO.Brand.Request;
|
|
||||||
using API.DTO.Brand.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
|
||||||
|
|
||||||
public class CreateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateBrandDto, GetBrandDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/brands");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateBrandDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Brand brand = new ()
|
|
||||||
{
|
|
||||||
Name = req.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Brands.Add(brand);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Marque créé avec succès !");
|
|
||||||
|
|
||||||
GetBrandDto responseDto = new ()
|
|
||||||
{
|
|
||||||
Name = req.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
|
||||||
|
|
||||||
public class DeleteBrandRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteBrandRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/brands/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteBrandRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Brand? brandToDelete = await pyrofetesdbcontext
|
|
||||||
.Brands
|
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (brandToDelete == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucune marque avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Brands.Remove(brandToDelete);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
using API.DTO.Brand.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
|
||||||
|
|
||||||
public class GetAllBrandsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetBrandDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/brands");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
List<GetBrandDto> responseDto = await pyrofetesdbcontext.Brands
|
|
||||||
.Select(a => new GetBrandDto
|
|
||||||
{
|
|
||||||
Id = a.Id,
|
|
||||||
Name = a.Name,
|
|
||||||
}
|
|
||||||
).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,42 +0,0 @@
|
|||||||
using API.DTO.Brand.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
|
||||||
|
|
||||||
public class GetBrandRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GetBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetBrandRequest, GetBrandDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/brands/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetBrandRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Brand? brand = await pyrofetesdbcontext
|
|
||||||
.Brands
|
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (brand == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucune marque avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetBrandDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Name = brand.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
using API.DTO.Brand.Request;
|
|
||||||
using API.DTO.Brand.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
|
||||||
|
|
||||||
public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateBrandDto, GetBrandDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/brands");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateBrandDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Brand brand = new()
|
|
||||||
{
|
|
||||||
Name = req.Name
|
|
||||||
};
|
|
||||||
pyrofetesdbcontext.Add(brand);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetBrandDto response = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Name = req.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(response, ct);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
using API.DTO.Classification.Request;
|
|
||||||
using API.DTO.Classification.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
|
||||||
|
|
||||||
public class CreateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateClassificationDto, GetClassificationDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/classifications");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateClassificationDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Classification classification = new ()
|
|
||||||
{
|
|
||||||
Label = req.Label
|
|
||||||
};
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Classifications.Add(classification);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Classification créée avec succès !");
|
|
||||||
|
|
||||||
GetClassificationDto responseDto = new ()
|
|
||||||
{
|
|
||||||
Label = req.Label
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
|
||||||
|
|
||||||
public class DeleteClassificationRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteClassificationEndpoint(PyroFetesDbContext libraryDbContext) : Endpoint<DeleteClassificationRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/classifications/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteClassificationRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Classification? classificationToDelete = await libraryDbContext
|
|
||||||
.Classifications
|
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (classificationToDelete == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucune classification avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
libraryDbContext.Classifications.Remove(classificationToDelete);
|
|
||||||
await libraryDbContext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
using API.DTO.Classification.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
|
||||||
|
|
||||||
public class GetAllClassificationsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetClassificationDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/classifications");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications
|
|
||||||
.Select(a => new GetClassificationDto
|
|
||||||
{
|
|
||||||
Id = a.Id,
|
|
||||||
Label = a.Label,
|
|
||||||
}
|
|
||||||
).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,42 +0,0 @@
|
|||||||
using API.DTO.Classification.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
|
||||||
|
|
||||||
public class GetClassificationRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GetClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetClassificationRequest, GetClassificationDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/classifications/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetClassificationRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Classification? classification = await pyrofetesdbcontext
|
|
||||||
.Classifications
|
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (classification == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucune classification avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetClassificationDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Label = classification.Label
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
using API.DTO.Classification.Request;
|
|
||||||
using API.DTO.Classification.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
|
||||||
|
|
||||||
public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateClassificationDto, GetClassificationDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/classifications");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateClassificationDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Classification classification = new()
|
|
||||||
{
|
|
||||||
Label = req.Label
|
|
||||||
};
|
|
||||||
pyrofetesdbcontext.Add(classification);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetClassificationDto response = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Label = req.Label
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(response, ct);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
using API.DTO.Color.Request;
|
|
||||||
using API.DTO.Color.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace API.Endpoints.Color;
|
|
||||||
|
|
||||||
public class CreateColorEndpoint(AppDbContext appDbContext) : Endpoint<CreateColorDto, GetColorDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/color/create");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateColorDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Color color = new()
|
|
||||||
{
|
|
||||||
Label = req.Label,
|
|
||||||
};
|
|
||||||
|
|
||||||
appDbContext.Colors.Add(color);
|
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
|
||||||
Console.WriteLine("Added Color");
|
|
||||||
|
|
||||||
GetColorDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = color.Id,
|
|
||||||
Label = req.Label,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,41 +0,0 @@
|
|||||||
using API.DTO.Movement.Request;
|
|
||||||
using API.DTO.Movement.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Movement;
|
|
||||||
|
|
||||||
public class CreateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateMovementDto, GetMovementDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/movements");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateMovementDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Movement movement = new ()
|
|
||||||
{
|
|
||||||
Date = req.Date,
|
|
||||||
Start = req.Start,
|
|
||||||
Arrival = req.Arrival,
|
|
||||||
Quantity = req.Quantity
|
|
||||||
};
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Movements.Add(movement);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Movement créée avec succès !");
|
|
||||||
|
|
||||||
GetMovementDto responseDto = new ()
|
|
||||||
{
|
|
||||||
Date = req.Date,
|
|
||||||
Start = req.Start,
|
|
||||||
Arrival = req.Arrival,
|
|
||||||
Quantity = req.Quantity
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Movement;
|
|
||||||
|
|
||||||
public class DeleteMovementRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteMovementRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/Movements/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteMovementRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Movement? movementToDelete = await pyrofetesdbcontext
|
|
||||||
.Movements
|
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (movementToDelete == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucune mouvement avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Movements.Remove(movementToDelete);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,31 +0,0 @@
|
|||||||
using API.DTO.Movement.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Movement;
|
|
||||||
|
|
||||||
public class GetAllMovementsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetMovementDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/movements");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
List<GetMovementDto> responseDto = await pyrofetesdbcontext.Movements
|
|
||||||
.Select(a => new GetMovementDto
|
|
||||||
{
|
|
||||||
Id = a.Id,
|
|
||||||
Date = a.Date,
|
|
||||||
Start = a.Start,
|
|
||||||
Arrival = a.Arrival,
|
|
||||||
Quantity = a.Quantity
|
|
||||||
}
|
|
||||||
).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
using API.DTO.Movement.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Movement;
|
|
||||||
|
|
||||||
public class GetMovementRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GetMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetMovementRequest, GetMovementDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/movements/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetMovementRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Movement? movement = await pyrofetesdbcontext
|
|
||||||
.Movements
|
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (movement == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun mouvement avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetMovementDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Date = movement.Date,
|
|
||||||
Start = movement.Start,
|
|
||||||
Arrival = movement.Arrival,
|
|
||||||
Quantity = movement.Quantity
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
using API.DTO.Movement.Request;
|
|
||||||
using API.DTO.Movement.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Movement;
|
|
||||||
|
|
||||||
public class UpdateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateMovementDto, GetMovementDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/movements");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateMovementDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
|
|
||||||
Models.Movement movement = new()
|
|
||||||
{
|
|
||||||
Date = req.Date,
|
|
||||||
Start = req.Start,
|
|
||||||
Arrival = req.Arrival,
|
|
||||||
Quantity = req.Quantity
|
|
||||||
};
|
|
||||||
pyrofetesdbcontext.Add(movement);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetMovementDto response = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Date = req.Date,
|
|
||||||
Start = req.Start,
|
|
||||||
Arrival = req.Arrival,
|
|
||||||
Quantity = req.Quantity
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(response, ct);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,57 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.Product.Request;
|
|
||||||
using PyroFetes.DTO.Product.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
|
||||||
|
|
||||||
public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateProductDto, GetProductDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/products");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateProductDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Product product = new ()
|
|
||||||
{
|
|
||||||
References = req.References,
|
|
||||||
Name = req.Name!,
|
|
||||||
Duration = req.Duration,
|
|
||||||
Caliber = req.Caliber,
|
|
||||||
ApprovalNumber = req.ApprovalNumber,
|
|
||||||
Weight = req.Weight,
|
|
||||||
Nec = req.Nec,
|
|
||||||
SellingPrice = req.SellingPrice,
|
|
||||||
Image = req.Image!,
|
|
||||||
Link = req.Link!,
|
|
||||||
ProductCategoryId = req.ProductCategoryId,
|
|
||||||
ClassificationId = req.ClassificationId
|
|
||||||
};
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Products.Add(product);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Product créé avec succès !");
|
|
||||||
|
|
||||||
GetProductDto responseDto = new ()
|
|
||||||
{
|
|
||||||
Id = product.Id,
|
|
||||||
Reference = req.References,
|
|
||||||
Name = req.Name,
|
|
||||||
Duration = req.Duration,
|
|
||||||
Caliber = req.Caliber,
|
|
||||||
ApprovalNumber = req.ApprovalNumber,
|
|
||||||
Weight = req.Weight,
|
|
||||||
Nec = req.Nec,
|
|
||||||
SellingPrice = req.SellingPrice,
|
|
||||||
Image = req.Image,
|
|
||||||
Link = req.Link,
|
|
||||||
ProductCategoryId = req.ProductCategoryId,
|
|
||||||
ClassificationId = req.ClassificationId
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
|
||||||
|
|
||||||
public class DeleteProductRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteProductRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/products/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteProductRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Product? productToDelete = await pyrofetesdbcontext
|
|
||||||
.Products
|
|
||||||
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (productToDelete == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Products.Remove(productToDelete);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Product.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
|
||||||
|
|
||||||
public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetProductDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/products");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetProductDto> responseDto = await pyrofetesdbcontext.Products
|
|
||||||
.Select(p => new GetProductDto()
|
|
||||||
{
|
|
||||||
Id = p.Id,
|
|
||||||
Reference = p.References,
|
|
||||||
Name = p.Name,
|
|
||||||
Duration = p.Duration,
|
|
||||||
Caliber = p.Caliber,
|
|
||||||
ApprovalNumber = p.ApprovalNumber,
|
|
||||||
Weight = p.Weight,
|
|
||||||
Nec = p.Nec,
|
|
||||||
SellingPrice = p.SellingPrice,
|
|
||||||
Image = p.Image,
|
|
||||||
Link = p.Link,
|
|
||||||
ClassificationId = p.ClassificationId,
|
|
||||||
ClassificationLabel = p.Classification!.Label,
|
|
||||||
ProductCategoryId = p.ProductCategoryId,
|
|
||||||
ProductCategoryLabel = p.ProductCategory!.Label,
|
|
||||||
}
|
|
||||||
).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Product.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
|
||||||
|
|
||||||
public class GetProductRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetProductRequest, GetProductDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/product/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Product? product = await pyrofetesdbcontext
|
|
||||||
.Products.Include(product => product.Classification).Include(product => product.ProductCategory)
|
|
||||||
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (product == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetProductDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = product.Id,
|
|
||||||
Reference = product.References,
|
|
||||||
Name = product.Name,
|
|
||||||
Duration = product.Duration,
|
|
||||||
Caliber = product.Caliber,
|
|
||||||
ApprovalNumber = product.ApprovalNumber,
|
|
||||||
Weight = product.Weight,
|
|
||||||
Nec = product.Nec,
|
|
||||||
SellingPrice = product.SellingPrice,
|
|
||||||
Image = product.Image,
|
|
||||||
Link = product.Link,
|
|
||||||
ClassificationId = product.ClassificationId,
|
|
||||||
ClassificationLabel = product.Classification!.Label,
|
|
||||||
ProductCategoryId = product.ProductCategoryId,
|
|
||||||
ProductCategoryLabel = product.ProductCategory!.Label,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Product.Request;
|
|
||||||
using PyroFetes.DTO.Product.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
|
||||||
|
|
||||||
public class UpdateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<UpdateProductDto, GetProductDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Put("/api/products/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Product? productToEdit = await pyrofetesdbcontext
|
|
||||||
.Products
|
|
||||||
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (productToEdit == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
productToEdit.References = req.Reference;
|
|
||||||
productToEdit.Name = req.Name;
|
|
||||||
productToEdit.Duration = req.Duration;
|
|
||||||
productToEdit.Caliber = req.Caliber;
|
|
||||||
productToEdit.ApprovalNumber = req.ApprovalNumber;
|
|
||||||
productToEdit.Weight = req.Weight;
|
|
||||||
productToEdit.Nec = req.Nec;
|
|
||||||
productToEdit.SellingPrice = req.SellingPrice;
|
|
||||||
productToEdit.Image = req.Image;
|
|
||||||
productToEdit.Link = req.Link;
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetProductDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Reference = req.Reference,
|
|
||||||
Name = req.Name,
|
|
||||||
Duration = req.Duration,
|
|
||||||
Caliber = req.Caliber,
|
|
||||||
ApprovalNumber = req.ApprovalNumber,
|
|
||||||
Weight = req.Weight,
|
|
||||||
Nec = req.Nec,
|
|
||||||
SellingPrice = req.SellingPrice,
|
|
||||||
Image = req.Image,
|
|
||||||
Link = req.Link
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
using API.DTO.ProductCategory.Request;
|
|
||||||
using API.DTO.ProductCategory.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ProductCategory;
|
|
||||||
|
|
||||||
public class CreateProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateProductCategoryDto, GetProductCategoryDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/productcategories");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateProductCategoryDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.ProductCategory productCategory = new ()
|
|
||||||
{
|
|
||||||
Label = req.Label,
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
pyrofetesdbcontext.ProductCategories.Add(productCategory);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Category créé avec succès !");
|
|
||||||
|
|
||||||
GetProductCategoryDto responseDto = new ()
|
|
||||||
{
|
|
||||||
Id = productCategory.Id,
|
|
||||||
Label = productCategory.Label
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ProductCategory;
|
|
||||||
|
|
||||||
public class DeleteProductCategoryRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteProductCategoryRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/productcategories/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteProductCategoryRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.ProductCategory? productCategoryToDelete = await pyrofetesdbcontext
|
|
||||||
.ProductCategories
|
|
||||||
.SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (productCategoryToDelete == null)
|
|
||||||
{
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pyrofetesdbcontext.ProductCategories.Remove(productCategoryToDelete);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
using API.DTO.ProductCategory.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ProductCategory;
|
|
||||||
|
|
||||||
public class GetAllProductCategoriesEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetProductCategoryDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/productcategories");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetProductCategoryDto> responseDto = await pyrofetesdbcontext.ProductCategories
|
|
||||||
.Select(pc => new GetProductCategoryDto()
|
|
||||||
{
|
|
||||||
Id = pc.Id,
|
|
||||||
Label = pc.Label
|
|
||||||
}
|
|
||||||
).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,42 +0,0 @@
|
|||||||
using API.DTO.ProductCategory.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ProductCategory;
|
|
||||||
|
|
||||||
public class GetProductCategoryRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class GetProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetProductCategoryRequest, GetProductCategoryDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/productcategory/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetProductCategoryRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.ProductCategory? productCategory = await pyrofetesdbcontext
|
|
||||||
.ProductCategories
|
|
||||||
.SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (productCategory == null)
|
|
||||||
{
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetProductCategoryDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = productCategory.Id,
|
|
||||||
Label = productCategory.Label
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
using API.DTO.ProductCategory.Request;
|
|
||||||
using API.DTO.ProductCategory.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ProductCategory;
|
|
||||||
|
|
||||||
public class UpdateProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<UpdateProductCategoryDto, GetProductCategoryDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Put("/api/productcategory/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateProductCategoryDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.ProductCategory? productCategoryToEdit = await pyrofetesdbcontext
|
|
||||||
.ProductCategories
|
|
||||||
.SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (productCategoryToEdit == null)
|
|
||||||
{
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
productCategoryToEdit.Label = req.Label;
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetProductCategoryDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = req.Id,
|
|
||||||
Label = req.Label,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,48 +0,0 @@
|
|||||||
using API.DTO.Supplier.Request;
|
|
||||||
using API.DTO.Supplier.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
|
||||||
|
|
||||||
public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateSupplierDto, GetSupplierDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/suppliers");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
// Création d'un nouvel objet Supplier
|
|
||||||
Models.Supplier supplier = new()
|
|
||||||
{
|
|
||||||
Name = req.Name,
|
|
||||||
Email = req.Email,
|
|
||||||
Phone = req.PhoneNumber,
|
|
||||||
Address = req.Adress,
|
|
||||||
ZipCode = req.ZipCode,
|
|
||||||
City = req.City
|
|
||||||
};
|
|
||||||
|
|
||||||
// Ajout à la base et sauvegarde
|
|
||||||
pyrofetesdbcontext.Suppliers.Add(supplier);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Fournisseur créé avec succès !");
|
|
||||||
|
|
||||||
// Préparation de la réponse
|
|
||||||
GetSupplierDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = supplier.Id,
|
|
||||||
Name = supplier.Name,
|
|
||||||
Email = supplier.Email,
|
|
||||||
PhoneNumber = supplier.Phone,
|
|
||||||
Adress = supplier.Address,
|
|
||||||
ZipCode = supplier.ZipCode,
|
|
||||||
City = supplier.City
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
|
||||||
|
|
||||||
public class DeleteSupplierRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteSupplierRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/suppliers/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Supplier? supplierToDelete = await pyrofetesdbcontext
|
|
||||||
.Suppliers
|
|
||||||
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (supplierToDelete == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Suppliers.Remove(supplierToDelete);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,32 +0,0 @@
|
|||||||
using API.DTO.Supplier.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
|
||||||
|
|
||||||
public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetSupplierDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/suppliers");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetSupplierDto> responseDto = await pyrofetesdbcontext.Suppliers
|
|
||||||
.Select(s => new GetSupplierDto
|
|
||||||
{
|
|
||||||
Id = s.Id,
|
|
||||||
Name = s.Name!,
|
|
||||||
Email = s.Email!,
|
|
||||||
PhoneNumber = s.Phone!,
|
|
||||||
Adress = s.Address!,
|
|
||||||
ZipCode = s.ZipCode,
|
|
||||||
City = s.City!
|
|
||||||
})
|
|
||||||
.ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,46 +0,0 @@
|
|||||||
using API.DTO.Supplier.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
|
||||||
|
|
||||||
public class GetSupplierRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetSupplierRequest, GetSupplierDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/suppliers/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Supplier? supplier = await pyrofetesdbcontext
|
|
||||||
.Suppliers
|
|
||||||
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (supplier == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetSupplierDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = supplier.Id,
|
|
||||||
Name = supplier.Name!,
|
|
||||||
Email = supplier.Email!,
|
|
||||||
PhoneNumber = supplier.Phone!,
|
|
||||||
Adress = supplier.Address!,
|
|
||||||
ZipCode = supplier.ZipCode,
|
|
||||||
City = supplier.City!
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,52 +0,0 @@
|
|||||||
using API.DTO.Supplier.Request;
|
|
||||||
using API.DTO.Supplier.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
|
||||||
|
|
||||||
public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateSupplierDto, GetSupplierDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Put("/api/suppliers/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Supplier? supplierToEdit = await pyrofetesdbcontext
|
|
||||||
.Suppliers
|
|
||||||
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (supplierToEdit == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mise à jour des propriétés
|
|
||||||
supplierToEdit.Name = req.Name;
|
|
||||||
supplierToEdit.Email = req.Email;
|
|
||||||
supplierToEdit.Phone = req.PhoneNumber;
|
|
||||||
supplierToEdit.Address = req.Adress;
|
|
||||||
supplierToEdit.ZipCode = req.ZipCode;
|
|
||||||
supplierToEdit.City = req.City;
|
|
||||||
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetSupplierDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = supplierToEdit.Id,
|
|
||||||
Name = supplierToEdit.Name,
|
|
||||||
Email = supplierToEdit.Email,
|
|
||||||
PhoneNumber = supplierToEdit.Phone,
|
|
||||||
Adress = supplierToEdit.Address,
|
|
||||||
ZipCode = supplierToEdit.ZipCode,
|
|
||||||
City = supplierToEdit.City
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,47 +0,0 @@
|
|||||||
using API.DTO.Warehouse.Request;
|
|
||||||
using API.DTO.Warehouse.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
|
||||||
|
|
||||||
public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateWarehouseDto, GetWarehouseDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/warehouse");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateWarehouseDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Warehouse warehouse = new()
|
|
||||||
{
|
|
||||||
Name = req.Name,
|
|
||||||
MaxWeight = req.MaxWeight,
|
|
||||||
Current = req.Current,
|
|
||||||
MinWeight = req.MinWeight,
|
|
||||||
Address = req.Adress,
|
|
||||||
ZipCode = req.ZipCode,
|
|
||||||
City = req.City
|
|
||||||
};
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Warehouses.Add(warehouse);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
Console.WriteLine("Entrepôt créé avec succès !");
|
|
||||||
|
|
||||||
GetWarehouseDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = warehouse.Id,
|
|
||||||
Name = warehouse.Name,
|
|
||||||
MaxWeight = warehouse.MaxWeight,
|
|
||||||
Current = warehouse.Current,
|
|
||||||
MinWeight = warehouse.MinWeight,
|
|
||||||
Adress = warehouse.Address,
|
|
||||||
ZipCode = warehouse.ZipCode,
|
|
||||||
City = warehouse.City
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
|
||||||
|
|
||||||
public class DeleteWarehouseRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteWarehouseRequest>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete("/api/warehouse/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteWarehouseRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Warehouse? warehouseToDelete = await pyrofetesdbcontext
|
|
||||||
.Warehouses
|
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (warehouseToDelete == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pyrofetesdbcontext.Warehouses.Remove(warehouseToDelete);
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
using API.DTO.Warehouse.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
|
||||||
|
|
||||||
public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetWarehouseDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/warehouses");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetWarehouseDto> responseDto = await pyrofetesdbcontext.Warehouses
|
|
||||||
.Select(w => new GetWarehouseDto
|
|
||||||
{
|
|
||||||
Id = w.Id,
|
|
||||||
Name = w.Name,
|
|
||||||
MaxWeight = w.MaxWeight,
|
|
||||||
Current = w.Current,
|
|
||||||
MinWeight = w.MinWeight,
|
|
||||||
Adress = w.Address,
|
|
||||||
ZipCode = w.ZipCode,
|
|
||||||
City = w.City
|
|
||||||
})
|
|
||||||
.ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,47 +0,0 @@
|
|||||||
using API.DTO.Warehouse.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
|
||||||
|
|
||||||
public class GetWarehouseRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetWarehouseRequest, GetWarehouseDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get("/api/warehouses/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetWarehouseRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Warehouse? warehouse = await pyrofetesdbcontext
|
|
||||||
.Warehouses
|
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (warehouse == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetWarehouseDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = warehouse.Id,
|
|
||||||
Name = warehouse.Name!,
|
|
||||||
MaxWeight = warehouse.MaxWeight,
|
|
||||||
Current = warehouse.Current,
|
|
||||||
MinWeight = warehouse.MinWeight,
|
|
||||||
Adress = warehouse.Address!,
|
|
||||||
ZipCode = warehouse.ZipCode,
|
|
||||||
City = warehouse.City!
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,54 +0,0 @@
|
|||||||
using API.DTO.Warehouse.Request;
|
|
||||||
using API.DTO.Warehouse.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
|
||||||
|
|
||||||
public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateWarehouseDto, GetWarehouseDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Put("/api/warehouses/{@id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateWarehouseDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Warehouse? warehouseToEdit = await pyrofetesdbcontext
|
|
||||||
.Warehouses
|
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (warehouseToEdit == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mise à jour des champs
|
|
||||||
warehouseToEdit.Name = req.Name;
|
|
||||||
warehouseToEdit.MaxWeight = req.MaxWeight;
|
|
||||||
warehouseToEdit.Current = req.Current;
|
|
||||||
warehouseToEdit.MinWeight = req.MinWeight;
|
|
||||||
warehouseToEdit.Address = req.Adress;
|
|
||||||
warehouseToEdit.ZipCode = req.ZipCode;
|
|
||||||
warehouseToEdit.City = req.City;
|
|
||||||
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetWarehouseDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = warehouseToEdit.Id,
|
|
||||||
Name = warehouseToEdit.Name,
|
|
||||||
MaxWeight = warehouseToEdit.MaxWeight,
|
|
||||||
Current = warehouseToEdit.Current,
|
|
||||||
MinWeight = warehouseToEdit.MinWeight,
|
|
||||||
Adress = warehouseToEdit.Address,
|
|
||||||
ZipCode = warehouseToEdit.ZipCode,
|
|
||||||
City = warehouseToEdit.City
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
1950
PyroFetes/Migrations/20251010083620_FixingDatabase.Designer.cs
generated
Normal file
1950
PyroFetes/Migrations/20251010083620_FixingDatabase.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
52
PyroFetes/Migrations/20251010083620_FixingDatabase.cs
Normal file
52
PyroFetes/Migrations/20251010083620_FixingDatabase.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PyroFetes.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixingDatabase : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "References",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SellingPrice",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Reference",
|
||||||
|
table: "Products",
|
||||||
|
type: "nvarchar(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Reference",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "References",
|
||||||
|
table: "Products",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<decimal>(
|
||||||
|
name: "SellingPrice",
|
||||||
|
table: "Products",
|
||||||
|
type: "decimal(18,2)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -541,11 +541,10 @@ namespace PyroFetes.Migrations
|
|||||||
b.Property<int>("ProductCategoryId")
|
b.Property<int>("ProductCategoryId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("References")
|
b.Property<string>("Reference")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasMaxLength(20)
|
||||||
b.Property<decimal>("SellingPrice")
|
.HasColumnType("nvarchar(20)");
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<decimal>("Weight")
|
b.Property<decimal>("Weight")
|
||||||
.HasColumnType("decimal(18,2)");
|
.HasColumnType("decimal(18,2)");
|
||||||
|
@@ -5,14 +5,13 @@ namespace PyroFetes.Models
|
|||||||
public class Product
|
public class Product
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required] public int References { get; set; }
|
[Required, MaxLength(20)] public string? Reference { get; set; }
|
||||||
[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 int 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 decimal SellingPrice { get; set; }
|
|
||||||
[Required] public string? Image { get; set; }
|
[Required] public string? Image { get; set; }
|
||||||
[Required, MaxLength(200)] public string? Link { get; set; }
|
[Required, MaxLength(200)] public string? Link { get; set; }
|
||||||
[Required] public int MinimalQuantity { get; set; }
|
[Required] public int MinimalQuantity { get; set; }
|
||||||
|
@@ -1,19 +1,18 @@
|
|||||||
using API;
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
using FastEndpoints;
|
|
||||||
using FastEndpoints.Swagger;
|
|
||||||
using PyroFetes;
|
|
||||||
|
|
||||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
// Add services to the container.
|
||||||
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
// On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet
|
var app = builder.Build();
|
||||||
builder.Services.AddFastEndpoints().SwaggerDocument();
|
|
||||||
|
|
||||||
// On ajoute ici la configuration de la base de données
|
// Configure the HTTP request pipeline.
|
||||||
builder.Services.AddDbContext<PyroFetesDbContext>();
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
// On construit l'application en lui donnant vie
|
app.UseSwagger();
|
||||||
WebApplication app = builder.Build();
|
app.UseSwaggerUI();
|
||||||
app.UseFastEndpoints().UseSwaggerGen();
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
@@ -7,8 +7,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FastEndpoints" Version="7.0.1" />
|
|
||||||
<PackageReference Include="FastEndpoints.Swagger" Version="7.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.19"/>
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.19"/>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.20">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.20">
|
||||||
|
50
README.md
Normal file
50
README.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# Gestionnaire de Stocks et Commandes
|
||||||
|
|
||||||
|
Cette application web permet de **suivre les stocks**, **automatiser les commandes fournisseurs** et **gérer le cycle complet d’approvisionnement**.
|
||||||
|
Elle est conçue pour simplifier le travail des entreprises en offrant une vue en temps réel sur les produits, leurs fournisseurs et l’état des livraisons.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✨ Fonctionnalités principales
|
||||||
|
|
||||||
|
### 1️⃣ Suivi et réapprovisionnement des stocks
|
||||||
|
- Définissez un **niveau minimal de stock** pour chaque produit.
|
||||||
|
- Surveillez les **niveaux en temps réel** grâce à une interface claire.
|
||||||
|
- Lorsqu’un produit atteint ou descend sous son seuil minimal, le système **génère automatiquement un bon de commande** pour le réapprovisionner.
|
||||||
|
|
||||||
|
### 2️⃣ Gestion des fournisseurs
|
||||||
|
- Enregistrez les informations complètes des fournisseurs : nom, adresse, coordonnées, produits fournis, délais de livraison.
|
||||||
|
- **Associez un ou plusieurs fournisseurs** à chaque produit.
|
||||||
|
- Lorsqu’un bon de commande est créé, le système **propose automatiquement les fournisseurs appropriés**.
|
||||||
|
|
||||||
|
### 3️⃣ Devis et bons de commande
|
||||||
|
- Créez des **devis personnalisés** : sélection des produits, quantités, prix, ajout d’un logo, message ou conditions de vente.
|
||||||
|
- **Imprimez ou exportez** vos devis au format PDF.
|
||||||
|
- Générez des **bons de commande** en quelques clics, avec personnalisation (logo, conditions d’achat) et exportation en PDF.
|
||||||
|
|
||||||
|
### 4️⃣ Suivi des livraisons
|
||||||
|
- **Transformez un bon de commande en bon de livraison** dès l’expédition des produits par le fournisseur.
|
||||||
|
- Enregistrez toutes les informations importantes : date d’expédition, transporteur, numéro de suivi, date prévue et date effective de livraison.
|
||||||
|
- Recevez des **alertes en cas de retard**.
|
||||||
|
- Gérez la **réception des produits** et vérifiez leur conformité.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🗂️ Livrables prévus
|
||||||
|
- **Modèle de données** : diagramme de classes commun à tous les groupes.
|
||||||
|
- **Interface utilisateur** : maquettes ou prototypes interactifs.
|
||||||
|
- **Code source commenté** pour une meilleure compréhension.
|
||||||
|
- **Documentation technique** : description des fonctionnalités, architecture de l’application et API.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👥 Équipe
|
||||||
|
- **Mathys**
|
||||||
|
- **Enzo**
|
||||||
|
- **Cristiano**
|
||||||
|
- **Arsène**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Objectif
|
||||||
|
Fournir un outil complet pour automatiser la gestion des stocks et des commandes, réduisant les erreurs humaines, améliorant le suivi des livraisons et facilitant la communication avec les fournisseurs.
|
Reference in New Issue
Block a user