Compare commits
65 Commits
e336a50c4e
...
d26284d552
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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,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; }
|
||||||
|
}
|
||||||
@@ -4,21 +4,21 @@ public class CreatePriceDto
|
|||||||
{
|
{
|
||||||
public decimal SellingPrice { get; set; }
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
public int SupplierId { get; set; }
|
public int? SupplierId { get; set; }
|
||||||
public string? SupplierName { get; set; }
|
public string? SupplierName { get; set; }
|
||||||
public string? SupplierEmail { get; set; }
|
public string? SupplierEmail { get; set; }
|
||||||
public string? SupplierPhone { get; set; }
|
public string? SupplierPhone { get; set; }
|
||||||
public string? SupplierAddress { get; set; }
|
public string? SupplierAddress { get; set; }
|
||||||
public int SupplierZipCode { get; set; }
|
public string? SupplierZipCode { get; set; }
|
||||||
public string? SupplierCity { get; set; }
|
public string? SupplierCity { get; set; }
|
||||||
public int SupplierDeliveryDelay { get; set; }
|
public int SupplierDeliveryDelay { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int? ProductId { get; set; }
|
||||||
public int ProductReferences { get; set; }
|
public string? ProductReferences { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration {get; set;}
|
||||||
public decimal ProductCaliber { get; set; }
|
public int ProductCaliber { get; set; }
|
||||||
public int ProductApprovalNumber { get; set; }
|
public string? ProductApprovalNumber { get; set; }
|
||||||
public decimal ProductWeight { get; set; }
|
public decimal ProductWeight { get; set; }
|
||||||
public decimal ProductNec { get; set; }
|
public decimal ProductNec { get; set; }
|
||||||
public string? ProductImage { get; set; }
|
public string? ProductImage { get; set; }
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
public class PatchPriceSellingPriceDto
|
public class PatchPriceSellingPriceDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
public int SupplierId { get; set; }
|
||||||
public decimal SellingPrice { get; set; }
|
public decimal SellingPrice { get; set; }
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ public class UpdatePriceDto
|
|||||||
public int SupplierDeliveryDelay { get; set; }
|
public int SupplierDeliveryDelay { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int ProductReferences { get; set; }
|
public string? ProductReferences { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration {get; set;}
|
||||||
public decimal ProductCaliber { get; set; }
|
public decimal ProductCaliber { get; set; }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class GetPriceDto
|
|||||||
public int SupplierDeliveryDelay { get; set; }
|
public int SupplierDeliveryDelay { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int ProductReferences { get; set; }
|
public string? ProductReferences { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration {get; set;}
|
||||||
public decimal ProductCaliber { get; set; }
|
public decimal ProductCaliber { get; set; }
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ namespace PyroFetes.DTO.Product.Request;
|
|||||||
|
|
||||||
public class CreateProductDto
|
public class CreateProductDto
|
||||||
{
|
{
|
||||||
public int References { get; set; }
|
public string? 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 int Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ namespace PyroFetes.DTO.Product.Request;
|
|||||||
public class UpdateProductDto
|
public class UpdateProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int References { get; set; }
|
public string? 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 int Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ namespace PyroFetes.DTO.Product.Response;
|
|||||||
public class GetProductDto
|
public class GetProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int References { get; set; }
|
public string? 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 int Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
public string? ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
public string? Image { get; set; }
|
public string? Image { 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,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; }
|
||||||
|
}
|
||||||
@@ -3,20 +3,7 @@ namespace PyroFetes.DTO.PurchaseProduct.Request;
|
|||||||
public class CreatePurchaseProductDto
|
public class CreatePurchaseProductDto
|
||||||
{
|
{
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int ProductId { 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 int PurchaseOrderId { get; set; }
|
||||||
public string? PurchaseOrderPurchaseConditions { get; set; }
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ namespace PyroFetes.DTO.PurchaseProduct.Request;
|
|||||||
|
|
||||||
public class PatchPurchaseProductQuantityDto
|
public class PatchPurchaseProductQuantityDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
public int PurchaseOrderId { get; set; }
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,11 @@ namespace PyroFetes.DTO.PurchaseProduct.Request;
|
|||||||
|
|
||||||
public class UpdatePurchaseProductDto
|
public class UpdatePurchaseProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
public int PurchaseOrderId { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
public int ProductReferences { get; set; }
|
public int ProductReferences { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration {get; set;}
|
||||||
@@ -17,7 +18,5 @@ public class UpdatePurchaseProductDto
|
|||||||
public string? ProductLink { get; set; }
|
public string? ProductLink { get; set; }
|
||||||
public int ProductMinimalQuantity { get; set; }
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public int PurchaseOrderId { get; set; }
|
|
||||||
public string? PurchaseOrderPurchaseConditions { get; set; }
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,23 +2,20 @@ namespace PyroFetes.DTO.PurchaseProduct.Response;
|
|||||||
|
|
||||||
public class GetPurchaseProductDto
|
public class GetPurchaseProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int ProductReferences { get; set; }
|
public string? ProductReferences { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration {get; set;}
|
||||||
public decimal ProductCaliber { get; set; }
|
public decimal ProductCaliber { get; set; }
|
||||||
public int ProductApprovalNumber { get; set; }
|
public int ProductApprovalNumber { get; set; }
|
||||||
public decimal ProductWeight { get; set; }
|
public decimal ProductWeight { get; set; }
|
||||||
public decimal ProductNec { get; set; }
|
public decimal ProductNec { get; set; }
|
||||||
public decimal ProductSellingPrice { get; set; }
|
|
||||||
public string? ProductImage { get; set; }
|
public string? ProductImage { get; set; }
|
||||||
public string? ProductLink { get; set; }
|
public string? ProductLink { get; set; }
|
||||||
public int ProductMinimalQuantity { get; set; }
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public int PurchaseOrderId { get; set; }
|
public int PurchaseOrderId { get; set; }
|
||||||
public string? PurchaseOrderPurchaseConditions { get; set; }
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
|
|
||||||
|
public int Quantity { 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; }
|
||||||
|
}
|
||||||
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; }
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ namespace PyroFetes.DTO.QuotationProduct.Request;
|
|||||||
|
|
||||||
public class PatchQuotationProductQuantityDto
|
public class PatchQuotationProductQuantityDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
public int QuotationId { get; set; }
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ namespace PyroFetes.DTO.QuotationProduct.Response;
|
|||||||
|
|
||||||
public class GetQuotationProductDto
|
public class GetQuotationProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int QuotationId { get; set; }
|
public int QuotationId { get; set; }
|
||||||
@@ -10,7 +9,7 @@ public class GetQuotationProductDto
|
|||||||
public string? QuotationConditionsSale { get; set; }
|
public string? QuotationConditionsSale { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int ProductReferences { get; set; }
|
public string? ProductReferences { get; set; }
|
||||||
public string? ProductName { get; set; }
|
public string? ProductName { get; set; }
|
||||||
public decimal ProductDuration {get; set;}
|
public decimal ProductDuration {get; set;}
|
||||||
public decimal ProductCaliber { get; set; }
|
public decimal ProductCaliber { get; set; }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class CreateSupplierDto
|
|||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
public string? Phone { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string? Address { get; set; }
|
public string? Address { get; set; }
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
public string? City { get; set; }
|
public string? City { get; set; }
|
||||||
public int DeliveryDelay { get; set; }
|
public int DeliveryDelay { get; set; }
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ public class UpdateSupplierDto
|
|||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
public string? Phone { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string? Address { get; set; }
|
public string? Address { get; set; }
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
public string? City { get; set; }
|
public string? City { get; set; }
|
||||||
public int DeliveryDelay { get; set; }
|
public int DeliveryDelay { get; set; }
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ public class GetSupplierDto
|
|||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
public string? Phone { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string? Address { get; set; }
|
public string? Address { get; set; }
|
||||||
public int ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
public string? City { get; set; }
|
public string? City { get; set; }
|
||||||
public int DeliveryDelay { get; set; }
|
public int DeliveryDelay { 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; }
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ public class CreateUserDto
|
|||||||
{
|
{
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public string? Password { get; set; }
|
public string? Password { get; set; }
|
||||||
public string? Salt { get; set; }
|
|
||||||
public string? Fonction { get; set; }
|
public string? Fonction { get; set; }
|
||||||
public string? Email { 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; }
|
||||||
|
}
|
||||||
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; }
|
||||||
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,7 @@ namespace PyroFetes.DTO.WareHouseProduct.Request;
|
|||||||
|
|
||||||
public class PatchWareHouseProductQuantityDto
|
public class PatchWareHouseProductQuantityDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int WareHouseId { get; set; }
|
||||||
|
public int ProductId { get; set; }
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
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,7 @@
|
|||||||
|
namespace PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
|
|
||||||
|
public class GetTotalQuantityDto
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int TotalQuantity { get; set; }
|
||||||
|
}
|
||||||
@@ -2,27 +2,7 @@ namespace PyroFetes.DTO.WareHouseProduct.Response;
|
|||||||
|
|
||||||
public class GetWareHouseProductDto
|
public class GetWareHouseProductDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int WareHouseId { 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 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; }
|
|
||||||
}
|
}
|
||||||
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,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,39 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
deliveryNoteToPath.RealDeliveryDate = req.RealDeliveryDate;
|
||||||
|
|
||||||
|
await deliveryNotesRepository.UpdateAsync(deliveryNoteToPath, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(deliveryNoteToPath), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
84
PyroFetes/Endpoints/Prices/CreatePriceEndpoint.cs
Normal file
84
PyroFetes/Endpoints/Prices/CreatePriceEndpoint.cs
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Price.Request;
|
||||||
|
using PyroFetes.DTO.Price.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Prices;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
using PyroFetes.Specifications.Suppliers;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Prices;
|
||||||
|
|
||||||
|
public class CreatePriceEndpoint(
|
||||||
|
SuppliersRepository suppliersRepository,
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
PricesRepository pricesRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreatePriceDto, GetPriceDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/prices");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreatePriceDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
// Gestion du fournisseur
|
||||||
|
Supplier? supplier = await suppliersRepository.FirstOrDefaultAsync(new GetSupplierByIdSpec(req.SupplierId), ct);
|
||||||
|
if (supplier == null)
|
||||||
|
{
|
||||||
|
supplier = new Supplier()
|
||||||
|
{
|
||||||
|
Name = req.SupplierName,
|
||||||
|
Email = req.SupplierEmail,
|
||||||
|
Phone = req.SupplierPhone,
|
||||||
|
Address = req.SupplierAddress,
|
||||||
|
City = req.SupplierCity,
|
||||||
|
ZipCode = req.SupplierZipCode,
|
||||||
|
DeliveryDelay = req.SupplierDeliveryDelay
|
||||||
|
};
|
||||||
|
await suppliersRepository.AddAsync(supplier, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestion du produit
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.ProductId), ct);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
product = new Product()
|
||||||
|
{
|
||||||
|
Reference = req.ProductReferences,
|
||||||
|
Name = req.ProductName,
|
||||||
|
Duration = req.ProductDuration,
|
||||||
|
Caliber = req.ProductCaliber,
|
||||||
|
ApprovalNumber = req.ProductApprovalNumber,
|
||||||
|
Weight = req.ProductWeight,
|
||||||
|
Nec = req.ProductNec,
|
||||||
|
Image = req.ProductImage,
|
||||||
|
Link = req.ProductLink,
|
||||||
|
MinimalQuantity = req.ProductMinimalQuantity
|
||||||
|
};
|
||||||
|
await productsRepository.AddAsync(product, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vérifie si le prix existe déjà pour ce fournisseur et produit
|
||||||
|
Price? existingPrice = await pricesRepository.FirstOrDefaultAsync(new GetPriceByProductIdAndSupplierIdSpec(req.ProductId, req.SupplierId), ct);
|
||||||
|
|
||||||
|
if (existingPrice != null)
|
||||||
|
{
|
||||||
|
await Send.StringAsync("Le fournisseur a déjà un prix pour ce produit.", 400, cancellation: ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Création du prix
|
||||||
|
var priceAdded = new Price()
|
||||||
|
{
|
||||||
|
SellingPrice = req.SellingPrice,
|
||||||
|
SupplierId = supplier.Id,
|
||||||
|
ProductId = product.Id
|
||||||
|
};
|
||||||
|
await pricesRepository.AddAsync(priceAdded, ct);
|
||||||
|
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPriceDto>(priceAdded), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
PyroFetes/Endpoints/Prices/DeletePriceEndpoint.cs
Normal file
37
PyroFetes/Endpoints/Prices/DeletePriceEndpoint.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Prices;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Prices;
|
||||||
|
|
||||||
|
public class DeletePriceRequest
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int SupplierId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeletePriceEndpoint(PricesRepository pricesRepository) : Endpoint<DeletePriceRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/prices/{@ProductId}/{@SupplierId}", x => new {x.ProductId, x.SupplierId});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeletePriceRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Price? price = await pricesRepository.FirstOrDefaultAsync(new GetPriceByProductIdAndSupplierIdSpec(req.ProductId,req.SupplierId), ct);
|
||||||
|
|
||||||
|
if (price == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await pricesRepository.DeleteAsync(price, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Prices/PatchPriceEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Prices/PatchPriceEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Price.Request;
|
||||||
|
using PyroFetes.DTO.Price.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Prices;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Prices;
|
||||||
|
|
||||||
|
public class PatchPriceEndpoint(
|
||||||
|
PricesRepository pricesRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchPriceSellingPriceDto, GetPriceDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/prices/{@ProductId}/{@SupplierId}/SellingPrice", x => new { x.ProductId, x.SupplierId });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchPriceSellingPriceDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Price? price = await pricesRepository.FirstOrDefaultAsync(new GetPriceByProductIdAndSupplierIdSpec(req.ProductId, req.SupplierId),ct);
|
||||||
|
|
||||||
|
if (price == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
price.SellingPrice = req.SellingPrice;
|
||||||
|
|
||||||
|
await pricesRepository.UpdateAsync(price, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPriceDto>(price), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
PyroFetes/Endpoints/Products/GetAllProductsEndpoint.cs
Normal file
21
PyroFetes/Endpoints/Products/GetAllProductsEndpoint.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Products;
|
||||||
|
|
||||||
|
public class GetAllProductsEndpoint(ProductsRepository productsRepository) : EndpointWithoutRequest<List<GetProductDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/products");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await Send.OkAsync(await productsRepository.ProjectToListAsync<GetProductDto>(ct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
PyroFetes/Endpoints/Products/GetProductEndpoint.cs
Normal file
37
PyroFetes/Endpoints/Products/GetProductEndpoint.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Products;
|
||||||
|
|
||||||
|
public class GetProductRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetProductEndpoint(
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetProductRequest, GetProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/products/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetProductDto>(product), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Products;
|
||||||
|
|
||||||
|
public class PatchProductMinimalStockEndpoint(
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchProductMinimalStockDto, GetProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/products/{@Id}/MinimalStock", x => new { x.Id });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchProductMinimalStockDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
product.MinimalQuantity = req.MinimalQuantity;
|
||||||
|
await productsRepository.UpdateAsync(product, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetProductDto>(product), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
46
PyroFetes/Endpoints/Products/UpdateProductEndpoint.cs
Normal file
46
PyroFetes/Endpoints/Products/UpdateProductEndpoint.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Products;
|
||||||
|
|
||||||
|
public class UpdateProductEndpoint(
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<UpdateProductDto, GetProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Put("/products/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
product.Reference = req.References;
|
||||||
|
product.Name = req.Name;
|
||||||
|
product.Duration = req.Duration;
|
||||||
|
product.Caliber = req.Caliber;
|
||||||
|
product.ApprovalNumber = req.ApprovalNumber;
|
||||||
|
product.Weight = req.Weight;
|
||||||
|
product.Nec = req.Nec;
|
||||||
|
product.Image = req.Image;
|
||||||
|
product.Link = req.Link;
|
||||||
|
product.MinimalQuantity = req.MinimalQuantity;
|
||||||
|
|
||||||
|
await productsRepository.UpdateAsync(product, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetProductDto>(product), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.PurchaseOrders;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseOrders;
|
||||||
|
|
||||||
|
public class DeletePurchaseOrderRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeletePurchaseOrderEndpoint(
|
||||||
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
|
PurchaseProductsRepository purchaseProductsRepository) : Endpoint<DeletePurchaseOrderRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/purchaseOrders/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeletePurchaseOrderRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.FirstOrDefaultAsync(new GetPurchaseOrderByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (purchaseOrder == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (purchaseOrder.PurchaseProducts != null && purchaseOrder.PurchaseProducts.Any())
|
||||||
|
{
|
||||||
|
await purchaseProductsRepository.DeleteRangeAsync(purchaseOrder.PurchaseProducts, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
await purchaseOrdersRepository.DeleteAsync(purchaseOrder, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Response;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseOrders;
|
||||||
|
|
||||||
|
public class GetAllPurchaseOrderEndpoint(PurchaseOrdersRepository purchaseOrdersRepository) : EndpointWithoutRequest<List<GetPurchaseOrderDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/purchaseOrders");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await Send.OkAsync(await purchaseOrdersRepository.ProjectToListAsync<GetPurchaseOrderDto>(ct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Response;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.PurchaseOrders;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseOrders;
|
||||||
|
|
||||||
|
public class GetPurchaseOrderRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetPurchaseOrderEndpoint(
|
||||||
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetPurchaseOrderRequest, GetPurchaseOrderDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/purchaseOrders/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetPurchaseOrderRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.FirstOrDefaultAsync(new GetPurchaseOrderByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (purchaseOrder == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPurchaseOrderDto>(purchaseOrder), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Request;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Response;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.PurchaseOrders;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseOrders;
|
||||||
|
|
||||||
|
public class PatchPurchaseOrderPurchaseConditionsEndpoint(
|
||||||
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchPurchaseOrderPurchaseConditionsDto, GetPurchaseOrderDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/purchaseOrders/{@Id}/PurchaseConditions", x => new { x.Id });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchPurchaseOrderPurchaseConditionsDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.FirstOrDefaultAsync(new GetPurchaseOrderByIdSpec(req.Id), ct);
|
||||||
|
if (purchaseOrder == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
purchaseOrder.PurchaseConditions = req.PurchaseConditions;
|
||||||
|
await purchaseOrdersRepository.UpdateAsync(purchaseOrder, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPurchaseOrderDto>(purchaseOrder), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
using PyroFetes.Specifications.PurchaseOrders;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseProducts;
|
||||||
|
|
||||||
|
public class CreatePurchaseProductEndpoint(
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
|
PurchaseProductsRepository purchaseProductsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreatePurchaseProductDto, GetPurchaseProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/purchaseProducts");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreatePurchaseProductDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.ProductId), ct);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PurchaseOrder? purchaseOrder =
|
||||||
|
await purchaseOrdersRepository.FirstOrDefaultAsync(new GetPurchaseOrderByIdSpec(req.PurchaseOrderId), ct);
|
||||||
|
|
||||||
|
if (purchaseOrder == null)
|
||||||
|
{
|
||||||
|
purchaseOrder = new PurchaseOrder()
|
||||||
|
{
|
||||||
|
PurchaseConditions = req.PurchaseOrderPurchaseConditions ?? "Conditions non précisées"
|
||||||
|
};
|
||||||
|
await purchaseOrdersRepository.AddAsync(purchaseOrder, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
PurchaseProduct purchaseProduct = new PurchaseProduct()
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
PurchaseOrderId = purchaseOrder.Id,
|
||||||
|
Quantity = req.Quantity
|
||||||
|
};
|
||||||
|
|
||||||
|
await purchaseProductsRepository.AddAsync(purchaseProduct, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPurchaseProductDto>(purchaseProduct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.PurchaseProducts;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseProducts;
|
||||||
|
|
||||||
|
public class DeletePurchaseProductRequest
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int PurchaseOrderId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeletePurchaseProductEndpoint(PurchaseProductsRepository purchaseProductsRepository) : Endpoint<DeletePurchaseProductRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/purchaseProducts/{@ProductId}/{@PurchaseOrderId}", x => new {x.ProductId, x.PurchaseOrderId});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeletePurchaseProductRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseProduct? purchaseProduct = await purchaseProductsRepository.FirstOrDefaultAsync(
|
||||||
|
new GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(req.ProductId, req.PurchaseOrderId), ct);
|
||||||
|
|
||||||
|
if (purchaseProduct == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await purchaseProductsRepository.DeleteAsync(purchaseProduct, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.PurchaseProducts;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseProducts;
|
||||||
|
|
||||||
|
public class PatchPurchaseProductQuantityEndpoint(
|
||||||
|
PurchaseProductsRepository purchaseProductsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchPurchaseProductQuantityDto, GetPurchaseProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/purchaseProducts/{@ProductId}/{@PurchaseOrderId}/Quantity", x => new { x.ProductId, x.PurchaseOrderId });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchPurchaseProductQuantityDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseProduct? purchaseProduct =
|
||||||
|
await purchaseProductsRepository.FirstOrDefaultAsync(
|
||||||
|
new GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(req.ProductId, req.PurchaseOrderId), ct);
|
||||||
|
|
||||||
|
if (purchaseProduct == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
purchaseProduct.Quantity = req.Quantity;
|
||||||
|
await purchaseProductsRepository.UpdateAsync(purchaseProduct, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPurchaseProductDto>(purchaseProduct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.QuotationProducts;
|
||||||
|
|
||||||
|
public class CreateQuotationProductEndpoint(
|
||||||
|
QuotationProductsRepository quotationProductsRepository,
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
QuotationsRepository quotationsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreateQuotationProductDto, GetQuotationProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/quotationProducts");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreateQuotationProductDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.ProductId), ct);
|
||||||
|
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Quotation? quotation = await quotationsRepository.FirstOrDefaultAsync(new GetQuotationByIdSpec(req.QuotationId), ct);
|
||||||
|
|
||||||
|
if (quotation == null)
|
||||||
|
{
|
||||||
|
quotation = new Quotation()
|
||||||
|
{
|
||||||
|
Message = req.QuotationMessage ?? "",
|
||||||
|
ConditionsSale = req.QuotationConditionsSale,
|
||||||
|
};
|
||||||
|
|
||||||
|
await quotationsRepository.AddAsync(quotation, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
QuotationProduct quotationProduct = new QuotationProduct()
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
QuotationId = quotation.Id,
|
||||||
|
Quantity = req.Quantity
|
||||||
|
};
|
||||||
|
|
||||||
|
await quotationProductsRepository.AddAsync(quotationProduct, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetQuotationProductDto>(quotationProduct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.QuotationProducts;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.QuotationProducts;
|
||||||
|
|
||||||
|
public class DeleteQuotationProductRequest
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int QuotationId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteQuotationProductEndpoint(QuotationProductsRepository quotationProductsRepository) : Endpoint<DeleteQuotationProductRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/quotationProducts/{@ProductId}/{@QuotationId}", x => new {x.ProductId, x.QuotationId});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteQuotationProductRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
QuotationProduct? quotationProduct =
|
||||||
|
await quotationProductsRepository.FirstOrDefaultAsync(
|
||||||
|
new GetQuotationProductByProductIdAndQuotationIdSpec(req.ProductId, req.QuotationId), ct);
|
||||||
|
|
||||||
|
if (quotationProduct == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await quotationProductsRepository.DeleteAsync(quotationProduct, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.QuotationProducts;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.QuotationProducts;
|
||||||
|
|
||||||
|
public class PatchQuotationProductQuantityEndpoint(
|
||||||
|
QuotationProductsRepository quotationProductsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchQuotationProductQuantityDto, GetQuotationProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/quotationProducts/{@ProductId}/{@QuotationId}/Quantity", x => new { x.ProductId, x.QuotationId });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchQuotationProductQuantityDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
QuotationProduct? quotationProduct =
|
||||||
|
await quotationProductsRepository.FirstOrDefaultAsync(
|
||||||
|
new GetQuotationProductByProductIdAndQuotationIdSpec(req.ProductId, req.QuotationId), ct);
|
||||||
|
if (quotationProduct == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
quotationProduct.Quantity = req.Quantity;
|
||||||
|
await quotationProductsRepository.UpdateAsync(quotationProduct, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetQuotationProductDto>(quotationProduct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
43
PyroFetes/Endpoints/Quotations/DeleteQuotationEndpoint.cs
Normal file
43
PyroFetes/Endpoints/Quotations/DeleteQuotationEndpoint.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class DeleteQuotationRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteQuotationEndpoint(
|
||||||
|
QuotationsRepository quotationsRepository,
|
||||||
|
QuotationProductsRepository quotationProductsRepository) : Endpoint<DeleteQuotationRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/quotations/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteQuotationRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Quotation? quotation = await quotationsRepository.FirstOrDefaultAsync(new GetQuotationByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (quotation == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quotation.QuotationProducts != null && quotation.QuotationProducts.Any())
|
||||||
|
{
|
||||||
|
await quotationProductsRepository.DeleteRangeAsync(quotation.QuotationProducts, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
await quotationsRepository.DeleteAsync(quotation, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
PyroFetes/Endpoints/Quotations/GetAllQuotationEndpoint.cs
Normal file
22
PyroFetes/Endpoints/Quotations/GetAllQuotationEndpoint.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class GetAllQuotationEndpoint(QuotationsRepository quotationsRepository) : EndpointWithoutRequest<List<GetQuotationDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/quotations");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await Send.OkAsync(await quotationsRepository.ProjectToListAsync<GetQuotationDto>(ct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
38
PyroFetes/Endpoints/Quotations/GetQuotationEndpoint.cs
Normal file
38
PyroFetes/Endpoints/Quotations/GetQuotationEndpoint.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class GetQuotationRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetQuotationEndpoint(
|
||||||
|
QuotationsRepository quotationsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetQuotationRequest, GetQuotationDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/quotations/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetQuotationRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Quotation? quotation = await quotationsRepository.FirstOrDefaultAsync(new GetQuotationByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (quotation == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetQuotationDto>(quotation), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Quotation.Request;
|
||||||
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class PatchQuotationConditionsSaleEndpoint(
|
||||||
|
QuotationsRepository quotationsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchQuotationConditionsSaleDto, GetQuotationDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/quotations/{@Id}/saleConditions", x => new { x.Id });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchQuotationConditionsSaleDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Quotation? quotation = await quotationsRepository.FirstOrDefaultAsync(new GetQuotationByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (quotation == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
quotation.ConditionsSale = req.ConditionsSale;
|
||||||
|
await quotationsRepository.UpdateAsync(quotation, ct);
|
||||||
|
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetQuotationDto>(quotation), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
31
PyroFetes/Endpoints/Settings/CreateSettingEndpoint.cs
Normal file
31
PyroFetes/Endpoints/Settings/CreateSettingEndpoint.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Settings;
|
||||||
|
|
||||||
|
public class CreateSettingEndpoint(
|
||||||
|
SettingsRepository settingsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreateSettingDto, GetSettingDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/settings");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreateSettingDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Setting setting = new Setting()
|
||||||
|
{
|
||||||
|
ElectronicSignature = req.ElectronicSignature,
|
||||||
|
Logo = req.Logo
|
||||||
|
};
|
||||||
|
|
||||||
|
await settingsRepository.AddAsync(setting, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSettingDto>(setting), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Settings/DeleteSettingEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Settings/DeleteSettingEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Settings;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Settings;
|
||||||
|
|
||||||
|
public class DeleteSettingRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteSettingEndpoint(SettingsRepository settingsRepository) : Endpoint<DeleteSettingRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/settings/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteSettingRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Setting? setting = await settingsRepository.FirstOrDefaultAsync(new GetSettingByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (setting == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await settingsRepository.DeleteAsync(setting, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
PyroFetes/Endpoints/Settings/GetSettingEndpoint.cs
Normal file
37
PyroFetes/Endpoints/Settings/GetSettingEndpoint.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Settings;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Settings;
|
||||||
|
|
||||||
|
public class GetSettingRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetSettingEndpoint(
|
||||||
|
SettingsRepository settingsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetSettingRequest, GetSettingDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/settings/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetSettingRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Setting? setting = await settingsRepository.FirstOrDefaultAsync(new GetSettingByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (setting == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSettingDto>(setting), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Settings;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Settings;
|
||||||
|
|
||||||
|
public class PatchSettingElectronicSignatureEndpoint(
|
||||||
|
SettingsRepository settingsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchSettingElectronicSignatureDto, GetSettingDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/settings/{@Id}/ElectronicSignature", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchSettingElectronicSignatureDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Setting? setting = await settingsRepository.FirstOrDefaultAsync(new GetSettingByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (setting == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setting.ElectronicSignature = req.ElectronicSignature;
|
||||||
|
await settingsRepository.UpdateAsync(setting, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSettingDto>(setting), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Settings/PatchSettingLogoEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Settings/PatchSettingLogoEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Settings;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Settings;
|
||||||
|
|
||||||
|
public class PatchSettingLogoEndpoint(
|
||||||
|
SettingsRepository settingsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchSettingLogoDto, GetSettingDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/settings/{@Id}/logo", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchSettingLogoDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Setting? setting = await settingsRepository.FirstOrDefaultAsync(new GetSettingByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (setting == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setting.Logo = req.Logo;
|
||||||
|
await settingsRepository.UpdateAsync(setting, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSettingDto>(setting), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Suppliers/CreateSupplierEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Suppliers/CreateSupplierEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
|
public class CreateSupplierEndpoint(
|
||||||
|
SuppliersRepository suppliersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreateSupplierDto, GetSupplierDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/suppliers");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Supplier? supplier = new Supplier()
|
||||||
|
{
|
||||||
|
Name = req.Name,
|
||||||
|
Email = req.Email,
|
||||||
|
Phone = req.Phone,
|
||||||
|
Address = req.Address,
|
||||||
|
City = req.City,
|
||||||
|
ZipCode = req.ZipCode,
|
||||||
|
DeliveryDelay = req.DeliveryDelay
|
||||||
|
};
|
||||||
|
|
||||||
|
await suppliersRepository.AddAsync(supplier, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSupplierDto>(supplier), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Suppliers/DeleteSupplierEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Suppliers/DeleteSupplierEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Suppliers;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
|
public class DeleteSupplierRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteSupplierEndpoint(SuppliersRepository suppliersRepository) : Endpoint<DeleteSupplierRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/suppliers/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Supplier? supplier = await suppliersRepository.FirstOrDefaultAsync(new GetSupplierByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (supplier == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await suppliersRepository.DeleteAsync(supplier, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
PyroFetes/Endpoints/Suppliers/GetAllSuppliersEndpoint.cs
Normal file
20
PyroFetes/Endpoints/Suppliers/GetAllSuppliersEndpoint.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
|
public class GetAllSuppliersEndpoint(SuppliersRepository suppliersRepository) : EndpointWithoutRequest<List<GetSupplierDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/suppliers");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await Send.OkAsync(await suppliersRepository.ProjectToListAsync<GetSupplierDto>(ct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
PyroFetes/Endpoints/Suppliers/GetSupplierEndpoint.cs
Normal file
37
PyroFetes/Endpoints/Suppliers/GetSupplierEndpoint.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Suppliers;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
|
public class GetSupplierRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetSupplierEndpoint(
|
||||||
|
SuppliersRepository suppliersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetSupplierRequest, GetSupplierDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/suppliers/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Supplier? supplier = await suppliersRepository.FirstOrDefaultAsync(new GetSupplierByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (supplier == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSupplierDto>(supplier), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Suppliers;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
|
public class PatchSupplierDeliveryDelayEndpoint(
|
||||||
|
SuppliersRepository suppliersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchSupplierDeliveryDelayDto, GetSupplierDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/suppliers/{@Id}/deliveryDelay", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchSupplierDeliveryDelayDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Supplier? supplier = await suppliersRepository.FirstOrDefaultAsync(new GetSupplierByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (supplier == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
supplier.DeliveryDelay = req.DeliveryDelay;
|
||||||
|
await suppliersRepository.UpdateAsync(supplier, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSupplierDto>(supplier), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
43
PyroFetes/Endpoints/Suppliers/UpdateSupplierEndpoint.cs
Normal file
43
PyroFetes/Endpoints/Suppliers/UpdateSupplierEndpoint.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Suppliers;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
|
public class UpdateSupplierEndpoint(
|
||||||
|
SuppliersRepository suppliersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<UpdateSupplierDto, GetSupplierDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Put("/suppliers/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Supplier? supplier = await suppliersRepository.FirstOrDefaultAsync(new GetSupplierByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (supplier == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
supplier.Name = req.Name;
|
||||||
|
supplier.Email = req.Email;
|
||||||
|
supplier.Phone = req.Phone;
|
||||||
|
supplier.Address = req.Address;
|
||||||
|
supplier.City = req.City;
|
||||||
|
supplier.ZipCode = req.ZipCode;
|
||||||
|
supplier.DeliveryDelay = req.DeliveryDelay;
|
||||||
|
|
||||||
|
await suppliersRepository.UpdateAsync(supplier, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetSupplierDto>(supplier), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
51
PyroFetes/Endpoints/Users/ConnectUserEndpoint.cs
Normal file
51
PyroFetes/Endpoints/Users/ConnectUserEndpoint.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using FastEndpoints.Security;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class ConnectUserEndpoint(UsersRepository usersRepository) : Endpoint<ConnectUserDto, GetTokenDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/users/connection");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(ConnectUserDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByNameSpec(req.Name!), ct);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
await Send.UnauthorizedAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BCrypt.Net.BCrypt.Verify(req.Password + user.Salt, user.Password))
|
||||||
|
{
|
||||||
|
string jwtToken = JwtBearer.CreateToken(
|
||||||
|
o =>
|
||||||
|
{
|
||||||
|
o.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong";
|
||||||
|
o.ExpireAt = DateTime.UtcNow.AddMinutes(15);
|
||||||
|
if (user.Fonction != null) o.User.Roles.Add(user.Fonction);
|
||||||
|
o.User.Claims.Add(("Name", user.Name)!);
|
||||||
|
o.User.Claims.Add(("Id", user.Id.ToString())!);
|
||||||
|
});
|
||||||
|
|
||||||
|
GetTokenDto responseDto = new()
|
||||||
|
{
|
||||||
|
Token = jwtToken
|
||||||
|
};
|
||||||
|
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
else await Send.UnauthorizedAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
PyroFetes/Endpoints/Users/CreateUserEndpoint.cs
Normal file
37
PyroFetes/Endpoints/Users/CreateUserEndpoint.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PasswordGenerator;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class CreateUserEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreateUserDto, GetUserDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/users");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreateUserDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
||||||
|
|
||||||
|
User user = new User()
|
||||||
|
{
|
||||||
|
Name = req.Name,
|
||||||
|
Password = BCrypt.Net.BCrypt.HashPassword(req.Password + salt),
|
||||||
|
Salt = salt,
|
||||||
|
Email = req.Email,
|
||||||
|
Fonction = req.Fonction
|
||||||
|
};
|
||||||
|
|
||||||
|
await usersRepository.AddAsync(user, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Users/DeleteUserEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Users/DeleteUserEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class DeleteUserRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteUserEndpoint(UsersRepository usersRepository) : Endpoint<DeleteUserRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/users/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await usersRepository.DeleteAsync(user, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
PyroFetes/Endpoints/Users/GetAllUsersEndpoint.cs
Normal file
20
PyroFetes/Endpoints/Users/GetAllUsersEndpoint.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class GetAllUsersEndpoint(UsersRepository usersRepository) : EndpointWithoutRequest<List<GetUserDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/users");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await Send.OkAsync(await usersRepository.ProjectToListAsync<GetUserDto>(ct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
PyroFetes/Endpoints/Users/GetUserEndpoint.cs
Normal file
37
PyroFetes/Endpoints/Users/GetUserEndpoint.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class GetUserRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetUserEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetUserRequest, GetUserDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/users/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetUserRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
PyroFetes/Endpoints/Users/PatchUserPasswordEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Users/PatchUserPasswordEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class PatchUserPasswordEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchUserPasswordDto, GetUserDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/users/{@Id}/password", x => new { x.Id });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchUserPasswordDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.Password = BCrypt.Net.BCrypt.HashPassword(req.Password + user.Salt);
|
||||||
|
await usersRepository.UpdateAsync(user, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
51
PyroFetes/Endpoints/Users/UpdateUserEndpoint.cs
Normal file
51
PyroFetes/Endpoints/Users/UpdateUserEndpoint.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PasswordGenerator;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
|
public class UpdateUserEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<UpdateUserDto, GetUserDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Put("/users/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(UpdateUserDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
|
User? ckeckName = await usersRepository.FirstOrDefaultAsync(new GetUserByNameSpec(req.Name!), ct);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ckeckName != null)
|
||||||
|
{
|
||||||
|
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
||||||
|
|
||||||
|
user.Name = req.Name;
|
||||||
|
user.Password = BCrypt.Net.BCrypt.HashPassword(req.Password + salt);
|
||||||
|
user.Salt = salt;
|
||||||
|
user.Email = req.Email;
|
||||||
|
user.Fonction = req.Fonction;
|
||||||
|
|
||||||
|
await usersRepository.UpdateAsync(user, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.WarehouseProducts;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.WareHouseProducts;
|
||||||
|
|
||||||
|
public class GetTotalQuantityRequest
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetTotalQuantityEndpoint(
|
||||||
|
WarehouseProductsRepository warehouseProductsRepository) : Endpoint<GetTotalQuantityRequest, GetTotalQuantityDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/wareHouseProducts/{@ProductId}", x => new { x.ProductId });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetTotalQuantityRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
bool exists = await warehouseProductsRepository.AnyAsync(new GetWarehouseProductByProductIdSpec(req.ProductId), ct);
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalQuantity =
|
||||||
|
await warehouseProductsRepository.SumAsync(new GetProductTotalQuantitySpec(req.ProductId),
|
||||||
|
wp => wp.Quantity, ct);
|
||||||
|
|
||||||
|
GetTotalQuantityDto responseDto = new()
|
||||||
|
{
|
||||||
|
ProductId = req.ProductId,
|
||||||
|
TotalQuantity = totalQuantity
|
||||||
|
};
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.DTO.WareHouseProduct.Request;
|
||||||
|
using PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.WareHouseProducts;
|
||||||
|
|
||||||
|
public class PatchWareHouseProductQuantityEndpoint(PyroFetesDbContext database)
|
||||||
|
: Endpoint<PatchWareHouseProductQuantityDto, GetWareHouseProductDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Patch("/wareHouseProducts/{@ProductId}/{@WareHouseId}/quantity", x => new { x.ProductId, x.WareHouseId });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(PatchWareHouseProductQuantityDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
WarehouseProduct? wareHouseProduct =
|
||||||
|
await database.WarehouseProducts.SingleOrDefaultAsync(
|
||||||
|
wp => wp.ProductId == req.ProductId && wp.WarehouseId == req.WareHouseId, ct);
|
||||||
|
|
||||||
|
if (wareHouseProduct == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wareHouseProduct.Quantity = req.Quantity;
|
||||||
|
await database.SaveChangesAsync(ct);
|
||||||
|
|
||||||
|
GetWareHouseProductDto responseDto = new()
|
||||||
|
{
|
||||||
|
ProductId = wareHouseProduct.ProductId,
|
||||||
|
WareHouseId = wareHouseProduct.WarehouseId,
|
||||||
|
Quantity = wareHouseProduct.Quantity
|
||||||
|
};
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
68
PyroFetes/MappingProfiles/DtoToEntityMappings.cs
Normal file
68
PyroFetes/MappingProfiles/DtoToEntityMappings.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using PyroFetes.DTO.Deliverer.Request;
|
||||||
|
using PyroFetes.DTO.DeliveryNote.Request;
|
||||||
|
using PyroFetes.DTO.Price.Request;
|
||||||
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
using PyroFetes.DTO.ProductDelivery.Request;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Request;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
using PyroFetes.DTO.Quotation.Request;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Request;
|
||||||
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
|
using PyroFetes.DTO.User.Request;
|
||||||
|
using PyroFetes.DTO.WareHouseProduct.Request;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
|
namespace PyroFetes.MappingProfiles;
|
||||||
|
|
||||||
|
public class DtoToEntityMappings : Profile
|
||||||
|
{
|
||||||
|
public DtoToEntityMappings()
|
||||||
|
{
|
||||||
|
CreateMap<CreateDelivererDto, Deliverer>();
|
||||||
|
CreateMap<UpdateDelivererDto, Deliverer>();
|
||||||
|
|
||||||
|
CreateMap<CreateDeliveryNoteDto, DeliveryNote>();
|
||||||
|
CreateMap<UpdateDeliveryNoteDto, DeliveryNote>();
|
||||||
|
CreateMap<PatchDeliveryNoteRealDeliveryDateDto, DeliveryNote>();
|
||||||
|
|
||||||
|
CreateMap<CreatePriceDto, Price>();
|
||||||
|
CreateMap<UpdatePriceDto, Price>();
|
||||||
|
CreateMap<PatchPriceSellingPriceDto, Price>();
|
||||||
|
|
||||||
|
CreateMap<CreateProductDto, Product>();
|
||||||
|
CreateMap<UpdateProductDto, Product>();
|
||||||
|
CreateMap<PatchProductMinimalStockDto, Product>();
|
||||||
|
|
||||||
|
CreateMap<CreateProductDeliveryDto, ProductDelivery>();
|
||||||
|
CreateMap<UpdateProductDeliveryDto, ProductDelivery>();
|
||||||
|
|
||||||
|
CreateMap<PatchPurchaseOrderPurchaseConditionsDto,PurchaseOrder>();
|
||||||
|
|
||||||
|
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
|
||||||
|
CreateMap<UpdatePurchaseProductDto, PurchaseProduct>();
|
||||||
|
CreateMap<PatchPurchaseProductQuantityDto, PurchaseProduct>();
|
||||||
|
|
||||||
|
CreateMap<PatchQuotationConditionsSaleDto, Quotation>();
|
||||||
|
CreateMap<PatchQuotationMessageDto, Quotation>();
|
||||||
|
|
||||||
|
CreateMap<CreateQuotationProductDto, QuotationProduct>();
|
||||||
|
CreateMap<UpdateQuotationProductDto, QuotationProduct>();
|
||||||
|
CreateMap<PatchQuotationProductQuantityDto, QuotationProduct>();
|
||||||
|
|
||||||
|
CreateMap<CreateSettingDto, Setting>();
|
||||||
|
CreateMap<PatchSettingElectronicSignatureDto, Setting>();
|
||||||
|
CreateMap<PatchSettingLogoDto, Setting>();
|
||||||
|
|
||||||
|
CreateMap<CreateSupplierDto, Supplier>();
|
||||||
|
CreateMap<UpdateSupplierDto, Supplier>();
|
||||||
|
CreateMap<PatchSupplierDeliveryDelayDto, Supplier>();
|
||||||
|
|
||||||
|
CreateMap<CreateUserDto, User>();
|
||||||
|
CreateMap<UpdateUserDto, User>();
|
||||||
|
CreateMap<PatchUserPasswordDto, User>();
|
||||||
|
|
||||||
|
CreateMap<PatchWareHouseProductQuantityDto, WarehouseProduct>();
|
||||||
|
}
|
||||||
|
}
|
||||||
46
PyroFetes/MappingProfiles/EntityToDtoMappings.cs
Normal file
46
PyroFetes/MappingProfiles/EntityToDtoMappings.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using PyroFetes.DTO.Deliverer.Response;
|
||||||
|
using PyroFetes.DTO.DeliveryNote.Response;
|
||||||
|
using PyroFetes.DTO.Price.Response;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using PyroFetes.DTO.ProductDelivery.Response;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Response;
|
||||||
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||||
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
|
using PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
|
namespace PyroFetes.MappingProfiles;
|
||||||
|
|
||||||
|
public class EntityToDtoMappings : Profile
|
||||||
|
{
|
||||||
|
public EntityToDtoMappings()
|
||||||
|
{
|
||||||
|
CreateMap<Deliverer, GetDelivererDto>();
|
||||||
|
|
||||||
|
CreateMap<DeliveryNote, GetDeliveryNoteDto>();
|
||||||
|
|
||||||
|
CreateMap<Price, GetPriceDto>();
|
||||||
|
|
||||||
|
CreateMap<Product, GetProductDto>();
|
||||||
|
|
||||||
|
CreateMap<ProductDelivery, GetProductDeliveryDto>();
|
||||||
|
|
||||||
|
CreateMap<PurchaseOrder, GetPurchaseOrderDto>();
|
||||||
|
|
||||||
|
CreateMap<PurchaseProduct, GetPurchaseProductDto>();
|
||||||
|
|
||||||
|
CreateMap<Quotation, GetQuotationDto>();
|
||||||
|
|
||||||
|
CreateMap<QuotationProduct, GetQuotationProductDto>();
|
||||||
|
|
||||||
|
CreateMap<Setting, GetSettingDto>();
|
||||||
|
|
||||||
|
CreateMap<User, GetUserDto>();
|
||||||
|
|
||||||
|
CreateMap<WarehouseProduct, GetWareHouseProductDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
1963
PyroFetes/Migrations/20251013175653_AddingEntitiesInDatabase.Designer.cs
generated
Normal file
1963
PyroFetes/Migrations/20251013175653_AddingEntitiesInDatabase.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
755
PyroFetes/Migrations/20251013175653_AddingEntitiesInDatabase.cs
Normal file
755
PyroFetes/Migrations/20251013175653_AddingEntitiesInDatabase.cs
Normal file
@@ -0,0 +1,755 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PyroFetes.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddingEntitiesInDatabase : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ContactServiceProvider_Contacts_ContactId",
|
||||||
|
table: "ContactServiceProvider");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ContactServiceProvider_Providers_ServiceProviderId",
|
||||||
|
table: "ContactServiceProvider");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Contract_Providers_ServiceProviderId",
|
||||||
|
table: "Contract");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Contract_Shows_ShowId",
|
||||||
|
table: "Contract");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MaterialWarehouse_Materials_MaterialId",
|
||||||
|
table: "MaterialWarehouse");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MaterialWarehouse_Warehouses_WarehouseId",
|
||||||
|
table: "MaterialWarehouse");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ProductTimecode_Products_ProductId",
|
||||||
|
table: "ProductTimecode");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ProductTimecode_Shows_ShowId",
|
||||||
|
table: "ProductTimecode");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ProviderContacts_Providers_ProviderId",
|
||||||
|
table: "ProviderContacts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Providers_ProviderTypes_ProviderTypeId",
|
||||||
|
table: "Providers");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowMaterial_Materials_MaterialId",
|
||||||
|
table: "ShowMaterial");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowMaterial_Shows_ShowId",
|
||||||
|
table: "ShowMaterial");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Shows_City_CityId",
|
||||||
|
table: "Shows");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowStaff_Shows_ShowId",
|
||||||
|
table: "ShowStaff");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowStaff_Staffs_StaffId",
|
||||||
|
table: "ShowStaff");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowTruck_Shows_ShowId",
|
||||||
|
table: "ShowTruck");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowTruck_Trucks_TruckId",
|
||||||
|
table: "ShowTruck");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ShowTruck",
|
||||||
|
table: "ShowTruck");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ShowStaff",
|
||||||
|
table: "ShowStaff");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ShowMaterial",
|
||||||
|
table: "ShowMaterial");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_Providers",
|
||||||
|
table: "Providers");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ProductTimecode",
|
||||||
|
table: "ProductTimecode");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_MaterialWarehouse",
|
||||||
|
table: "MaterialWarehouse");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_Contract",
|
||||||
|
table: "Contract");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ContactServiceProvider",
|
||||||
|
table: "ContactServiceProvider");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_City",
|
||||||
|
table: "City");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ShowTruck",
|
||||||
|
newName: "ShowTrucks");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ShowStaff",
|
||||||
|
newName: "ShowStaffs");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ShowMaterial",
|
||||||
|
newName: "ShowMaterials");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Providers",
|
||||||
|
newName: "ServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ProductTimecode",
|
||||||
|
newName: "ProductTimecodes");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "MaterialWarehouse",
|
||||||
|
newName: "MaterialWarehouses");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Contract",
|
||||||
|
newName: "Contracts");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ContactServiceProvider",
|
||||||
|
newName: "ContactServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "City",
|
||||||
|
newName: "Cities");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShowTruck_TruckId",
|
||||||
|
table: "ShowTrucks",
|
||||||
|
newName: "IX_ShowTrucks_TruckId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShowStaff_ShowId",
|
||||||
|
table: "ShowStaffs",
|
||||||
|
newName: "IX_ShowStaffs_ShowId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShowMaterial_MaterialId",
|
||||||
|
table: "ShowMaterials",
|
||||||
|
newName: "IX_ShowMaterials_MaterialId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_Providers_ProviderTypeId",
|
||||||
|
table: "ServiceProviders",
|
||||||
|
newName: "IX_ServiceProviders_ProviderTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ProductTimecode_ShowId",
|
||||||
|
table: "ProductTimecodes",
|
||||||
|
newName: "IX_ProductTimecodes_ShowId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_MaterialWarehouse_WarehouseId",
|
||||||
|
table: "MaterialWarehouses",
|
||||||
|
newName: "IX_MaterialWarehouses_WarehouseId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_Contract_ServiceProviderId",
|
||||||
|
table: "Contracts",
|
||||||
|
newName: "IX_Contracts_ServiceProviderId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ContactServiceProvider_ServiceProviderId",
|
||||||
|
table: "ContactServiceProviders",
|
||||||
|
newName: "IX_ContactServiceProviders_ServiceProviderId");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ShowTrucks",
|
||||||
|
table: "ShowTrucks",
|
||||||
|
columns: new[] { "ShowId", "TruckId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ShowStaffs",
|
||||||
|
table: "ShowStaffs",
|
||||||
|
columns: new[] { "StaffId", "ShowId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ShowMaterials",
|
||||||
|
table: "ShowMaterials",
|
||||||
|
columns: new[] { "ShowId", "MaterialId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ServiceProviders",
|
||||||
|
table: "ServiceProviders",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ProductTimecodes",
|
||||||
|
table: "ProductTimecodes",
|
||||||
|
columns: new[] { "ProductId", "ShowId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_MaterialWarehouses",
|
||||||
|
table: "MaterialWarehouses",
|
||||||
|
columns: new[] { "MaterialId", "WarehouseId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_Contracts",
|
||||||
|
table: "Contracts",
|
||||||
|
columns: new[] { "ShowId", "ServiceProviderId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ContactServiceProviders",
|
||||||
|
table: "ContactServiceProviders",
|
||||||
|
columns: new[] { "ContactId", "ServiceProviderId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_Cities",
|
||||||
|
table: "Cities",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShowServiceProviders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShowServiceProviders", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ContactServiceProviders_Contacts_ContactId",
|
||||||
|
table: "ContactServiceProviders",
|
||||||
|
column: "ContactId",
|
||||||
|
principalTable: "Contacts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ContactServiceProviders_ServiceProviders_ServiceProviderId",
|
||||||
|
table: "ContactServiceProviders",
|
||||||
|
column: "ServiceProviderId",
|
||||||
|
principalTable: "ServiceProviders",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Contracts_ServiceProviders_ServiceProviderId",
|
||||||
|
table: "Contracts",
|
||||||
|
column: "ServiceProviderId",
|
||||||
|
principalTable: "ServiceProviders",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Contracts_Shows_ShowId",
|
||||||
|
table: "Contracts",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MaterialWarehouses_Materials_MaterialId",
|
||||||
|
table: "MaterialWarehouses",
|
||||||
|
column: "MaterialId",
|
||||||
|
principalTable: "Materials",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MaterialWarehouses_Warehouses_WarehouseId",
|
||||||
|
table: "MaterialWarehouses",
|
||||||
|
column: "WarehouseId",
|
||||||
|
principalTable: "Warehouses",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProductTimecodes_Products_ProductId",
|
||||||
|
table: "ProductTimecodes",
|
||||||
|
column: "ProductId",
|
||||||
|
principalTable: "Products",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProductTimecodes_Shows_ShowId",
|
||||||
|
table: "ProductTimecodes",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProviderContacts_ServiceProviders_ProviderId",
|
||||||
|
table: "ProviderContacts",
|
||||||
|
column: "ProviderId",
|
||||||
|
principalTable: "ServiceProviders",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ServiceProviders_ProviderTypes_ProviderTypeId",
|
||||||
|
table: "ServiceProviders",
|
||||||
|
column: "ProviderTypeId",
|
||||||
|
principalTable: "ProviderTypes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowMaterials_Materials_MaterialId",
|
||||||
|
table: "ShowMaterials",
|
||||||
|
column: "MaterialId",
|
||||||
|
principalTable: "Materials",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowMaterials_Shows_ShowId",
|
||||||
|
table: "ShowMaterials",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Shows_Cities_CityId",
|
||||||
|
table: "Shows",
|
||||||
|
column: "CityId",
|
||||||
|
principalTable: "Cities",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowStaffs_Shows_ShowId",
|
||||||
|
table: "ShowStaffs",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowStaffs_Staffs_StaffId",
|
||||||
|
table: "ShowStaffs",
|
||||||
|
column: "StaffId",
|
||||||
|
principalTable: "Staffs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowTrucks_Shows_ShowId",
|
||||||
|
table: "ShowTrucks",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowTrucks_Trucks_TruckId",
|
||||||
|
table: "ShowTrucks",
|
||||||
|
column: "TruckId",
|
||||||
|
principalTable: "Trucks",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ContactServiceProviders_Contacts_ContactId",
|
||||||
|
table: "ContactServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ContactServiceProviders_ServiceProviders_ServiceProviderId",
|
||||||
|
table: "ContactServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Contracts_ServiceProviders_ServiceProviderId",
|
||||||
|
table: "Contracts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Contracts_Shows_ShowId",
|
||||||
|
table: "Contracts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MaterialWarehouses_Materials_MaterialId",
|
||||||
|
table: "MaterialWarehouses");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MaterialWarehouses_Warehouses_WarehouseId",
|
||||||
|
table: "MaterialWarehouses");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ProductTimecodes_Products_ProductId",
|
||||||
|
table: "ProductTimecodes");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ProductTimecodes_Shows_ShowId",
|
||||||
|
table: "ProductTimecodes");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ProviderContacts_ServiceProviders_ProviderId",
|
||||||
|
table: "ProviderContacts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ServiceProviders_ProviderTypes_ProviderTypeId",
|
||||||
|
table: "ServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowMaterials_Materials_MaterialId",
|
||||||
|
table: "ShowMaterials");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowMaterials_Shows_ShowId",
|
||||||
|
table: "ShowMaterials");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Shows_Cities_CityId",
|
||||||
|
table: "Shows");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowStaffs_Shows_ShowId",
|
||||||
|
table: "ShowStaffs");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowStaffs_Staffs_StaffId",
|
||||||
|
table: "ShowStaffs");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowTrucks_Shows_ShowId",
|
||||||
|
table: "ShowTrucks");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShowTrucks_Trucks_TruckId",
|
||||||
|
table: "ShowTrucks");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShowServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ShowTrucks",
|
||||||
|
table: "ShowTrucks");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ShowStaffs",
|
||||||
|
table: "ShowStaffs");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ShowMaterials",
|
||||||
|
table: "ShowMaterials");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ServiceProviders",
|
||||||
|
table: "ServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ProductTimecodes",
|
||||||
|
table: "ProductTimecodes");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_MaterialWarehouses",
|
||||||
|
table: "MaterialWarehouses");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_Contracts",
|
||||||
|
table: "Contracts");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_ContactServiceProviders",
|
||||||
|
table: "ContactServiceProviders");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_Cities",
|
||||||
|
table: "Cities");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ShowTrucks",
|
||||||
|
newName: "ShowTruck");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ShowStaffs",
|
||||||
|
newName: "ShowStaff");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ShowMaterials",
|
||||||
|
newName: "ShowMaterial");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ServiceProviders",
|
||||||
|
newName: "Providers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ProductTimecodes",
|
||||||
|
newName: "ProductTimecode");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "MaterialWarehouses",
|
||||||
|
newName: "MaterialWarehouse");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Contracts",
|
||||||
|
newName: "Contract");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "ContactServiceProviders",
|
||||||
|
newName: "ContactServiceProvider");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Cities",
|
||||||
|
newName: "City");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShowTrucks_TruckId",
|
||||||
|
table: "ShowTruck",
|
||||||
|
newName: "IX_ShowTruck_TruckId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShowStaffs_ShowId",
|
||||||
|
table: "ShowStaff",
|
||||||
|
newName: "IX_ShowStaff_ShowId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShowMaterials_MaterialId",
|
||||||
|
table: "ShowMaterial",
|
||||||
|
newName: "IX_ShowMaterial_MaterialId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ServiceProviders_ProviderTypeId",
|
||||||
|
table: "Providers",
|
||||||
|
newName: "IX_Providers_ProviderTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ProductTimecodes_ShowId",
|
||||||
|
table: "ProductTimecode",
|
||||||
|
newName: "IX_ProductTimecode_ShowId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_MaterialWarehouses_WarehouseId",
|
||||||
|
table: "MaterialWarehouse",
|
||||||
|
newName: "IX_MaterialWarehouse_WarehouseId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_Contracts_ServiceProviderId",
|
||||||
|
table: "Contract",
|
||||||
|
newName: "IX_Contract_ServiceProviderId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ContactServiceProviders_ServiceProviderId",
|
||||||
|
table: "ContactServiceProvider",
|
||||||
|
newName: "IX_ContactServiceProvider_ServiceProviderId");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ShowTruck",
|
||||||
|
table: "ShowTruck",
|
||||||
|
columns: new[] { "ShowId", "TruckId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ShowStaff",
|
||||||
|
table: "ShowStaff",
|
||||||
|
columns: new[] { "StaffId", "ShowId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ShowMaterial",
|
||||||
|
table: "ShowMaterial",
|
||||||
|
columns: new[] { "ShowId", "MaterialId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_Providers",
|
||||||
|
table: "Providers",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ProductTimecode",
|
||||||
|
table: "ProductTimecode",
|
||||||
|
columns: new[] { "ProductId", "ShowId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_MaterialWarehouse",
|
||||||
|
table: "MaterialWarehouse",
|
||||||
|
columns: new[] { "MaterialId", "WarehouseId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_Contract",
|
||||||
|
table: "Contract",
|
||||||
|
columns: new[] { "ShowId", "ServiceProviderId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_ContactServiceProvider",
|
||||||
|
table: "ContactServiceProvider",
|
||||||
|
columns: new[] { "ContactId", "ServiceProviderId" });
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_City",
|
||||||
|
table: "City",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ContactServiceProvider_Contacts_ContactId",
|
||||||
|
table: "ContactServiceProvider",
|
||||||
|
column: "ContactId",
|
||||||
|
principalTable: "Contacts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ContactServiceProvider_Providers_ServiceProviderId",
|
||||||
|
table: "ContactServiceProvider",
|
||||||
|
column: "ServiceProviderId",
|
||||||
|
principalTable: "Providers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Contract_Providers_ServiceProviderId",
|
||||||
|
table: "Contract",
|
||||||
|
column: "ServiceProviderId",
|
||||||
|
principalTable: "Providers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Contract_Shows_ShowId",
|
||||||
|
table: "Contract",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MaterialWarehouse_Materials_MaterialId",
|
||||||
|
table: "MaterialWarehouse",
|
||||||
|
column: "MaterialId",
|
||||||
|
principalTable: "Materials",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MaterialWarehouse_Warehouses_WarehouseId",
|
||||||
|
table: "MaterialWarehouse",
|
||||||
|
column: "WarehouseId",
|
||||||
|
principalTable: "Warehouses",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProductTimecode_Products_ProductId",
|
||||||
|
table: "ProductTimecode",
|
||||||
|
column: "ProductId",
|
||||||
|
principalTable: "Products",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProductTimecode_Shows_ShowId",
|
||||||
|
table: "ProductTimecode",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProviderContacts_Providers_ProviderId",
|
||||||
|
table: "ProviderContacts",
|
||||||
|
column: "ProviderId",
|
||||||
|
principalTable: "Providers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Providers_ProviderTypes_ProviderTypeId",
|
||||||
|
table: "Providers",
|
||||||
|
column: "ProviderTypeId",
|
||||||
|
principalTable: "ProviderTypes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowMaterial_Materials_MaterialId",
|
||||||
|
table: "ShowMaterial",
|
||||||
|
column: "MaterialId",
|
||||||
|
principalTable: "Materials",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowMaterial_Shows_ShowId",
|
||||||
|
table: "ShowMaterial",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Shows_City_CityId",
|
||||||
|
table: "Shows",
|
||||||
|
column: "CityId",
|
||||||
|
principalTable: "City",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowStaff_Shows_ShowId",
|
||||||
|
table: "ShowStaff",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowStaff_Staffs_StaffId",
|
||||||
|
table: "ShowStaff",
|
||||||
|
column: "StaffId",
|
||||||
|
principalTable: "Staffs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowTruck_Shows_ShowId",
|
||||||
|
table: "ShowTruck",
|
||||||
|
column: "ShowId",
|
||||||
|
principalTable: "Shows",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShowTruck_Trucks_TruckId",
|
||||||
|
table: "ShowTruck",
|
||||||
|
column: "TruckId",
|
||||||
|
principalTable: "Trucks",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1963
PyroFetes/Migrations/20251113162655_FixedNullableValue.Designer.cs
generated
Normal file
1963
PyroFetes/Migrations/20251113162655_FixedNullableValue.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
37
PyroFetes/Migrations/20251113162655_FixedNullableValue.cs
Normal file
37
PyroFetes/Migrations/20251113162655_FixedNullableValue.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PyroFetes.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixedNullableValue : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateOnly>(
|
||||||
|
name: "RealDeliveryDate",
|
||||||
|
table: "DeliveryNotes",
|
||||||
|
type: "date",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(DateOnly),
|
||||||
|
oldType: "date");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateOnly>(
|
||||||
|
name: "RealDeliveryDate",
|
||||||
|
table: "DeliveryNotes",
|
||||||
|
type: "date",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateOnly(1, 1, 1),
|
||||||
|
oldClrType: typeof(DateOnly),
|
||||||
|
oldType: "date",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1966
PyroFetes/Migrations/20251120154429_FixTypeErrors.Designer.cs
generated
Normal file
1966
PyroFetes/Migrations/20251120154429_FixTypeErrors.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
68
PyroFetes/Migrations/20251120154429_FixTypeErrors.cs
Normal file
68
PyroFetes/Migrations/20251120154429_FixTypeErrors.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PyroFetes.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixTypeErrors : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "ZipCode",
|
||||||
|
table: "Suppliers",
|
||||||
|
type: "nvarchar(5)",
|
||||||
|
maxLength: 5,
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Caliber",
|
||||||
|
table: "Products",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(decimal),
|
||||||
|
oldType: "decimal(18,2)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "ApprovalNumber",
|
||||||
|
table: "Products",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ZipCode",
|
||||||
|
table: "Suppliers",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(5)",
|
||||||
|
oldMaxLength: 5);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<decimal>(
|
||||||
|
name: "Caliber",
|
||||||
|
table: "Products",
|
||||||
|
type: "decimal(18,2)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ApprovalNumber",
|
||||||
|
table: "Products",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(max)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,7 +88,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("City");
|
b.ToTable("Cities");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.Classification", b =>
|
modelBuilder.Entity("PyroFetes.Models.Classification", b =>
|
||||||
@@ -228,7 +228,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ServiceProviderId");
|
b.HasIndex("ServiceProviderId");
|
||||||
|
|
||||||
b.ToTable("ContactServiceProvider");
|
b.ToTable("ContactServiceProviders");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.Contract", b =>
|
modelBuilder.Entity("PyroFetes.Models.Contract", b =>
|
||||||
@@ -247,7 +247,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ServiceProviderId");
|
b.HasIndex("ServiceProviderId");
|
||||||
|
|
||||||
b.ToTable("Contract");
|
b.ToTable("Contracts");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.Customer", b =>
|
modelBuilder.Entity("PyroFetes.Models.Customer", b =>
|
||||||
@@ -326,7 +326,7 @@ namespace PyroFetes.Migrations
|
|||||||
b.Property<DateOnly>("ExpeditionDate")
|
b.Property<DateOnly>("ExpeditionDate")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<DateOnly>("RealDeliveryDate")
|
b.Property<DateOnly?>("RealDeliveryDate")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<string>("TrackingNumber")
|
b.Property<string>("TrackingNumber")
|
||||||
@@ -439,7 +439,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("WarehouseId");
|
b.HasIndex("WarehouseId");
|
||||||
|
|
||||||
b.ToTable("MaterialWarehouse");
|
b.ToTable("MaterialWarehouses");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.Movement", b =>
|
modelBuilder.Entity("PyroFetes.Models.Movement", b =>
|
||||||
@@ -503,11 +503,12 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("ApprovalNumber")
|
b.Property<string>("ApprovalNumber")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<decimal>("Caliber")
|
b.Property<int>("Caliber")
|
||||||
.HasColumnType("decimal(18,2)");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("ClassificationId")
|
b.Property<int>("ClassificationId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
@@ -644,7 +645,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ShowId");
|
b.HasIndex("ShowId");
|
||||||
|
|
||||||
b.ToTable("ProductTimecode");
|
b.ToTable("ProductTimecodes");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.ProviderContact", b =>
|
modelBuilder.Entity("PyroFetes.Models.ProviderContact", b =>
|
||||||
@@ -780,7 +781,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ProviderTypeId");
|
b.HasIndex("ProviderTypeId");
|
||||||
|
|
||||||
b.ToTable("Providers");
|
b.ToTable("ServiceProviders");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.Setting", b =>
|
modelBuilder.Entity("PyroFetes.Models.Setting", b =>
|
||||||
@@ -856,7 +857,20 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("MaterialId");
|
b.HasIndex("MaterialId");
|
||||||
|
|
||||||
b.ToTable("ShowMaterial");
|
b.ToTable("ShowMaterials");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PyroFetes.Models.ShowServiceProvider", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ShowServiceProviders");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.ShowStaff", b =>
|
modelBuilder.Entity("PyroFetes.Models.ShowStaff", b =>
|
||||||
@@ -871,7 +885,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ShowId");
|
b.HasIndex("ShowId");
|
||||||
|
|
||||||
b.ToTable("ShowStaff");
|
b.ToTable("ShowStaffs");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.ShowTruck", b =>
|
modelBuilder.Entity("PyroFetes.Models.ShowTruck", b =>
|
||||||
@@ -886,7 +900,7 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.HasIndex("TruckId");
|
b.HasIndex("TruckId");
|
||||||
|
|
||||||
b.ToTable("ShowTruck");
|
b.ToTable("ShowTrucks");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.Sound", b =>
|
modelBuilder.Entity("PyroFetes.Models.Sound", b =>
|
||||||
@@ -1100,8 +1114,10 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(30)
|
.HasMaxLength(30)
|
||||||
.HasColumnType("nvarchar(30)");
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
b.Property<int>("ZipCode")
|
b.Property<string>("ZipCode")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("nvarchar(5)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class DeliveryNote
|
|||||||
public int DelivererId { get; set; }
|
public int DelivererId { get; set; }
|
||||||
[Required] public DateOnly EstimateDeliveryDate { get; set; }
|
[Required] public DateOnly EstimateDeliveryDate { get; set; }
|
||||||
[Required] public DateOnly ExpeditionDate { get; set; }
|
[Required] public DateOnly ExpeditionDate { get; set; }
|
||||||
[Required] public DateOnly RealDeliveryDate { get; set; }
|
public DateOnly? RealDeliveryDate { get; set; }
|
||||||
|
|
||||||
public Deliverer? Deliverer { get; set; }
|
public Deliverer? Deliverer { get; set; }
|
||||||
public List<ProductDelivery>? ProductDeliveries { get; set; }
|
public List<ProductDelivery>? ProductDeliveries { get; set; }
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user