forked from sanchezvem/PyroFetes
Compare commits
113 Commits
997d7c64fb
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a42e1010f | |||
| 2fa74ccba8 | |||
| 65cff130e4 | |||
| e21e2afea4 | |||
| 17978e7c19 | |||
| 6a20676b32 | |||
| e440dcd2b5 | |||
| bee1cfb0e3 | |||
| d709654410 | |||
| 4a82c51133 | |||
| 8a04adeec3 | |||
| db9219e80f | |||
| 9e6834754f | |||
| efa7a0be6f | |||
| 2a439ccbb5 | |||
| 5c6798a647 | |||
|
|
50a5f371dd | ||
| 86c5d6ae7b | |||
| 1c0432a2c4 | |||
| 3e8f36457e | |||
| 5d68ee6992 | |||
|
|
d26284d552 | ||
|
|
d537051bea | ||
|
|
3ad506f869 | ||
|
|
9aac7c39f2 | ||
|
|
b76b668097 | ||
|
|
669938d677 | ||
|
|
165c9b9322 | ||
|
|
0b72549143 | ||
|
|
d64890dec9 | ||
|
|
8325aa0768 | ||
|
|
ee9b4675dd | ||
|
|
f6383265ba | ||
|
|
7bf0b5bfd1 | ||
|
|
bd653c149c | ||
| 0511bb5075 | |||
| 27e8fea7f3 | |||
| 6dba61f742 | |||
|
|
20bbccf883 | ||
|
|
d7cf245d35 | ||
|
|
2385b7b687 | ||
|
|
ae834d1e3c | ||
|
|
c6d4ef2c58 | ||
|
|
60a7c059b4 | ||
|
|
9684dbcbc7 | ||
| bbd8d3d36a | |||
| 7d92f80de3 | |||
| 304c06ed19 | |||
| 97a7c6811c | |||
| f8b3c51435 | |||
| a535f8cfeb | |||
| 65b5e6afe3 | |||
| 33719b708e | |||
| b00ed36557 | |||
| be0a6a4004 | |||
|
|
6bc8281a37 | ||
|
|
9ff5c038b1 | ||
|
|
4bdd8104d8 | ||
|
|
abc843778f | ||
|
|
c0090da9bd | ||
|
|
554ba9b725 | ||
| 1c898f9144 | |||
| 7bb21be0e6 | |||
| 6a4760fb72 | |||
| 06c64a9f3f | |||
| aa1c98d649 | |||
| fa72c6d777 | |||
| 59628717d4 | |||
| ff590302e2 | |||
| 45f6baaac3 | |||
| ef9740d8ff | |||
| 3ada21adae | |||
| 4f12911263 | |||
| 8bd7fadabc | |||
| e4e6c1c3f7 | |||
| 791eff9256 | |||
| b4502ae562 | |||
| 347003c24a | |||
| 31e69aae1a | |||
| 74b5fa6666 | |||
| b79e07dd8b | |||
|
|
3192d399cc | ||
|
|
37f6460615 | ||
|
|
ecd8883d55 | ||
|
|
0209dbfc20 | ||
| e773e201bd | |||
| 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; }
|
||||
}
|
||||
6
PyroFetes/DTO/Deliverer/Request/CreateDelivererDto.cs
Normal file
6
PyroFetes/DTO/Deliverer/Request/CreateDelivererDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PyroFetes.DTO.Deliverer.Request;
|
||||
|
||||
public class CreateDelivererDto
|
||||
{
|
||||
public string? Transporter { get; set; }
|
||||
}
|
||||
7
PyroFetes/DTO/Deliverer/Request/UpdateDelivererDto.cs
Normal file
7
PyroFetes/DTO/Deliverer/Request/UpdateDelivererDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.Deliverer.Request;
|
||||
|
||||
public class UpdateDelivererDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Transporter { get; set; }
|
||||
}
|
||||
11
PyroFetes/DTO/Deliverer/Response/GetDelivererDto.cs
Normal file
11
PyroFetes/DTO/Deliverer/Response/GetDelivererDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
|
||||
namespace PyroFetes.DTO.Deliverer.Response;
|
||||
|
||||
public class GetDelivererDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Transporter { get; set; }
|
||||
|
||||
public List<GetDeliveryNoteDto>? DeliveryNotes { get; set; }
|
||||
}
|
||||
12
PyroFetes/DTO/DeliveryNote/Request/CreateDeliveryNoteDto.cs
Normal file
12
PyroFetes/DTO/DeliveryNote/Request/CreateDeliveryNoteDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace PyroFetes.DTO.DeliveryNote.Request;
|
||||
|
||||
public class CreateDeliveryNoteDto
|
||||
{
|
||||
public string? TrackingNumber { get; set; }
|
||||
public DateOnly EstimateDeliveryDate { get; set; }
|
||||
public DateOnly ExpeditionDate { get; set; }
|
||||
|
||||
public int DelivererId { get; set; }
|
||||
|
||||
public Dictionary<int,int>? ProductQuantities { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace PyroFetes.DTO.DeliveryNote.Request;
|
||||
|
||||
public class GetDeliveryNotePdfDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.DeliveryNote.Request;
|
||||
|
||||
public class PatchDeliveryNoteRealDeliveryDateDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateOnly RealDeliveryDate { get; set; }
|
||||
}
|
||||
12
PyroFetes/DTO/DeliveryNote/Request/UpdateDeliveryNoteDto.cs
Normal file
12
PyroFetes/DTO/DeliveryNote/Request/UpdateDeliveryNoteDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace PyroFetes.DTO.DeliveryNote.Request;
|
||||
|
||||
public class UpdateDeliveryNoteDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? TrackingNumber { get; set; }
|
||||
public DateOnly EstimateDeliveryDate { get; set; }
|
||||
public DateOnly ExpeditionDate { get; set; }
|
||||
public DateOnly? RealDeliveryDate { get; set; }
|
||||
|
||||
public int DelivererId { get; set; }
|
||||
}
|
||||
17
PyroFetes/DTO/DeliveryNote/Response/GetDeliveryNoteDto.cs
Normal file
17
PyroFetes/DTO/DeliveryNote/Response/GetDeliveryNoteDto.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using PyroFetes.DTO.ProductDelivery.Response;
|
||||
|
||||
namespace PyroFetes.DTO.DeliveryNote.Response;
|
||||
|
||||
public class GetDeliveryNoteDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? TrackingNumber { get; set; }
|
||||
public DateOnly EstimateDeliveryDate { get; set; }
|
||||
public DateOnly ExpeditionDate { get; set; }
|
||||
public DateOnly? RealDeliveryDate { get; set; }
|
||||
|
||||
public int DelivererId { get; set; }
|
||||
public string? DelivererTransporter { get; set; }
|
||||
|
||||
public List<GetProductDeliveryDto>? Products { 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 string? SupplierZipCode { get; set; }
|
||||
public string? SupplierCity { get; set; }
|
||||
public int SupplierDeliveryDelay { get; set; }
|
||||
|
||||
public int? ProductId { get; set; }
|
||||
public string? ProductReferences { get; set; }
|
||||
public string? ProductName { get; set; }
|
||||
public decimal ProductDuration {get; set;}
|
||||
public int ProductCaliber { get; set; }
|
||||
public string? 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; }
|
||||
}
|
||||
8
PyroFetes/DTO/Price/Request/PatchPriceSellingPriceDto.cs
Normal file
8
PyroFetes/DTO/Price/Request/PatchPriceSellingPriceDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PyroFetes.DTO.Price.Request;
|
||||
|
||||
public class PatchPriceSellingPriceDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int SupplierId { 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 string? 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 string? SupplierZipCode { get; set; }
|
||||
public string? SupplierCity { get; set; }
|
||||
public int SupplierDeliveryDelay { get; set; }
|
||||
|
||||
public int ProductId { get; set; }
|
||||
public string? ProductReferences { get; set; }
|
||||
public string? ProductName { get; set; }
|
||||
public decimal ProductDuration {get; set;}
|
||||
public int ProductCaliber { get; set; }
|
||||
public string? 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,18 +1,15 @@
|
||||
namespace API.DTO.Product.Request;
|
||||
namespace PyroFetes.DTO.Product.Request;
|
||||
|
||||
public class CreateProductDto
|
||||
{
|
||||
public int References { get; set; }
|
||||
public string? 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 Duration {get; set;}
|
||||
public int Caliber { get; set; }
|
||||
public string? 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 MinimalQuantity { 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,18 +1,16 @@
|
||||
namespace API.DTO.Product.Request;
|
||||
namespace PyroFetes.DTO.Product.Request;
|
||||
|
||||
public class UpdateProductDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Reference { get; set; }
|
||||
public string? 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 Duration {get; set;}
|
||||
public int Caliber { get; set; }
|
||||
public string? 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 MinimalQuantity { get; set; }
|
||||
}
|
||||
@@ -1,20 +1,16 @@
|
||||
namespace API.DTO.Product.Response;
|
||||
namespace PyroFetes.DTO.Product.Response;
|
||||
|
||||
public class GetProductDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Reference { get; set; }
|
||||
public string? 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 Duration {get; set;}
|
||||
public int Caliber { get; set; }
|
||||
public string? 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 string? ClassificationLabel { get; set; }
|
||||
public int ProductCategoryId { get; set; }
|
||||
public string? ProductCategoryLabel { get; set; }
|
||||
public int MinimalQuantity { 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,8 @@
|
||||
namespace PyroFetes.DTO.ProductDelivery.Request;
|
||||
|
||||
public class CreateProductDeliveryDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int DeliveryNoteId { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PyroFetes.DTO.ProductDelivery.Request;
|
||||
|
||||
public class UpdateProductDeliveryDto
|
||||
{
|
||||
public int Quantity { get; set; }
|
||||
public int ProductId { get; set; }
|
||||
public int DeliveryNoteId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace PyroFetes.DTO.ProductDelivery.Response;
|
||||
|
||||
public class GetProductDeliveryDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int ProductReference { 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 DeliveryNoteId { get; set; }
|
||||
public string? DeliveryNoteTrackingNumber { get; set; }
|
||||
public DateOnly DeliveryNoteEstimateDeliveryDate { get; set; }
|
||||
public DateOnly DeliveryNoteExpeditionDate { get; set; }
|
||||
public DateOnly? DeliveryNoteRealDeliveryDate { get; set; }
|
||||
|
||||
public int DeliveryNoteDeliverId { get; set; }
|
||||
public string? DeliveryNoteDeliverTransporter { get; set; }
|
||||
|
||||
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace PyroFetes.DTO.PurchaseOrder.Request;
|
||||
|
||||
public class GetPurchaseOrderPdfDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.PurchaseOrder.Request;
|
||||
|
||||
public class PatchPurchaseOrderPurchaseConditionsDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? PurchaseConditions { get; set; }
|
||||
}
|
||||
10
PyroFetes/DTO/PurchaseOrder/Response/GetPurchaseOrderDto.cs
Normal file
10
PyroFetes/DTO/PurchaseOrder/Response/GetPurchaseOrderDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||
|
||||
namespace PyroFetes.DTO.PurchaseOrder.Response;
|
||||
|
||||
public class GetPurchaseOrderDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? PurchaseConditions { get; set; }
|
||||
public List<GetPurchaseProductDto>? GetPurchaseProductDto { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||
|
||||
public class CreatePurchaseProductDto
|
||||
{
|
||||
public int Quantity { get; set; }
|
||||
public int ProductId { get; set; }
|
||||
public int PurchaseOrderId { get; set; }
|
||||
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||
|
||||
public class PatchPurchaseProductQuantityDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int PurchaseOrderId { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||
|
||||
public class UpdatePurchaseProductDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int PurchaseOrderId { get; set; }
|
||||
|
||||
public int Quantity { 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 string? PurchaseOrderPurchaseConditions { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace PyroFetes.DTO.PurchaseProduct.Response;
|
||||
|
||||
public class GetPurchaseProductDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public string? 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; }
|
||||
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
6
PyroFetes/DTO/Quotation/Request/GetQuotationPdfDto.cs
Normal file
6
PyroFetes/DTO/Quotation/Request/GetQuotationPdfDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PyroFetes.DTO.Quotation.Request;
|
||||
|
||||
public class GetQuotationPdfDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.Quotation.Request;
|
||||
|
||||
public class PatchQuotationConditionsSaleDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? ConditionsSale { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.Quotation.Request;
|
||||
|
||||
public class PatchQuotationMessageDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
8
PyroFetes/DTO/Quotation/Request/UpdateQuotationDto.cs
Normal file
8
PyroFetes/DTO/Quotation/Request/UpdateQuotationDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PyroFetes.DTO.Quotation.Request;
|
||||
|
||||
public class UpdateQuotationDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Message { get; set; }
|
||||
public string? ConditionsSale { get; set; }
|
||||
}
|
||||
11
PyroFetes/DTO/Quotation/Response/GetQuotationDto.cs
Normal file
11
PyroFetes/DTO/Quotation/Response/GetQuotationDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using PyroFetes.DTO.QuotationProduct.Response;
|
||||
|
||||
namespace PyroFetes.DTO.Quotation.Response;
|
||||
|
||||
public class GetQuotationDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Message { get; set; }
|
||||
public string? ConditionsSale { get; set; }
|
||||
public List<GetQuotationProductDto>? GetQuotationProductDto { 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,8 @@
|
||||
namespace PyroFetes.DTO.QuotationProduct.Request;
|
||||
|
||||
public class PatchQuotationProductQuantityDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int QuotationId { 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,22 @@
|
||||
namespace PyroFetes.DTO.QuotationProduct.Response;
|
||||
|
||||
public class GetQuotationProductDto
|
||||
{
|
||||
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 string? 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 string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string Adress { get; set; }
|
||||
public int ZipCode { get; set; }
|
||||
public string City { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? ZipCode { 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 int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string Adress { get; set; }
|
||||
public int ZipCode { get; set; }
|
||||
public string City { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? ZipCode { get; set; }
|
||||
public string? City { get; set; }
|
||||
public int DeliveryDelay { get; set; }
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
namespace API.DTO.Supplier.Response;
|
||||
using PyroFetes.DTO.Price.Response;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
|
||||
namespace PyroFetes.DTO.Supplier.Response;
|
||||
|
||||
public class GetSupplierDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string Adress { get; set; }
|
||||
public int ZipCode { get; set; }
|
||||
public string City { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? ZipCode { get; set; }
|
||||
public string? City { get; set; }
|
||||
public int DeliveryDelay { get; set; }
|
||||
public List<GetProductDto>? Products { get; set; }
|
||||
public List<GetPriceDto>? Prices { get; set; }
|
||||
}
|
||||
7
PyroFetes/DTO/User/Request/ConnectUserDto.cs
Normal file
7
PyroFetes/DTO/User/Request/ConnectUserDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.User.Request;
|
||||
|
||||
public class ConnectUserDto
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
9
PyroFetes/DTO/User/Request/CreateUserDto.cs
Normal file
9
PyroFetes/DTO/User/Request/CreateUserDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace PyroFetes.DTO.User.Request;
|
||||
|
||||
public class CreateUserDto
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? Fonction { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
7
PyroFetes/DTO/User/Request/PatchUserPasswordDto.cs
Normal file
7
PyroFetes/DTO/User/Request/PatchUserPasswordDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.User.Request;
|
||||
|
||||
public class PatchUserPasswordDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Password { 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; }
|
||||
}
|
||||
6
PyroFetes/DTO/User/Response/GetTokenDto.cs
Normal file
6
PyroFetes/DTO/User/Response/GetTokenDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PyroFetes.DTO.User.Response;
|
||||
|
||||
public class GetTokenDto
|
||||
{
|
||||
public string? Token { 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,8 @@
|
||||
namespace PyroFetes.DTO.WareHouseProduct.Request;
|
||||
|
||||
public class PatchWareHouseProductQuantityDto
|
||||
{
|
||||
public int WareHouseId { get; set; }
|
||||
public int ProductId { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.WareHouseProduct.Response;
|
||||
|
||||
public class GetTotalQuantityDto
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int TotalQuantity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PyroFetes.DTO.WareHouseProduct.Response;
|
||||
|
||||
public class GetWareHouseProductDto
|
||||
{
|
||||
public int Quantity { get; set; }
|
||||
public int WareHouseId { get; set; }
|
||||
public int ProductId { 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);
|
||||
}
|
||||
|
||||
}
|
||||
30
PyroFetes/Endpoints/Deliverers/CreateDelivererEndpoint.cs
Normal file
30
PyroFetes/Endpoints/Deliverers/CreateDelivererEndpoint.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.Deliverer.Request;
|
||||
using PyroFetes.DTO.Deliverer.Response;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
|
||||
namespace PyroFetes.Endpoints.Deliverers;
|
||||
|
||||
public class CreateDelivererEndpoint(
|
||||
DeliverersRepository deliverersRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<CreateDelivererDto, GetDelivererDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/deliverers");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CreateDelivererDto req, CancellationToken ct)
|
||||
{
|
||||
Deliverer newDeliverer = new Deliverer()
|
||||
{
|
||||
Transporter = req.Transporter,
|
||||
};
|
||||
|
||||
await deliverersRepository.AddAsync(newDeliverer, ct);
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDelivererDto>(newDeliverer), ct);
|
||||
}
|
||||
}
|
||||
36
PyroFetes/Endpoints/Deliverers/DeleteDelivererEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Deliverers/DeleteDelivererEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.Deliverers;
|
||||
|
||||
namespace PyroFetes.Endpoints.Deliverers;
|
||||
|
||||
public class DeleteDelivererRequest
|
||||
{
|
||||
public int DelivererId { get; set; }
|
||||
}
|
||||
public class DeleteDelivererEndpoint(DeliverersRepository deliverersRepository) : Endpoint<DeleteDelivererRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Delete("/deliverers/{@id}", x=>new {x.DelivererId});
|
||||
AllowAnonymous();
|
||||
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(DeleteDelivererRequest req, CancellationToken ct)
|
||||
{
|
||||
Deliverer? deliverer = await deliverersRepository.FirstOrDefaultAsync(new GetDelivererByIdSpec(req.DelivererId), ct);
|
||||
|
||||
if (deliverer == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
await deliverersRepository.DeleteAsync(deliverer, ct);
|
||||
|
||||
await Send.OkAsync(ct);
|
||||
}
|
||||
|
||||
}
|
||||
23
PyroFetes/Endpoints/Deliverers/GetAllDelivererEndpoint.cs
Normal file
23
PyroFetes/Endpoints/Deliverers/GetAllDelivererEndpoint.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Deliverer.Response;
|
||||
using PyroFetes.Repositories;
|
||||
|
||||
namespace PyroFetes.Endpoints.Deliverers;
|
||||
|
||||
public class GetAllDelivererEndpoint(DeliverersRepository deliverersRepository) : EndpointWithoutRequest<List<GetDelivererDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/deliverers");
|
||||
AllowAnonymous();
|
||||
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
await Send.OkAsync(await deliverersRepository.ProjectToListAsync<GetDelivererDto>(ct), ct);
|
||||
}
|
||||
|
||||
}
|
||||
39
PyroFetes/Endpoints/Deliverers/GetDelivererEndpoint.cs
Normal file
39
PyroFetes/Endpoints/Deliverers/GetDelivererEndpoint.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Deliverer.Response;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.Deliverers;
|
||||
|
||||
namespace PyroFetes.Endpoints.Deliverers;
|
||||
|
||||
public class GetDelivererRequest
|
||||
{
|
||||
public int DelivererId { get; set; }
|
||||
}
|
||||
|
||||
public class GetDelivererEndpoint(
|
||||
DeliverersRepository deliverersRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<GetDelivererRequest, GetDelivererDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/deliverers/{@id}", x=>new {x.DelivererId});
|
||||
AllowAnonymous();
|
||||
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(GetDelivererRequest req, CancellationToken ct)
|
||||
{
|
||||
Deliverer? deliverer = await deliverersRepository.FirstOrDefaultAsync(new GetDelivererByIdSpec(req.DelivererId), ct);
|
||||
|
||||
if (deliverer == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDelivererDto>(deliverer), ct);
|
||||
}
|
||||
|
||||
}
|
||||
39
PyroFetes/Endpoints/Deliverers/UpdateDelivererEndpoint.cs
Normal file
39
PyroFetes/Endpoints/Deliverers/UpdateDelivererEndpoint.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Deliverer.Request;
|
||||
using PyroFetes.DTO.Deliverer.Response;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.Deliverers;
|
||||
|
||||
namespace PyroFetes.Endpoints.Deliverers;
|
||||
|
||||
public class UpdateDelivererEndpoint(
|
||||
DeliverersRepository deliverersRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<UpdateDelivererDto, GetDelivererDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Put("/deliverers/{@id}", x=>new {x.Id});
|
||||
AllowAnonymous();
|
||||
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(UpdateDelivererDto req, CancellationToken ct)
|
||||
{
|
||||
Deliverer? deliverer = await deliverersRepository.FirstOrDefaultAsync(new GetDelivererByIdSpec(req.Id), ct);
|
||||
|
||||
if (deliverer == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
deliverer.Transporter = req.Transporter;
|
||||
|
||||
await deliverersRepository.UpdateAsync(deliverer,ct);
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDelivererDto>(deliverer), ct);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.DeliveryNote.Request;
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.Deliverers;
|
||||
using PyroFetes.Specifications.Products;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class CreateDeliveryNoteEndpoint(
|
||||
DeliveryNotesRepository deliveryNotesRepository,
|
||||
DeliverersRepository deliverersRepository,
|
||||
ProductsRepository productsRepository,
|
||||
ProductDeliveriesRepository productDeliveriesRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<CreateDeliveryNoteDto, GetDeliveryNoteDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/deliveryNotes");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CreateDeliveryNoteDto req, CancellationToken ct)
|
||||
{
|
||||
Deliverer? deliverer = await deliverersRepository.FirstOrDefaultAsync(new GetDelivererByIdSpec(req.DelivererId), ct);
|
||||
|
||||
if (deliverer == null)
|
||||
{
|
||||
await Send.StringAsync("No deliverer found", 404, cancellation: ct);
|
||||
return;
|
||||
}
|
||||
|
||||
//Creating the Delivery Note
|
||||
DeliveryNote newDeliveryNote = new DeliveryNote()
|
||||
{
|
||||
TrackingNumber = req.TrackingNumber,
|
||||
EstimateDeliveryDate = req.EstimateDeliveryDate,
|
||||
ExpeditionDate = req.ExpeditionDate,
|
||||
DelivererId = req.DelivererId,
|
||||
Deliverer = deliverer,
|
||||
|
||||
};
|
||||
|
||||
await deliveryNotesRepository.AddAsync(newDeliveryNote, ct);
|
||||
|
||||
foreach (var productQuantity in req.ProductQuantities!)
|
||||
{
|
||||
Product? product =
|
||||
await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(productQuantity.Key), ct);
|
||||
if (product != null)
|
||||
{
|
||||
ProductDelivery productDelivery = new ProductDelivery()
|
||||
{
|
||||
DeliveryNote = newDeliveryNote,
|
||||
Quantity = productQuantity.Value,
|
||||
Product = product,
|
||||
DeliveryNoteId = newDeliveryNote.Id
|
||||
};
|
||||
|
||||
await productDeliveriesRepository.AddAsync(productDelivery, ct);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(newDeliveryNote), ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.Endpoints.Quotations;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.DeliveryNotes;
|
||||
using PyroFetes.Specifications.Quotations;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class DeleteDeliveryNoteRequest
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteDeliveryNoteEndpoint(
|
||||
DeliveryNotesRepository deliveryNotesRepository) : Endpoint<DeleteDeliveryNoteRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Delete("/deliveryNotes/{@Id}", x => new {x.Id});
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(DeleteDeliveryNoteRequest req, CancellationToken ct)
|
||||
{
|
||||
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id), ct);
|
||||
|
||||
if (deliveryNote == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
await deliveryNotesRepository.DeleteAsync(deliveryNote, ct);
|
||||
|
||||
await Send.NoContentAsync(ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
using PyroFetes.Repositories;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class GetAllDeliveryNoteEndpoint(DeliveryNotesRepository deliveryNotesRepository) : EndpointWithoutRequest<List<GetDeliveryNoteDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/deliveryNotes");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
await Send.OkAsync(await deliveryNotesRepository.ProjectToListAsync<GetDeliveryNoteDto>(ct), ct);
|
||||
}
|
||||
|
||||
}
|
||||
35
PyroFetes/Endpoints/DeliveryNotes/GetDeliveryNoteEndpoint.cs
Normal file
35
PyroFetes/Endpoints/DeliveryNotes/GetDeliveryNoteEndpoint.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.DeliveryNotes;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class GetDeliveryNoteRequest
|
||||
{
|
||||
public int DeliveryNoteId { get; set; }
|
||||
}
|
||||
public class GetDeliveryNoteEndpoint(
|
||||
DeliveryNotesRepository deliveryNotesRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<GetDeliveryNoteRequest, GetDeliveryNoteDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/deliveryNotes/{@id}", x=> new {x.DeliveryNoteId});
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(GetDeliveryNoteRequest req, CancellationToken ct)
|
||||
{
|
||||
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.DeliveryNoteId), ct);
|
||||
|
||||
if (deliveryNote == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(deliveryNote), ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Net.Mime;
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.DeliveryNote.Request;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Services.Pdf;
|
||||
using PyroFetes.Specifications.DeliveryNotes;
|
||||
using PyroFetes.Specifications.Quotations;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class GetDeliveryNotePdfEndpoint(
|
||||
DeliveryNotesRepository deliveryNotesRepository,
|
||||
IDeliveryNotePdfService deliveryNotePdfService)
|
||||
: Endpoint<GetDeliveryNotePdfDto, byte[]>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/deliveryNotes/{@Id}/pdf", x => new {x.Id});
|
||||
AllowAnonymous();
|
||||
Description(b => b.Produces<byte[]>(200, MediaTypeNames.Application.Pdf));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(GetDeliveryNotePdfDto req, CancellationToken ct)
|
||||
{
|
||||
DeliveryNote? deliveryNote = await deliveryNotesRepository
|
||||
.FirstOrDefaultAsync(new GetDeliveryNoteByIdWithProductsSpec(req.Id), ct);
|
||||
|
||||
if (deliveryNote == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
var bytes = deliveryNotePdfService.Generate(deliveryNote, deliveryNote.ProductDeliveries!);
|
||||
|
||||
await Send.BytesAsync(
|
||||
bytes: bytes,
|
||||
contentType: "application/pdf",
|
||||
fileName: $"bon-de-livraison-{deliveryNote.Id}.pdf",
|
||||
cancellation: ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.DeliveryNote.Request;
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
using PyroFetes.DTO.PurchaseProduct.Request;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.Deliverers;
|
||||
using PyroFetes.Specifications.DeliveryNotes;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class PatchRealDeliveryDateEndpoint(
|
||||
DeliveryNotesRepository deliveryNotesRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<PatchDeliveryNoteRealDeliveryDateDto, GetDeliveryNoteDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Patch("/deliveryNotes/{@id}", x=> new {x.Id});
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(PatchDeliveryNoteRealDeliveryDateDto req, CancellationToken ct)
|
||||
{
|
||||
DeliveryNote? deliveryNoteToPath =
|
||||
await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id),ct);
|
||||
|
||||
if (deliveryNoteToPath == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
if (deliveryNoteToPath.RealDeliveryDate != null)
|
||||
{
|
||||
await Send.StringAsync("Impossible de modifier la date.", 400);
|
||||
return;
|
||||
}
|
||||
|
||||
deliveryNoteToPath.RealDeliveryDate = req.RealDeliveryDate;
|
||||
|
||||
await deliveryNotesRepository.UpdateAsync(deliveryNoteToPath, ct);
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(deliveryNoteToPath), ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.DeliveryNote.Request;
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
using PyroFetes.Models;
|
||||
using PyroFetes.Repositories;
|
||||
using PyroFetes.Specifications.DeliveryNotes;
|
||||
|
||||
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||
|
||||
public class UpdateDeliveryNoteEndpoint(
|
||||
DeliveryNotesRepository deliveryNotesRepository,
|
||||
AutoMapper.IMapper mapper) : Endpoint<UpdateDeliveryNoteDto, GetDeliveryNoteDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Put("/deliveryNotes/{@Id}", x => new {x.Id});
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(UpdateDeliveryNoteDto req, CancellationToken ct)
|
||||
{
|
||||
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id), ct);
|
||||
|
||||
if (deliveryNote == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
deliveryNote.TrackingNumber = req.TrackingNumber;
|
||||
deliveryNote.EstimateDeliveryDate = req.EstimateDeliveryDate;
|
||||
deliveryNote.ExpeditionDate = req.ExpeditionDate;
|
||||
deliveryNote.RealDeliveryDate = req.RealDeliveryDate;
|
||||
deliveryNote.DelivererId = req.DelivererId;
|
||||
|
||||
await deliveryNotesRepository.UpdateAsync(deliveryNote, ct);
|
||||
|
||||
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(deliveryNote), 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);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user