Compare commits
38 Commits
0b72549143
...
feature/re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe58e5e7e7 | ||
|
|
9c723a7a10 | ||
|
|
0312f02028 | ||
| 418c2b3d16 | |||
|
|
3487baad87 | ||
| 29e2036965 | |||
| be7a3193ab | |||
| 0802ec9e33 | |||
| 35d3e58d86 | |||
| 2a42e1010f | |||
| 2fa74ccba8 | |||
| 65cff130e4 | |||
| e21e2afea4 | |||
| 17978e7c19 | |||
| 6a20676b32 | |||
| e440dcd2b5 | |||
| bee1cfb0e3 | |||
| d709654410 | |||
| 4a82c51133 | |||
| 8a04adeec3 | |||
| db9219e80f | |||
| 9e6834754f | |||
| efa7a0be6f | |||
| 2a439ccbb5 | |||
| 5c6798a647 | |||
|
|
50a5f371dd | ||
| 86c5d6ae7b | |||
| 1c0432a2c4 | |||
| 3e8f36457e | |||
| 5d68ee6992 | |||
|
|
d26284d552 | ||
|
|
d537051bea | ||
|
|
3ad506f869 | ||
|
|
9aac7c39f2 | ||
|
|
b76b668097 | ||
|
|
669938d677 | ||
|
|
165c9b9322 | ||
| 27e8fea7f3 |
@@ -0,0 +1,6 @@
|
|||||||
|
namespace PyroFetes.DTO.DeliveryNote.Request;
|
||||||
|
|
||||||
|
public class GetDeliveryNotePdfDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
@@ -17,8 +17,8 @@ public class CreatePriceDto
|
|||||||
public string? 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; }
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ public class GetPriceDto
|
|||||||
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 string? ProductReferences { get; set; }
|
public string? ProductReference { 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; }
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ public class CreateProductDto
|
|||||||
public string? 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; }
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ public class UpdateProductDto
|
|||||||
public string? 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; }
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ public class GetProductDto
|
|||||||
public string? 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.ProductDelivery.Response;
|
|||||||
public class GetProductDeliveryDto
|
public class GetProductDeliveryDto
|
||||||
{
|
{
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int ProductReference { get; set; }
|
public string? ProductReference { 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; }
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
|
||||||
|
namespace PyroFetes.DTO.PurchaseOrder.Request;
|
||||||
|
|
||||||
|
public class CreatePurchaseOrderDto
|
||||||
|
{
|
||||||
|
public string? PurchaseConditions { get; set; }
|
||||||
|
public List<CreatePurchaseOrderProductDto>? Products { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace PyroFetes.DTO.PurchaseOrder.Request;
|
||||||
|
|
||||||
|
public class GetPurchaseOrderPdfDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
@@ -6,5 +6,5 @@ public class GetPurchaseOrderDto
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? PurchaseConditions { get; set; }
|
public string? PurchaseConditions { get; set; }
|
||||||
public List<GetPurchaseProductDto>? GetPurchaseProductDto { get; set; }
|
public List<GetPurchaseProductDto>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PyroFetes.DTO.PurchaseProduct.Request;
|
||||||
|
|
||||||
|
// Pour ajouter les produits lors de la création
|
||||||
|
public class CreatePurchaseOrderProductDto
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
@@ -7,11 +7,11 @@ public class UpdatePurchaseProductDto
|
|||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { 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; }
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ public class GetPurchaseProductDto
|
|||||||
public string? 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; }
|
||||||
public string? ProductLink { get; set; }
|
public string? ProductLink { get; set; }
|
||||||
public int ProductMinimalQuantity { get; set; }
|
public int ProductMinimalQuantity { get; set; }
|
||||||
|
public decimal ProductPrice { get; set; }
|
||||||
|
|
||||||
public int PurchaseOrderId { get; set; }
|
public int PurchaseOrderId { get; set; }
|
||||||
public string? PurchaseOrderPurchaseConditions { get; set; }
|
public string? PurchaseOrderPurchaseConditions { get; set; }
|
||||||
|
|||||||
10
PyroFetes/DTO/Quotation/Request/CreateQuotationDto.cs
Normal file
10
PyroFetes/DTO/Quotation/Request/CreateQuotationDto.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
|
||||||
|
namespace PyroFetes.DTO.Quotation.Request;
|
||||||
|
|
||||||
|
public class CreateQuotationDto
|
||||||
|
{
|
||||||
|
public string? Message { get; set; }
|
||||||
|
public string? ConditionsSale { get; set; }
|
||||||
|
public List<CreateProductQuotationDto>? Products { get; set; }
|
||||||
|
}
|
||||||
6
PyroFetes/DTO/Quotation/Request/GetQuotationPdfDto.cs
Normal file
6
PyroFetes/DTO/Quotation/Request/GetQuotationPdfDto.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace PyroFetes.DTO.Quotation.Request;
|
||||||
|
|
||||||
|
public class GetQuotationPdfDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
8
PyroFetes/DTO/Quotation/Request/UpdateQuotationDto.cs
Normal file
8
PyroFetes/DTO/Quotation/Request/UpdateQuotationDto.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PyroFetes.DTO.Quotation.Request;
|
||||||
|
|
||||||
|
public class UpdateQuotationDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? Message { get; set; }
|
||||||
|
public string? ConditionsSale { get; set; }
|
||||||
|
}
|
||||||
@@ -7,5 +7,5 @@ public class GetQuotationDto
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Message { get; set; }
|
public string? Message { get; set; }
|
||||||
public string? ConditionsSale { get; set; }
|
public string? ConditionsSale { get; set; }
|
||||||
public List<GetQuotationProductDto>? GetQuotationProductDto { get; set; }
|
public List<GetQuotationProductDto>? Products { get; set; }
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PyroFetes.DTO.QuotationProduct.Request;
|
||||||
|
|
||||||
|
// Pour création global
|
||||||
|
public class CreateProductQuotationDto
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ public class CreateQuotationProductDto
|
|||||||
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;}
|
||||||
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; }
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ public class UpdateQuotationProductDto
|
|||||||
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;}
|
||||||
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; }
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ public class GetQuotationProductDto
|
|||||||
public string? 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; }
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
using PyroFetes.DTO.Price.Response;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Supplier.Response;
|
namespace PyroFetes.DTO.Supplier.Response;
|
||||||
|
|
||||||
public class GetSupplierDto
|
public class GetSupplierDto
|
||||||
@@ -10,4 +13,6 @@ public class GetSupplierDto
|
|||||||
public string? 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; }
|
||||||
|
public List<GetProductDto>? Products { get; set; }
|
||||||
|
public List<GetPriceDto>? Prices { get; set; }
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ public class CreateDelivererEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("api/deliverers");
|
Post("/deliverers");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class DeleteDelivererEndpoint(DeliverersRepository deliverersRepository)
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("api/deliverers/{@id}", x=>new {x.DelivererId});
|
Delete("/deliverers/{@id}", x=>new {x.DelivererId});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class GetAllDelivererEndpoint(DeliverersRepository deliverersRepository)
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("api/deliverers");
|
Get("/deliverers");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class GetDelivererEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("api/deliverers/{@id}", x=>new {x.DelivererId});
|
Get("/deliverers/{@id}", x=>new {x.DelivererId});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class UpdateDelivererEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("api/deliverers/{@id}", x=>new {x.Id});
|
Put("/deliverers/{@id}", x=>new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CreateDeliveryNoteEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/DeliveryNote");
|
Post("/deliveryNotes");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.Endpoints.Quotations;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.DeliveryNotes;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||||
|
|
||||||
|
public class DeleteDeliveryNoteRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteDeliveryNoteEndpoint(
|
||||||
|
DeliveryNotesRepository deliveryNotesRepository) : Endpoint<DeleteDeliveryNoteRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/deliveryNotes/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteDeliveryNoteRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (deliveryNote == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await deliveryNotesRepository.DeleteAsync(deliveryNote, ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ public class GetAllDeliveryNoteEndpoint(DeliveryNotesRepository deliveryNotesRep
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("api/deliveryNotes");
|
Get("/deliveryNotes");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class GetDeliveryNoteEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/deliveryNote/{@id}", x=> new {x.DeliveryNoteId});
|
Get("/deliveryNotes/{@id}", x=> new {x.DeliveryNoteId});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System.Net.Mime;
|
||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.DeliveryNote.Request;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Services.Pdf;
|
||||||
|
using PyroFetes.Specifications.DeliveryNotes;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||||
|
|
||||||
|
public class GetDeliveryNotePdfEndpoint(
|
||||||
|
DeliveryNotesRepository deliveryNotesRepository,
|
||||||
|
IDeliveryNotePdfService deliveryNotePdfService)
|
||||||
|
: Endpoint<GetDeliveryNotePdfDto, byte[]>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/deliveryNotes/{@Id}/pdf", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
Description(b => b.Produces<byte[]>(200, MediaTypeNames.Application.Pdf));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetDeliveryNotePdfDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
DeliveryNote? deliveryNote = await deliveryNotesRepository
|
||||||
|
.FirstOrDefaultAsync(new GetDeliveryNoteByIdWithProductsSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (deliveryNote == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = deliveryNotePdfService.Generate(deliveryNote, deliveryNote.ProductDeliveries!);
|
||||||
|
|
||||||
|
await Send.BytesAsync(
|
||||||
|
bytes: bytes,
|
||||||
|
contentType: "application/pdf",
|
||||||
|
fileName: $"bon-de-livraison-{deliveryNote.Id}.pdf",
|
||||||
|
cancellation: ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ public class PatchRealDeliveryDateEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/deliveryNote/{@id}", x=> new {x.Id});
|
Patch("/deliveryNotes/{@id}", x=> new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +30,12 @@ public class PatchRealDeliveryDateEndpoint(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deliveryNoteToPath.RealDeliveryDate != null)
|
||||||
|
{
|
||||||
|
await Send.StringAsync("Impossible de modifier la date.", 400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
deliveryNoteToPath.RealDeliveryDate = req.RealDeliveryDate;
|
deliveryNoteToPath.RealDeliveryDate = req.RealDeliveryDate;
|
||||||
|
|
||||||
await deliveryNotesRepository.UpdateAsync(deliveryNoteToPath, ct);
|
await deliveryNotesRepository.UpdateAsync(deliveryNoteToPath, ct);
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.DeliveryNote.Request;
|
||||||
|
using PyroFetes.DTO.DeliveryNote.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.DeliveryNotes;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.DeliveryNotes;
|
||||||
|
|
||||||
|
public class UpdateDeliveryNoteEndpoint(
|
||||||
|
DeliveryNotesRepository deliveryNotesRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<UpdateDeliveryNoteDto, GetDeliveryNoteDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Put("/deliveryNotes/{@Id}", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(UpdateDeliveryNoteDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (deliveryNote == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
deliveryNote.TrackingNumber = req.TrackingNumber;
|
||||||
|
deliveryNote.EstimateDeliveryDate = req.EstimateDeliveryDate;
|
||||||
|
deliveryNote.ExpeditionDate = req.ExpeditionDate;
|
||||||
|
deliveryNote.RealDeliveryDate = req.RealDeliveryDate;
|
||||||
|
deliveryNote.DelivererId = req.DelivererId;
|
||||||
|
|
||||||
|
await deliveryNotesRepository.UpdateAsync(deliveryNote, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(deliveryNote), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ public class CreatePriceEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/prices");
|
Post("/prices");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DeletePriceEndpoint(PricesRepository pricesRepository) : Endpoint<D
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/prices/{@ProductId}/{@SupplierId}", x => new {x.ProductId, x.SupplierId});
|
Delete("/prices/{@ProductId}/{@SupplierId}", x => new {x.ProductId, x.SupplierId});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class PatchPriceEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/prices/{@ProductId}/{@SupplierId}/SellingPrice", x => new { x.ProductId, x.SupplierId });
|
Patch("/prices/{@ProductId}/{@SupplierId}/SellingPrice", x => new { x.ProductId, x.SupplierId });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
38
PyroFetes/Endpoints/Products/DeleteProductEndpoint.cs
Normal file
38
PyroFetes/Endpoints/Products/DeleteProductEndpoint.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.Endpoints.Deliverers;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Deliverers;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Products;
|
||||||
|
|
||||||
|
public class DeleteProductsRequest
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
}
|
||||||
|
public class DeleteProductEndpoint(ProductsRepository productsRepository) : Endpoint<DeleteProductsRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/products/{@id}", x=>new {x.ProductId});
|
||||||
|
AllowAnonymous();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteProductsRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Product? product = await productsRepository.FirstOrDefaultAsync(new GetProductByIdSpec(req.ProductId), ct);
|
||||||
|
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await productsRepository.DeleteAsync(product, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ public class GetAllProductsEndpoint(ProductsRepository productsRepository) : End
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/products");
|
Get("/products");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Products;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Products;
|
||||||
|
|
||||||
|
public class GetAllProductsUnderLimitEndpoint(ProductsRepository productsRepository) : EndpointWithoutRequest<List<GetProductDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/products/underLimit");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await Send.OkAsync(await productsRepository.ProjectToListAsync<GetProductDto>(new GetProductsUnderLimitSpec(), ct), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ public class GetProductEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/products/{@Id}", x => new {x.Id});
|
Get("/products/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PatchProductMinimalStockEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/products/{@Id}/MinimalStock", x => new { x.Id });
|
Patch("/products/{@Id}/MinimalStock", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class UpdateProductEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/products/{@Id}", x => new {x.Id});
|
Put("/products/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
52
PyroFetes/Endpoints/PurchaseOrders/CreatePurchaseOrder.cs
Normal file
52
PyroFetes/Endpoints/PurchaseOrders/CreatePurchaseOrder.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Request;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Response;
|
||||||
|
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.PurchaseOrders;
|
||||||
|
|
||||||
|
public class CreatePurchaseOrder(
|
||||||
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreatePurchaseOrderDto, GetPurchaseOrderDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/purchaseOrders");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreatePurchaseOrderDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseOrder purchaseOrder = new PurchaseOrder
|
||||||
|
{
|
||||||
|
PurchaseConditions = req.PurchaseConditions ?? "Conditions non précisées",
|
||||||
|
PurchaseProducts = new List<PurchaseProduct>()
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var line in req.Products)
|
||||||
|
{
|
||||||
|
var product = await productsRepository.GetByIdAsync(line.ProductId, ct);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
purchaseOrder.PurchaseProducts.Add(new PurchaseProduct
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
Quantity = line.Quantity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await purchaseOrdersRepository.AddAsync(purchaseOrder, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetPurchaseOrderDto>(purchaseOrder), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ public class DeletePurchaseOrderEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/purchaseOrders/{@Id}", x => new {x.Id});
|
Delete("/purchaseOrders/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class GetAllPurchaseOrderEndpoint(PurchaseOrdersRepository purchaseOrders
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/purchaseOrders");
|
Get("/purchaseOrders");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class GetPurchaseOrderEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/purchaseOrders/{@Id}", x => new {x.Id});
|
Get("/purchaseOrders/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using System.Net.Mime;
|
||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.PurchaseOrder.Request;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Services.Pdf;
|
||||||
|
using PyroFetes.Specifications.PurchaseOrders;
|
||||||
|
namespace PyroFetes.Endpoints.PurchaseOrders;
|
||||||
|
|
||||||
|
public class GetPurchaseOrderPdfEndpoint(
|
||||||
|
PurchaseOrdersRepository purchaseOrdersRepository,
|
||||||
|
IPurchaseOrderPdfService purchaseOrderPdfService)
|
||||||
|
: Endpoint<GetPurchaseOrderPdfDto, byte[]>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/purchaseOrders/{@Id}/pdf", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
Description(b => b.Produces<byte[]>(200, MediaTypeNames.Application.Pdf));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetPurchaseOrderPdfDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository
|
||||||
|
.FirstOrDefaultAsync(new GetPurchaseOrderByIdWithProductsSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (purchaseOrder == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = purchaseOrderPdfService.Generate(purchaseOrder, purchaseOrder.PurchaseProducts!);
|
||||||
|
|
||||||
|
await Send.BytesAsync(
|
||||||
|
bytes: bytes,
|
||||||
|
contentType: "application/pdf",
|
||||||
|
fileName: $"bon-de-commande-{purchaseOrder.Id}.pdf",
|
||||||
|
cancellation: ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ public class PatchPurchaseOrderPurchaseConditionsEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/purchaseOrders/{@Id}/PurchaseConditions", x => new { x.Id });
|
Patch("/purchaseOrders/{@Id}/PurchaseConditions", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CreatePurchaseProductEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/purchaseProducts");
|
Post("/purchaseProducts");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DeletePurchaseProductEndpoint(PurchaseProductsRepository purchasePr
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/purchaseProducts/{@ProductId}/{@PurchaseOrderId}", x => new {x.ProductId, x.PurchaseOrderId});
|
Delete("/purchaseProducts/{@ProductId}/{@PurchaseOrderId}", x => new {x.ProductId, x.PurchaseOrderId});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PatchPurchaseProductQuantityEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/purchaseProducts/{@ProductId}/{@PurchaseOrderId}/Quantity", x => new { x.ProductId, x.PurchaseOrderId });
|
Patch("/purchaseProducts/{@ProductId}/{@PurchaseOrderId}/Quantity", x => new { x.ProductId, x.PurchaseOrderId });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CreateQuotationProductEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/quotationProduct");
|
Post("/quotationProducts");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DeleteQuotationProductEndpoint(QuotationProductsRepository quotatio
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/quotationProduct/{@ProductId}/{@QuotationId}", x => new {x.ProductId, x.QuotationId});
|
Delete("/quotationProducts/{@ProductId}/{@QuotationId}", x => new {x.ProductId, x.QuotationId});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PatchQuotationProductQuantityEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/quotationProduct/{@ProductId}/{@QuotationId}/Quantity", x => new { x.ProductId, x.QuotationId });
|
Patch("/quotationProducts/{@ProductId}/{@QuotationId}/Quantity", x => new { x.ProductId, x.QuotationId });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
50
PyroFetes/Endpoints/Quotations/CreateQuotationEndpoint.cs
Normal file
50
PyroFetes/Endpoints/Quotations/CreateQuotationEndpoint.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Quotation.Request;
|
||||||
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class CreateQuotationEndpoint(
|
||||||
|
QuotationsRepository quotationsRepository,
|
||||||
|
ProductsRepository productsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreateQuotationDto, GetQuotationDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/quotations");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreateQuotationDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Quotation quotation = new Quotation
|
||||||
|
{
|
||||||
|
Message = req.Message,
|
||||||
|
ConditionsSale = req.ConditionsSale ?? "Conditions non précisées",
|
||||||
|
CustomerId = 1, // A changer
|
||||||
|
QuotationProducts = new List<QuotationProduct>()
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var line in req.Products)
|
||||||
|
{
|
||||||
|
var product = await productsRepository.GetByIdAsync(line.ProductId, ct);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
quotation.QuotationProducts.Add(new QuotationProduct
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
Quantity = line.Quantity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await quotationsRepository.AddAsync(quotation, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetQuotationDto>(quotation), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ public class DeleteQuotationEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/quotations/{@Id}", x => new {x.Id});
|
Delete("/quotations/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class GetAllQuotationEndpoint(QuotationsRepository quotationsRepository)
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/quotations");
|
Get("/quotations");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class GetQuotationEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/quotations/{@Id}", x => new {x.Id});
|
Get("/quotations/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
42
PyroFetes/Endpoints/Quotations/GetQuotationPdfEndpoint.cs
Normal file
42
PyroFetes/Endpoints/Quotations/GetQuotationPdfEndpoint.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System.Net.Mime;
|
||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Quotation.Request;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Services.Pdf;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class GetQuotationPdfEndpoint(
|
||||||
|
QuotationsRepository quotationRepository,
|
||||||
|
IQuotationPdfService quotationPdfService)
|
||||||
|
: Endpoint<GetQuotationPdfDto, byte[]>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/quotations/{@Id}/pdf", x => new {x.Id});
|
||||||
|
AllowAnonymous();
|
||||||
|
Description(b => b.Produces<byte[]>(200, MediaTypeNames.Application.Pdf));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetQuotationPdfDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
Quotation? quotation = await quotationRepository
|
||||||
|
.FirstOrDefaultAsync(new GetQuotationByIdWithProductsSpec(req.Id), ct);
|
||||||
|
|
||||||
|
if (quotation == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = quotationPdfService.Generate(quotation, quotation.QuotationProducts!);
|
||||||
|
|
||||||
|
await Send.BytesAsync(
|
||||||
|
bytes: bytes,
|
||||||
|
contentType: "application/pdf",
|
||||||
|
fileName: $"devis-{quotation.Id}.pdf",
|
||||||
|
cancellation: ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Quotation.Request;
|
using PyroFetes.DTO.Quotation.Request;
|
||||||
using PyroFetes.DTO.Quotation.Response;
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
using PyroFetes.DTO.QuotationProduct.Response;
|
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
using PyroFetes.Repositories;
|
using PyroFetes.Repositories;
|
||||||
using PyroFetes.Specifications.Quotations;
|
using PyroFetes.Specifications.Quotations;
|
||||||
@@ -15,7 +13,7 @@ public class PatchQuotationConditionsSaleEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/quotations/{@Id}/ConditionsSale", x => new { x.Id });
|
Patch("/quotations/{@Id}/saleConditions", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
PyroFetes/Endpoints/Quotations/UpdateQuotationEndpoint.cs
Normal file
36
PyroFetes/Endpoints/Quotations/UpdateQuotationEndpoint.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Quotation.Request;
|
||||||
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Quotations;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Quotations;
|
||||||
|
|
||||||
|
public class UpdateQuotationEndpoint(
|
||||||
|
QuotationsRepository quotationsRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<UpdateQuotationDto, GetQuotationDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Put("/quotations/{@Id}", x => new { x.Id });
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(UpdateQuotationDto 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;
|
||||||
|
quotation.Message = req.Message;
|
||||||
|
await quotationsRepository.UpdateAsync(quotation, ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(mapper.Map<GetQuotationDto>(quotation), ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ public class CreateSettingEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/setting");
|
Post("/settings");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class DeleteSettingEndpoint(SettingsRepository settingsRepository) : Endp
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/setting/{@Id}", x => new {x.Id});
|
Delete("/settings/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class GetSettingEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/setting/{@Id}", x => new {x.Id});
|
Get("/settings/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PatchSettingElectronicSignatureEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/setting/{@Id}/ElectronicSignature", x => new {x.Id});
|
Patch("/settings/{@Id}/ElectronicSignature", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PatchSettingLogoEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/setting/{@Id}/Logo", x => new {x.Id});
|
Patch("/settings/{@Id}/logo", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class CreateSupplierEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/suppliers");
|
Post("/suppliers");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class DeleteSupplierEndpoint(SuppliersRepository suppliersRepository) : E
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/suppliers/{@Id}", x => new {x.Id});
|
Delete("/suppliers/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class GetAllSuppliersEndpoint(SuppliersRepository suppliersRepository) :
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/suppliers");
|
Get("/suppliers");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class GetSupplierEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/suppliers/{@Id}", x => new {x.Id});
|
Get("/suppliers/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ using PyroFetes.Specifications.Suppliers;
|
|||||||
|
|
||||||
namespace PyroFetes.Endpoints.Suppliers;
|
namespace PyroFetes.Endpoints.Suppliers;
|
||||||
|
|
||||||
public class PatchSupplierDeleveryDelayEndpoint(
|
public class PatchSupplierDeliveryDelayEndpoint(
|
||||||
SuppliersRepository suppliersRepository,
|
SuppliersRepository suppliersRepository,
|
||||||
AutoMapper.IMapper mapper) : Endpoint<PatchSupplierDeliveryDelayDto, GetSupplierDto>
|
AutoMapper.IMapper mapper) : Endpoint<PatchSupplierDeliveryDelayDto, GetSupplierDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/supplier/{@Id}/DeleveryDalay", x => new {x.Id});
|
Patch("/suppliers/{@Id}/deliveryDelay", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class UpdateSupplierEndpoint(
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/suppliers/{@Id}", x => new {x.Id});
|
Put("/suppliers/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,20 +4,22 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using PyroFetes.DTO.User.Request;
|
using PyroFetes.DTO.User.Request;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
public class ConnectUserEndpoint(PyroFetesDbContext database) : Endpoint<ConnectUserDto, GetTokenDto>
|
public class ConnectUserEndpoint(UsersRepository usersRepository) : Endpoint<ConnectUserDto, GetTokenDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/users/connect");
|
Post("/users/connection");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(ConnectUserDto req, CancellationToken ct)
|
public override async Task HandleAsync(ConnectUserDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
User? user = await database.Users.SingleOrDefaultAsync(x => x.Name == req.Name, ct);
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByNameSpec(req.Name!), ct);
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,19 +3,31 @@ using PasswordGenerator;
|
|||||||
using PyroFetes.DTO.User.Request;
|
using PyroFetes.DTO.User.Request;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
public class CreateUserEndpoint(PyroFetesDbContext database) : Endpoint<CreateUserDto, GetUserDto>
|
public class CreateUserEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<CreateUserDto, GetUserDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/users");
|
Post("/users");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateUserDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateUserDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
|
User? ckeckName = await usersRepository.FirstOrDefaultAsync(new GetUserByNameSpec(req.Name!), ct);
|
||||||
|
|
||||||
|
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();
|
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
||||||
|
|
||||||
User user = new User()
|
User user = new User()
|
||||||
@@ -27,20 +39,8 @@ public class CreateUserEndpoint(PyroFetesDbContext database) : Endpoint<CreateUs
|
|||||||
Fonction = req.Fonction
|
Fonction = req.Fonction
|
||||||
};
|
};
|
||||||
|
|
||||||
database.Users.Add(user);
|
await usersRepository.AddAsync(user, ct);
|
||||||
|
|
||||||
await database.SaveChangesAsync(ct);
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
|
|
||||||
GetUserDto responseDto = new()
|
|
||||||
{
|
|
||||||
Id = user.Id,
|
|
||||||
Name = user.Name,
|
|
||||||
Password = user.Password,
|
|
||||||
Salt = user.Salt,
|
|
||||||
Email = user.Email,
|
|
||||||
Fonction = user.Fonction
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
@@ -9,17 +11,17 @@ public class DeleteUserRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteUserEndpoint(PyroFetesDbContext database) : Endpoint<DeleteUserRequest>
|
public class DeleteUserEndpoint(UsersRepository usersRepository) : Endpoint<DeleteUserRequest>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/users/{@Id}", x => new {x.Id});
|
Delete("/users/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
User? user = await database.Users.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
@@ -27,8 +29,7 @@ public class DeleteUserEndpoint(PyroFetesDbContext database) : Endpoint<DeleteUs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
database.Users.Remove(user);
|
await usersRepository.DeleteAsync(user, ct);
|
||||||
await database.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,20 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
public class GetAllUsersEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest<List<GetUserDto>>
|
public class GetAllUsersEndpoint(UsersRepository usersRepository) : EndpointWithoutRequest<List<GetUserDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/users");
|
Get("/users");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetUserDto> users = await database.Users
|
await Send.OkAsync(await usersRepository.ProjectToListAsync<GetUserDto>(ct), ct);
|
||||||
.Select(users => new GetUserDto()
|
|
||||||
{
|
|
||||||
Id = users.Id,
|
|
||||||
Name = users.Name,
|
|
||||||
Password = users.Password,
|
|
||||||
Salt = users.Salt,
|
|
||||||
Email = users.Email,
|
|
||||||
Fonction = users.Fonction
|
|
||||||
})
|
|
||||||
.ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(users, ct);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
@@ -10,18 +12,19 @@ public class GetUserRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetUserEndpoint(PyroFetesDbContext database) : Endpoint<GetUserRequest, GetUserDto>
|
public class GetUserEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<GetUserRequest, GetUserDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/users/{@Id}", x => new {x.Id});
|
Get("/users/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetUserRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetUserRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
User? user = await database.Users
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
@@ -29,16 +32,6 @@ public class GetUserEndpoint(PyroFetesDbContext database) : Endpoint<GetUserRequ
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetUserDto responseDto = new()
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
{
|
|
||||||
Id = user.Id,
|
|
||||||
Name = user.Name,
|
|
||||||
Password = user.Password,
|
|
||||||
Salt = user.Salt,
|
|
||||||
Email = user.Email,
|
|
||||||
Fonction = user.Fonction
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,20 +3,25 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using PyroFetes.DTO.User.Request;
|
using PyroFetes.DTO.User.Request;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
public class PatchUserPasswordEndpoint(PyroFetesDbContext database) : Endpoint<PatchUserPasswordDto, GetUserDto>
|
public class PatchUserPasswordEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<PatchUserPasswordDto, GetUserDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/users/{@Id}/Password", x => new { x.Id });
|
Patch("/users/{@Id}/password", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(PatchUserPasswordDto req, CancellationToken ct)
|
public override async Task HandleAsync(PatchUserPasswordDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
User? user = await database.Users.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
@@ -24,17 +29,8 @@ public class PatchUserPasswordEndpoint(PyroFetesDbContext database) : Endpoint<P
|
|||||||
}
|
}
|
||||||
|
|
||||||
user.Password = BCrypt.Net.BCrypt.HashPassword(req.Password + user.Salt);
|
user.Password = BCrypt.Net.BCrypt.HashPassword(req.Password + user.Salt);
|
||||||
await database.SaveChangesAsync(ct);
|
await usersRepository.UpdateAsync(user, ct);
|
||||||
|
|
||||||
GetUserDto responseDto = new()
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
{
|
|
||||||
Id = user.Id,
|
|
||||||
Name = user.Name,
|
|
||||||
Password = user.Password,
|
|
||||||
Salt = user.Salt,
|
|
||||||
Email = user.Email,
|
|
||||||
Fonction = user.Fonction
|
|
||||||
};
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,21 +4,25 @@ using PasswordGenerator;
|
|||||||
using PyroFetes.DTO.User.Request;
|
using PyroFetes.DTO.User.Request;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.Users;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Users;
|
namespace PyroFetes.Endpoints.Users;
|
||||||
|
|
||||||
public class UpdateUserEndpoint(PyroFetesDbContext database) : Endpoint<UpdateUserDto, GetUserDto>
|
public class UpdateUserEndpoint(
|
||||||
|
UsersRepository usersRepository,
|
||||||
|
AutoMapper.IMapper mapper) : Endpoint<UpdateUserDto, GetUserDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/users/{@Id}", x => new {x.Id});
|
Put("/users/{@Id}", x => new {x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateUserDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateUserDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
User? user = await database.Users.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
User? user = await usersRepository.FirstOrDefaultAsync(new GetUserByIdSpec(req.Id), ct);
|
||||||
User? ckeckName = await database.Users.SingleOrDefaultAsync(x => x.Name == req.Name, ct);
|
User? ckeckName = await usersRepository.FirstOrDefaultAsync(new GetUserByNameSpec(req.Name!), ct);
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
@@ -26,7 +30,7 @@ public class UpdateUserEndpoint(PyroFetesDbContext database) : Endpoint<UpdateUs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ckeckName != null)
|
if (ckeckName != null && ckeckName.Id != user.Id)
|
||||||
{
|
{
|
||||||
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
|
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
|
||||||
return;
|
return;
|
||||||
@@ -39,18 +43,9 @@ public class UpdateUserEndpoint(PyroFetesDbContext database) : Endpoint<UpdateUs
|
|||||||
user.Salt = salt;
|
user.Salt = salt;
|
||||||
user.Email = req.Email;
|
user.Email = req.Email;
|
||||||
user.Fonction = req.Fonction;
|
user.Fonction = req.Fonction;
|
||||||
await database.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetUserDto responseDto = new()
|
await usersRepository.UpdateAsync(user, ct);
|
||||||
{
|
|
||||||
Id = user.Id,
|
|
||||||
Name = user.Name,
|
|
||||||
Password = user.Password,
|
|
||||||
Salt = user.Salt,
|
|
||||||
Email = user.Email,
|
|
||||||
Fonction = user.Fonction
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(mapper.Map<GetUserDto>(user), ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PyroFetes.DTO.WareHouseProduct.Response;
|
using PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Specifications.WarehouseProducts;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.WareHouseProducts;
|
namespace PyroFetes.Endpoints.WareHouseProducts;
|
||||||
|
|
||||||
@@ -10,18 +12,18 @@ public class GetTotalQuantityRequest
|
|||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetTotalQuantityEndpoint(PyroFetesDbContext database) : Endpoint<GetTotalQuantityRequest, GetTotalQuantityDto>
|
public class GetTotalQuantityEndpoint(
|
||||||
|
WarehouseProductsRepository warehouseProductsRepository) : Endpoint<GetTotalQuantityRequest, GetTotalQuantityDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/wareHouseProduct/{@ProductId}", x => new { x.ProductId });
|
Get("/wareHouseProducts/{@ProductId}", x => new { x.ProductId });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetTotalQuantityRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetTotalQuantityRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
bool exists = await database.WarehouseProducts
|
bool exists = await warehouseProductsRepository.AnyAsync(new GetWarehouseProductByProductIdSpec(req.ProductId), ct);
|
||||||
.AnyAsync(wp => wp.ProductId == req.ProductId, ct);
|
|
||||||
|
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
@@ -29,9 +31,10 @@ public class GetTotalQuantityEndpoint(PyroFetesDbContext database) : Endpoint<Ge
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalQuantity = await database.WarehouseProducts
|
int? totalQuantityNullable = await warehouseProductsRepository.
|
||||||
.Where(wp => wp.ProductId == req.ProductId)
|
SumAsync(new GetProductTotalQuantitySpec(req.ProductId), wp => wp.Quantity, ct);
|
||||||
.SumAsync(wp => wp.Quantity, ct);
|
|
||||||
|
int totalQuantity = totalQuantityNullable ?? 0;
|
||||||
|
|
||||||
GetTotalQuantityDto responseDto = new()
|
GetTotalQuantityDto responseDto = new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,17 +6,21 @@ using PyroFetes.Models;
|
|||||||
|
|
||||||
namespace PyroFetes.Endpoints.WareHouseProducts;
|
namespace PyroFetes.Endpoints.WareHouseProducts;
|
||||||
|
|
||||||
public class PatchWareHouseProductQuantityEndpoint(PyroFetesDbContext database) : Endpoint<PatchWareHouseProductQuantityDto, GetWareHouseProductDto>
|
public class PatchWareHouseProductQuantityEndpoint(PyroFetesDbContext database)
|
||||||
|
: Endpoint<PatchWareHouseProductQuantityDto, GetWareHouseProductDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Patch("/api/wareHouseProduct/{@ProductId}/{@WareHouseId}/Quantity", x => new { x.ProductId, x.WareHouseId });
|
Patch("/wareHouseProducts/{@ProductId}/{@WareHouseId}/quantity", x => new { x.ProductId, x.WareHouseId });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(PatchWareHouseProductQuantityDto req, CancellationToken ct)
|
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);
|
WarehouseProduct? wareHouseProduct =
|
||||||
|
await database.WarehouseProducts.SingleOrDefaultAsync(
|
||||||
|
wp => wp.ProductId == req.ProductId && wp.WarehouseId == req.WareHouseId, ct);
|
||||||
|
|
||||||
if (wareHouseProduct == null)
|
if (wareHouseProduct == null)
|
||||||
{
|
{
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class DtoToEntityMappings : Profile
|
|||||||
CreateMap<CreateProductDeliveryDto, ProductDelivery>();
|
CreateMap<CreateProductDeliveryDto, ProductDelivery>();
|
||||||
CreateMap<UpdateProductDeliveryDto, ProductDelivery>();
|
CreateMap<UpdateProductDeliveryDto, ProductDelivery>();
|
||||||
|
|
||||||
|
CreateMap<CreatePurchaseOrderDto, PurchaseOrder>();
|
||||||
CreateMap<PatchPurchaseOrderPurchaseConditionsDto,PurchaseOrder>();
|
CreateMap<PatchPurchaseOrderPurchaseConditionsDto,PurchaseOrder>();
|
||||||
|
|
||||||
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
|
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
|
||||||
@@ -46,6 +47,7 @@ public class DtoToEntityMappings : Profile
|
|||||||
|
|
||||||
CreateMap<PatchQuotationConditionsSaleDto, Quotation>();
|
CreateMap<PatchQuotationConditionsSaleDto, Quotation>();
|
||||||
CreateMap<PatchQuotationMessageDto, Quotation>();
|
CreateMap<PatchQuotationMessageDto, Quotation>();
|
||||||
|
CreateMap<CreateProductQuotationDto, Quotation>();
|
||||||
|
|
||||||
CreateMap<CreateQuotationProductDto, QuotationProduct>();
|
CreateMap<CreateQuotationProductDto, QuotationProduct>();
|
||||||
CreateMap<UpdateQuotationProductDto, QuotationProduct>();
|
CreateMap<UpdateQuotationProductDto, QuotationProduct>();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using PyroFetes.DTO.PurchaseProduct.Response;
|
|||||||
using PyroFetes.DTO.Quotation.Response;
|
using PyroFetes.DTO.Quotation.Response;
|
||||||
using PyroFetes.DTO.QuotationProduct.Response;
|
using PyroFetes.DTO.QuotationProduct.Response;
|
||||||
using PyroFetes.DTO.SettingDTO.Response;
|
using PyroFetes.DTO.SettingDTO.Response;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
using PyroFetes.DTO.User.Response;
|
using PyroFetes.DTO.User.Response;
|
||||||
using PyroFetes.DTO.WareHouseProduct.Response;
|
using PyroFetes.DTO.WareHouseProduct.Response;
|
||||||
using PyroFetes.Models;
|
using PyroFetes.Models;
|
||||||
@@ -21,6 +22,8 @@ public class EntityToDtoMappings : Profile
|
|||||||
{
|
{
|
||||||
CreateMap<Deliverer, GetDelivererDto>();
|
CreateMap<Deliverer, GetDelivererDto>();
|
||||||
|
|
||||||
|
CreateMap<Supplier, GetSupplierDto>();
|
||||||
|
|
||||||
CreateMap<DeliveryNote, GetDeliveryNoteDto>();
|
CreateMap<DeliveryNote, GetDeliveryNoteDto>();
|
||||||
|
|
||||||
CreateMap<Price, GetPriceDto>();
|
CreateMap<Price, GetPriceDto>();
|
||||||
@@ -29,13 +32,38 @@ public class EntityToDtoMappings : Profile
|
|||||||
|
|
||||||
CreateMap<ProductDelivery, GetProductDeliveryDto>();
|
CreateMap<ProductDelivery, GetProductDeliveryDto>();
|
||||||
|
|
||||||
CreateMap<PurchaseOrder, GetPurchaseOrderDto>();
|
// CreateMap<PurchaseOrder, GetPurchaseOrderDto>();
|
||||||
|
//
|
||||||
|
//CreateMap<PurchaseProduct, GetPurchaseProductDto>();
|
||||||
|
|
||||||
CreateMap<PurchaseProduct, GetPurchaseProductDto>();
|
|
||||||
|
|
||||||
CreateMap<Quotation, GetQuotationDto>();
|
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
|
||||||
|
.ForMember(dest => dest.Products,
|
||||||
|
opt => opt.MapFrom(src => src.PurchaseProducts));
|
||||||
|
|
||||||
CreateMap<QuotationProduct, GetQuotationProductDto>();
|
CreateMap<PurchaseProduct, GetPurchaseProductDto>()
|
||||||
|
.ForMember(dest => dest.ProductId, opt => opt.MapFrom(src => src.ProductId))
|
||||||
|
.ForMember(dest => dest.Quantity, opt => opt.MapFrom(src => src.Quantity))
|
||||||
|
.ForMember(dest => dest.ProductName, opt => opt.MapFrom(src => src.Product.Name))
|
||||||
|
.ForMember(dest => dest.ProductReferences, opt => opt.MapFrom(src => src.Product.Reference))
|
||||||
|
.ForMember(dest => dest.ProductPrice, opt => opt.MapFrom(src => src.Product.Prices
|
||||||
|
.FirstOrDefault(p => p.SupplierId == src.PurchaseOrder!.SupplierId)
|
||||||
|
.SellingPrice));
|
||||||
|
|
||||||
|
// CreateMap<Quotation, GetQuotationDto>();
|
||||||
|
//
|
||||||
|
//CreateMap<QuotationProduct, GetQuotationProductDto>();
|
||||||
|
|
||||||
|
|
||||||
|
CreateMap<Quotation, GetQuotationDto>()
|
||||||
|
.ForMember(dest => dest.Products,
|
||||||
|
opt => opt.MapFrom(src => src.QuotationProducts));
|
||||||
|
|
||||||
|
CreateMap<QuotationProduct, GetQuotationProductDto>()
|
||||||
|
.ForMember(dest => dest.ProductId, opt => opt.MapFrom(src => src.ProductId))
|
||||||
|
.ForMember(dest => dest.Quantity, opt => opt.MapFrom(src => src.Quantity))
|
||||||
|
.ForMember(dest => dest.ProductName, opt => opt.MapFrom(src => src.Product.Name))
|
||||||
|
.ForMember(dest => dest.ProductReferences, opt => opt.MapFrom(src => src.Product.Reference));
|
||||||
|
|
||||||
CreateMap<Setting, GetSettingDto>();
|
CreateMap<Setting, GetSettingDto>();
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace PyroFetes.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class FixingDatabase : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "References",
|
|
||||||
table: "Products");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "SellingPrice",
|
|
||||||
table: "Products");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Reference",
|
|
||||||
table: "Products",
|
|
||||||
type: "nvarchar(20)",
|
|
||||||
maxLength: 20,
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Reference",
|
|
||||||
table: "Products");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "References",
|
|
||||||
table: "Products",
|
|
||||||
type: "int",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<decimal>(
|
|
||||||
name: "SellingPrice",
|
|
||||||
table: "Products",
|
|
||||||
type: "decimal(18,2)",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,755 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,8 +12,8 @@ using PyroFetes;
|
|||||||
namespace PyroFetes.Migrations
|
namespace PyroFetes.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PyroFetesDbContext))]
|
[DbContext(typeof(PyroFetesDbContext))]
|
||||||
[Migration("20251113162655_FixedNullableValue")]
|
[Migration("20260326145104_AddSupplierToPurchaseOrder")]
|
||||||
partial class FixedNullableValue
|
partial class AddSupplierToPurchaseOrder
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -506,11 +506,13 @@ 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()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
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");
|
||||||
@@ -696,8 +698,13 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(300)
|
.HasMaxLength(300)
|
||||||
.HasColumnType("nvarchar(300)");
|
.HasColumnType("nvarchar(300)");
|
||||||
|
|
||||||
|
b.Property<int>("SupplierId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SupplierId");
|
||||||
|
|
||||||
b.ToTable("PurchaseOrders");
|
b.ToTable("PurchaseOrders");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1116,8 +1123,9 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(30)
|
.HasMaxLength(30)
|
||||||
.HasColumnType("nvarchar(30)");
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
b.Property<int>("ZipCode")
|
b.Property<string>("ZipCode")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -1181,8 +1189,8 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.Property<string>("Password")
|
b.Property<string>("Password")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(60)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(60)");
|
||||||
|
|
||||||
b.Property<string>("Salt")
|
b.Property<string>("Salt")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
@@ -1226,8 +1234,9 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("nvarchar(100)");
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
b.Property<int>("ZipCode")
|
b.Property<string>("ZipCode")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -1544,6 +1553,17 @@ namespace PyroFetes.Migrations
|
|||||||
b.Navigation("Provider");
|
b.Navigation("Provider");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PyroFetes.Models.Supplier", "Supplier")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SupplierId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Supplier");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b =>
|
modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PyroFetes.Models.Product", "Product")
|
b.HasOne("PyroFetes.Models.Product", "Product")
|
||||||
@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace PyroFetes.Migrations
|
namespace PyroFetes.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitialDatabase : Migration
|
public partial class AddSupplierToPurchaseOrder : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@@ -28,7 +28,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "City",
|
name: "Cities",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
@@ -38,7 +38,7 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_City", x => x.Id);
|
table.PrimaryKey("PK_Cities", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
@@ -146,19 +146,6 @@ namespace PyroFetes.Migrations
|
|||||||
table.PrimaryKey("PK_ProviderTypes", x => x.Id);
|
table.PrimaryKey("PK_ProviderTypes", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PurchaseOrders",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
PurchaseConditions = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PurchaseOrders", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Settings",
|
name: "Settings",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -173,6 +160,18 @@ namespace PyroFetes.Migrations
|
|||||||
table.PrimaryKey("PK_Settings", x => x.Id);
|
table.PrimaryKey("PK_Settings", x => x.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.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "SoundCategories",
|
name: "SoundCategories",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -214,7 +213,7 @@ namespace PyroFetes.Migrations
|
|||||||
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
Phone = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
Phone = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
||||||
Address = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Address = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
ZipCode = table.Column<int>(type: "int", nullable: false),
|
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
DeliveryDelay = table.Column<int>(type: "int", nullable: false)
|
DeliveryDelay = table.Column<int>(type: "int", nullable: false)
|
||||||
},
|
},
|
||||||
@@ -246,7 +245,7 @@ namespace PyroFetes.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
Password = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
Password = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false),
|
||||||
Salt = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Salt = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
Fonction = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false)
|
Fonction = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false)
|
||||||
@@ -267,7 +266,7 @@ namespace PyroFetes.Migrations
|
|||||||
Current = table.Column<int>(type: "int", nullable: false),
|
Current = table.Column<int>(type: "int", nullable: false),
|
||||||
MinWeight = table.Column<int>(type: "int", nullable: false),
|
MinWeight = table.Column<int>(type: "int", nullable: false),
|
||||||
Address = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Address = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
ZipCode = table.Column<int>(type: "int", nullable: false),
|
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false)
|
City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@@ -292,9 +291,9 @@ namespace PyroFetes.Migrations
|
|||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Shows", x => x.Id);
|
table.PrimaryKey("PK_Shows", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Shows_City_CityId",
|
name: "FK_Shows_Cities_CityId",
|
||||||
column: x => x.CityId,
|
column: x => x.CityId,
|
||||||
principalTable: "City",
|
principalTable: "Cities",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
@@ -329,7 +328,7 @@ namespace PyroFetes.Migrations
|
|||||||
DelivererId = table.Column<int>(type: "int", nullable: false),
|
DelivererId = table.Column<int>(type: "int", nullable: false),
|
||||||
EstimateDeliveryDate = table.Column<DateOnly>(type: "date", nullable: false),
|
EstimateDeliveryDate = table.Column<DateOnly>(type: "date", nullable: false),
|
||||||
ExpeditionDate = table.Column<DateOnly>(type: "date", nullable: false),
|
ExpeditionDate = table.Column<DateOnly>(type: "date", nullable: false),
|
||||||
RealDeliveryDate = table.Column<DateOnly>(type: "date", nullable: false)
|
RealDeliveryDate = table.Column<DateOnly>(type: "date", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -343,7 +342,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Providers",
|
name: "ServiceProviders",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
@@ -353,9 +352,9 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Providers", x => x.Id);
|
table.PrimaryKey("PK_ServiceProviders", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Providers_ProviderTypes_ProviderTypeId",
|
name: "FK_ServiceProviders_ProviderTypes_ProviderTypeId",
|
||||||
column: x => x.ProviderTypeId,
|
column: x => x.ProviderTypeId,
|
||||||
principalTable: "ProviderTypes",
|
principalTable: "ProviderTypes",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -456,6 +455,26 @@ namespace PyroFetes.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PurchaseOrders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
PurchaseConditions = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
|
||||||
|
SupplierId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PurchaseOrders", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PurchaseOrders_Suppliers_SupplierId",
|
||||||
|
column: x => x.SupplierId,
|
||||||
|
principalTable: "Suppliers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Materials",
|
name: "Materials",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -508,7 +527,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ShowStaff",
|
name: "ShowStaffs",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
StaffId = table.Column<int>(type: "int", nullable: false),
|
StaffId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -516,15 +535,15 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_ShowStaff", x => new { x.StaffId, x.ShowId });
|
table.PrimaryKey("PK_ShowStaffs", x => new { x.StaffId, x.ShowId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ShowStaff_Shows_ShowId",
|
name: "FK_ShowStaffs_Shows_ShowId",
|
||||||
column: x => x.ShowId,
|
column: x => x.ShowId,
|
||||||
principalTable: "Shows",
|
principalTable: "Shows",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ShowStaff_Staffs_StaffId",
|
name: "FK_ShowStaffs_Staffs_StaffId",
|
||||||
column: x => x.StaffId,
|
column: x => x.StaffId,
|
||||||
principalTable: "Staffs",
|
principalTable: "Staffs",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -532,7 +551,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ShowTruck",
|
name: "ShowTrucks",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
ShowId = table.Column<int>(type: "int", nullable: false),
|
ShowId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -540,15 +559,15 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_ShowTruck", x => new { x.ShowId, x.TruckId });
|
table.PrimaryKey("PK_ShowTrucks", x => new { x.ShowId, x.TruckId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ShowTruck_Shows_ShowId",
|
name: "FK_ShowTrucks_Shows_ShowId",
|
||||||
column: x => x.ShowId,
|
column: x => x.ShowId,
|
||||||
principalTable: "Shows",
|
principalTable: "Shows",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ShowTruck_Trucks_TruckId",
|
name: "FK_ShowTrucks_Trucks_TruckId",
|
||||||
column: x => x.TruckId,
|
column: x => x.TruckId,
|
||||||
principalTable: "Trucks",
|
principalTable: "Trucks",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -604,7 +623,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Contract",
|
name: "Contracts",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
ShowId = table.Column<int>(type: "int", nullable: false),
|
ShowId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -613,15 +632,15 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Contract", x => new { x.ShowId, x.ServiceProviderId });
|
table.PrimaryKey("PK_Contracts", x => new { x.ShowId, x.ServiceProviderId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Contract_Providers_ServiceProviderId",
|
name: "FK_Contracts_ServiceProviders_ServiceProviderId",
|
||||||
column: x => x.ServiceProviderId,
|
column: x => x.ServiceProviderId,
|
||||||
principalTable: "Providers",
|
principalTable: "ServiceProviders",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Contract_Shows_ShowId",
|
name: "FK_Contracts_Shows_ShowId",
|
||||||
column: x => x.ShowId,
|
column: x => x.ShowId,
|
||||||
principalTable: "Shows",
|
principalTable: "Shows",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -655,7 +674,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "MaterialWarehouse",
|
name: "MaterialWarehouses",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
MaterialId = table.Column<int>(type: "int", nullable: false),
|
MaterialId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -663,15 +682,15 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_MaterialWarehouse", x => new { x.MaterialId, x.WarehouseId });
|
table.PrimaryKey("PK_MaterialWarehouses", x => new { x.MaterialId, x.WarehouseId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_MaterialWarehouse_Materials_MaterialId",
|
name: "FK_MaterialWarehouses_Materials_MaterialId",
|
||||||
column: x => x.MaterialId,
|
column: x => x.MaterialId,
|
||||||
principalTable: "Materials",
|
principalTable: "Materials",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_MaterialWarehouse_Warehouses_WarehouseId",
|
name: "FK_MaterialWarehouses_Warehouses_WarehouseId",
|
||||||
column: x => x.WarehouseId,
|
column: x => x.WarehouseId,
|
||||||
principalTable: "Warehouses",
|
principalTable: "Warehouses",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -679,7 +698,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ShowMaterial",
|
name: "ShowMaterials",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
ShowId = table.Column<int>(type: "int", nullable: false),
|
ShowId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -687,15 +706,15 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_ShowMaterial", x => new { x.ShowId, x.MaterialId });
|
table.PrimaryKey("PK_ShowMaterials", x => new { x.ShowId, x.MaterialId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ShowMaterial_Materials_MaterialId",
|
name: "FK_ShowMaterials_Materials_MaterialId",
|
||||||
column: x => x.MaterialId,
|
column: x => x.MaterialId,
|
||||||
principalTable: "Materials",
|
principalTable: "Materials",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ShowMaterial_Shows_ShowId",
|
name: "FK_ShowMaterials_Shows_ShowId",
|
||||||
column: x => x.ShowId,
|
column: x => x.ShowId,
|
||||||
principalTable: "Shows",
|
principalTable: "Shows",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -708,14 +727,13 @@ namespace PyroFetes.Migrations
|
|||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
References = table.Column<int>(type: "int", nullable: false),
|
Reference = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
|
||||||
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
Duration = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
Duration = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||||
Caliber = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
Caliber = table.Column<int>(type: "int", nullable: false),
|
||||||
ApprovalNumber = table.Column<int>(type: "int", nullable: false),
|
ApprovalNumber = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||||
Weight = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
Weight = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||||
Nec = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
Nec = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||||
SellingPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
||||||
Image = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Image = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Link = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
Link = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||||
MinimalQuantity = table.Column<int>(type: "int", nullable: false),
|
MinimalQuantity = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -769,7 +787,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ContactServiceProvider",
|
name: "ContactServiceProviders",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
ContactId = table.Column<int>(type: "int", nullable: false),
|
ContactId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -777,17 +795,17 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_ContactServiceProvider", x => new { x.ContactId, x.ServiceProviderId });
|
table.PrimaryKey("PK_ContactServiceProviders", x => new { x.ContactId, x.ServiceProviderId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ContactServiceProvider_Contacts_ContactId",
|
name: "FK_ContactServiceProviders_Contacts_ContactId",
|
||||||
column: x => x.ContactId,
|
column: x => x.ContactId,
|
||||||
principalTable: "Contacts",
|
principalTable: "Contacts",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ContactServiceProvider_Providers_ServiceProviderId",
|
name: "FK_ContactServiceProviders_ServiceProviders_ServiceProviderId",
|
||||||
column: x => x.ServiceProviderId,
|
column: x => x.ServiceProviderId,
|
||||||
principalTable: "Providers",
|
principalTable: "ServiceProviders",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
@@ -809,9 +827,9 @@ namespace PyroFetes.Migrations
|
|||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ProviderContacts_Providers_ProviderId",
|
name: "FK_ProviderContacts_ServiceProviders_ProviderId",
|
||||||
column: x => x.ProviderId,
|
column: x => x.ProviderId,
|
||||||
principalTable: "Providers",
|
principalTable: "ServiceProviders",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
@@ -959,7 +977,7 @@ namespace PyroFetes.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ProductTimecode",
|
name: "ProductTimecodes",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
ProductId = table.Column<int>(type: "int", nullable: false),
|
ProductId = table.Column<int>(type: "int", nullable: false),
|
||||||
@@ -969,15 +987,15 @@ namespace PyroFetes.Migrations
|
|||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_ProductTimecode", x => new { x.ProductId, x.ShowId });
|
table.PrimaryKey("PK_ProductTimecodes", x => new { x.ProductId, x.ShowId });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ProductTimecode_Products_ProductId",
|
name: "FK_ProductTimecodes_Products_ProductId",
|
||||||
column: x => x.ProductId,
|
column: x => x.ProductId,
|
||||||
principalTable: "Products",
|
principalTable: "Products",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ProductTimecode_Shows_ShowId",
|
name: "FK_ProductTimecodes_Shows_ShowId",
|
||||||
column: x => x.ShowId,
|
column: x => x.ShowId,
|
||||||
principalTable: "Shows",
|
principalTable: "Shows",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
@@ -1075,13 +1093,13 @@ namespace PyroFetes.Migrations
|
|||||||
column: "CustomerId");
|
column: "CustomerId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ContactServiceProvider_ServiceProviderId",
|
name: "IX_ContactServiceProviders_ServiceProviderId",
|
||||||
table: "ContactServiceProvider",
|
table: "ContactServiceProviders",
|
||||||
column: "ServiceProviderId");
|
column: "ServiceProviderId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Contract_ServiceProviderId",
|
name: "IX_Contracts_ServiceProviderId",
|
||||||
table: "Contract",
|
table: "Contracts",
|
||||||
column: "ServiceProviderId");
|
column: "ServiceProviderId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
@@ -1105,8 +1123,8 @@ namespace PyroFetes.Migrations
|
|||||||
column: "WarehouseId");
|
column: "WarehouseId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_MaterialWarehouse_WarehouseId",
|
name: "IX_MaterialWarehouses_WarehouseId",
|
||||||
table: "MaterialWarehouse",
|
table: "MaterialWarehouses",
|
||||||
column: "WarehouseId");
|
column: "WarehouseId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
@@ -1155,8 +1173,8 @@ namespace PyroFetes.Migrations
|
|||||||
column: "ProductCategoryId");
|
column: "ProductCategoryId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ProductTimecode_ShowId",
|
name: "IX_ProductTimecodes_ShowId",
|
||||||
table: "ProductTimecode",
|
table: "ProductTimecodes",
|
||||||
column: "ShowId");
|
column: "ShowId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
@@ -1165,9 +1183,9 @@ namespace PyroFetes.Migrations
|
|||||||
column: "ProviderId");
|
column: "ProviderId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Providers_ProviderTypeId",
|
name: "IX_PurchaseOrders_SupplierId",
|
||||||
table: "Providers",
|
table: "PurchaseOrders",
|
||||||
column: "ProviderTypeId");
|
column: "SupplierId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_PurchaseProducts_PurchaseOrderId",
|
name: "IX_PurchaseProducts_PurchaseOrderId",
|
||||||
@@ -1185,8 +1203,13 @@ namespace PyroFetes.Migrations
|
|||||||
column: "CustomerId");
|
column: "CustomerId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ShowMaterial_MaterialId",
|
name: "IX_ServiceProviders_ProviderTypeId",
|
||||||
table: "ShowMaterial",
|
table: "ServiceProviders",
|
||||||
|
column: "ProviderTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShowMaterials_MaterialId",
|
||||||
|
table: "ShowMaterials",
|
||||||
column: "MaterialId");
|
column: "MaterialId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
@@ -1195,13 +1218,13 @@ namespace PyroFetes.Migrations
|
|||||||
column: "CityId");
|
column: "CityId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ShowStaff_ShowId",
|
name: "IX_ShowStaffs_ShowId",
|
||||||
table: "ShowStaff",
|
table: "ShowStaffs",
|
||||||
column: "ShowId");
|
column: "ShowId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ShowTruck_TruckId",
|
name: "IX_ShowTrucks_TruckId",
|
||||||
table: "ShowTruck",
|
table: "ShowTrucks",
|
||||||
column: "TruckId");
|
column: "TruckId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
@@ -1245,16 +1268,16 @@ namespace PyroFetes.Migrations
|
|||||||
name: "Communications");
|
name: "Communications");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ContactServiceProvider");
|
name: "ContactServiceProviders");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Contract");
|
name: "Contracts");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ExperienceLevels");
|
name: "ExperienceLevels");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "MaterialWarehouse");
|
name: "MaterialWarehouses");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Prices");
|
name: "Prices");
|
||||||
@@ -1269,7 +1292,7 @@ namespace PyroFetes.Migrations
|
|||||||
name: "ProductEffects");
|
name: "ProductEffects");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ProductTimecode");
|
name: "ProductTimecodes");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ProviderContacts");
|
name: "ProviderContacts");
|
||||||
@@ -1284,13 +1307,16 @@ namespace PyroFetes.Migrations
|
|||||||
name: "Settings");
|
name: "Settings");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ShowMaterial");
|
name: "ShowMaterials");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ShowStaff");
|
name: "ShowServiceProviders");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ShowTruck");
|
name: "ShowStaffs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShowTrucks");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "SoundTimecodes");
|
name: "SoundTimecodes");
|
||||||
@@ -1310,9 +1336,6 @@ namespace PyroFetes.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "WarehouseProducts");
|
name: "WarehouseProducts");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Suppliers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Colors");
|
name: "Colors");
|
||||||
|
|
||||||
@@ -1323,7 +1346,7 @@ namespace PyroFetes.Migrations
|
|||||||
name: "Effects");
|
name: "Effects");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Providers");
|
name: "ServiceProviders");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "PurchaseOrders");
|
name: "PurchaseOrders");
|
||||||
@@ -1365,7 +1388,10 @@ namespace PyroFetes.Migrations
|
|||||||
name: "ProviderTypes");
|
name: "ProviderTypes");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "City");
|
name: "Suppliers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Cities");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "SoundCategories");
|
name: "SoundCategories");
|
||||||
@@ -503,11 +503,13 @@ 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()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
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");
|
||||||
@@ -693,8 +695,13 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(300)
|
.HasMaxLength(300)
|
||||||
.HasColumnType("nvarchar(300)");
|
.HasColumnType("nvarchar(300)");
|
||||||
|
|
||||||
|
b.Property<int>("SupplierId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SupplierId");
|
||||||
|
|
||||||
b.ToTable("PurchaseOrders");
|
b.ToTable("PurchaseOrders");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1113,8 +1120,9 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(30)
|
.HasMaxLength(30)
|
||||||
.HasColumnType("nvarchar(30)");
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
b.Property<int>("ZipCode")
|
b.Property<string>("ZipCode")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -1178,8 +1186,8 @@ namespace PyroFetes.Migrations
|
|||||||
|
|
||||||
b.Property<string>("Password")
|
b.Property<string>("Password")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(60)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(60)");
|
||||||
|
|
||||||
b.Property<string>("Salt")
|
b.Property<string>("Salt")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
@@ -1223,8 +1231,9 @@ namespace PyroFetes.Migrations
|
|||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("nvarchar(100)");
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
b.Property<int>("ZipCode")
|
b.Property<string>("ZipCode")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -1541,6 +1550,17 @@ namespace PyroFetes.Migrations
|
|||||||
b.Navigation("Provider");
|
b.Navigation("Provider");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PyroFetes.Models.Supplier", "Supplier")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SupplierId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Supplier");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b =>
|
modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PyroFetes.Models.Product", "Product")
|
b.HasOne("PyroFetes.Models.Product", "Product")
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ namespace PyroFetes.Models
|
|||||||
[Required, MaxLength(20)] public string? Reference { get; set; }
|
[Required, MaxLength(20)] public string? Reference { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name { get; set; }
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required] public decimal Duration {get; set;}
|
[Required] public decimal Duration {get; set;}
|
||||||
[Required] public decimal Caliber { get; set; }
|
[Required] public int Caliber { get; set; }
|
||||||
[Required] public int ApprovalNumber { get; set; }
|
[Required, MaxLength(100)] public string? ApprovalNumber { get; set; }
|
||||||
[Required] public decimal Weight { get; set; }
|
[Required] public decimal Weight { get; set; }
|
||||||
[Required] public decimal Nec { get; set; }
|
[Required] public decimal Nec { get; set; }
|
||||||
[Required] public string? Image { get; set; }
|
[Required] public string? Image { get; set; }
|
||||||
|
|||||||
@@ -7,5 +7,7 @@ public class PurchaseOrder
|
|||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(300)] public string? PurchaseConditions { get; set; }
|
[Required, MaxLength(300)] public string? PurchaseConditions { get; set; }
|
||||||
|
|
||||||
|
[Required] public int SupplierId { get; set; }
|
||||||
|
public Supplier? Supplier { get; set; }
|
||||||
public List<PurchaseProduct>? PurchaseProducts { get; set; }
|
public List<PurchaseProduct>? PurchaseProducts { get; set; }
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ public class Supplier
|
|||||||
[Required, MaxLength(100)] public string? Email { get; set; }
|
[Required, MaxLength(100)] public string? Email { get; set; }
|
||||||
[Required, MaxLength(30)] public string? Phone { get; set; }
|
[Required, MaxLength(30)] public string? Phone { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Address { get; set; }
|
[Required, MaxLength(100)] public string? Address { get; set; }
|
||||||
[Required,MaxLength(5),MinLength(5)] public string? ZipCode { get; set; }
|
[Required,Length(5,5)] public string? ZipCode { get; set; }
|
||||||
[Required, MaxLength(100)] public string? City { get; set; }
|
[Required, MaxLength(100)] public string? City { get; set; }
|
||||||
[Required] public int DeliveryDelay { get; set; }
|
[Required] public int DeliveryDelay { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class User
|
|||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Name { get; set; }
|
[Required, MaxLength(100)] public string? Name { get; set; }
|
||||||
[Required, MinLength(12), MaxLength(50)] public string? Password { get; set; }
|
[Required, MaxLength(60)] public string? Password { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Salt { get; set; }
|
[Required, MaxLength(100)] public string? Salt { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Email { get; set; }
|
[Required, MaxLength(100)] public string? Email { get; set; }
|
||||||
[Required, MaxLength(100)] public string? Fonction { get; set; }
|
[Required, MaxLength(100)] public string? Fonction { get; set; }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class Warehouse
|
|||||||
[Required] public int Current {get; set;}
|
[Required] public int Current {get; set;}
|
||||||
[Required] public int MinWeight {get; set;}
|
[Required] public int MinWeight {get; set;}
|
||||||
[Required, MaxLength(100)] public string? Address { get; set; }
|
[Required, MaxLength(100)] public string? Address { get; set; }
|
||||||
[Required] public int ZipCode { get; set; }
|
[Required, Length(5,5)] public string? ZipCode { get; set; }
|
||||||
[Required, MaxLength(100)] public string? City { get; set; }
|
[Required, MaxLength(100)] public string? City { get; set; }
|
||||||
|
|
||||||
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
public List<WarehouseProduct>? WarehouseProducts { get; set; }
|
||||||
|
|||||||
@@ -4,17 +4,37 @@ using PyroFetes;
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using FastEndpoints.Swagger;
|
using FastEndpoints.Swagger;
|
||||||
using FastEndpoints.Security;
|
using FastEndpoints.Security;
|
||||||
|
using Microsoft.Net.Http.Headers;
|
||||||
using PyroFetes.MappingProfiles;
|
using PyroFetes.MappingProfiles;
|
||||||
using PyroFetes.Repositories;
|
using PyroFetes.Repositories;
|
||||||
|
using PyroFetes.Services.Pdf;
|
||||||
|
using QuestPDF.Infrastructure;
|
||||||
|
|
||||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Configurer la licence QuestPDF
|
||||||
|
QuestPDF.Settings.License = LicenseType.Community;
|
||||||
|
|
||||||
// On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet
|
// On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet
|
||||||
builder.Services
|
builder.Services
|
||||||
.AddAuthenticationJwtBearer(s => s.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong")
|
.AddAuthenticationJwtBearer(s => s.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong")
|
||||||
.AddAuthorization()
|
.AddAuthorization()
|
||||||
.AddFastEndpoints()
|
.AddFastEndpoints()
|
||||||
.SwaggerDocument();
|
.SwaggerDocument(options =>
|
||||||
|
{
|
||||||
|
options.ShortSchemaNames = true;
|
||||||
|
})
|
||||||
|
.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddDefaultPolicy(policyBuilder =>
|
||||||
|
{
|
||||||
|
policyBuilder
|
||||||
|
.WithOrigins("http://localhost:4200")
|
||||||
|
.WithMethods("GET", "POST", "PUT", "DELETE", "PATCH")
|
||||||
|
.AllowAnyHeader()
|
||||||
|
.WithExposedHeaders(HeaderNames.ContentDisposition);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// On ajoute ici la configuration de la base de données
|
// On ajoute ici la configuration de la base de données
|
||||||
builder.Services.AddDbContext<PyroFetesDbContext>();
|
builder.Services.AddDbContext<PyroFetesDbContext>();
|
||||||
@@ -30,6 +50,13 @@ builder.Services.AddScoped<QuotationProductsRepository>();
|
|||||||
builder.Services.AddScoped<QuotationsRepository>();
|
builder.Services.AddScoped<QuotationsRepository>();
|
||||||
builder.Services.AddScoped<SuppliersRepository>();
|
builder.Services.AddScoped<SuppliersRepository>();
|
||||||
builder.Services.AddScoped<SettingsRepository>();
|
builder.Services.AddScoped<SettingsRepository>();
|
||||||
|
builder.Services.AddScoped<UsersRepository>();
|
||||||
|
builder.Services.AddScoped<WarehouseProductsRepository>();
|
||||||
|
|
||||||
|
// Ajout des services
|
||||||
|
builder.Services.AddScoped<IDeliveryNotePdfService, DeliveryNotePdfService>();
|
||||||
|
builder.Services.AddScoped<IPurchaseOrderPdfService, PurchaseOrderPdfService>();
|
||||||
|
builder.Services.AddScoped<IQuotationPdfService, QuotationPdfService>();
|
||||||
|
|
||||||
MapperConfiguration mappingConfig = new(mc =>
|
MapperConfiguration mappingConfig = new(mc =>
|
||||||
{
|
{
|
||||||
@@ -46,9 +73,15 @@ builder.Services.AddSingleton(mapper);
|
|||||||
WebApplication app = builder.Build();
|
WebApplication app = builder.Build();
|
||||||
app.UseAuthentication()
|
app.UseAuthentication()
|
||||||
.UseAuthorization()
|
.UseAuthorization()
|
||||||
.UseFastEndpoints()
|
.UseFastEndpoints(options =>
|
||||||
|
{
|
||||||
|
options.Endpoints.ShortNames = true;
|
||||||
|
options.Endpoints.RoutePrefix = "API";
|
||||||
|
})
|
||||||
.UseSwaggerGen();
|
.UseSwaggerGen();
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseCors();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
@@ -23,7 +23,25 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.20" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.20" />
|
||||||
<PackageReference Include="PasswordGenerator" Version="2.1.0" />
|
<PackageReference Include="PasswordGenerator" Version="2.1.0" />
|
||||||
<PackageReference Include="Plainquire.Page" Version="6.5.0" />
|
<PackageReference Include="Plainquire.Page" Version="6.5.0" />
|
||||||
|
<PackageReference Include="QuestPDF" Version="2025.7.4" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<_ContentIncludedByDefault Remove="wwwroot\Images\logo.jpg" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="wwwroot\Images\logo.jpg">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="wwwroot\Images\signature.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Migrations\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user