25 Commits

Author SHA1 Message Date
Cristiano
fe58e5e7e7 Firs fixes like price into PDF 2026-03-26 17:23:09 +01:00
Cristiano
9c723a7a10 Merge remote-tracking branch 'origin/develop' into develop 2026-03-26 15:36:28 +01:00
Cristiano
0312f02028 Some fixes 2026-03-26 15:35:11 +01:00
418c2b3d16 fix error 2025-12-20 15:39:05 +01:00
Cristiano
3487baad87 Added endpoint to get products under their limit 2025-12-18 14:41:45 +01:00
29e2036965 fix error 2025-12-13 15:34:29 +01:00
be7a3193ab added CreateQuotationEndpoint.cs 2025-12-13 15:08:18 +01:00
0802ec9e33 new migration 2025-12-13 11:39:56 +01:00
35d3e58d86 fix error and add CreatePurchaseOrder.cs 2025-12-13 11:24:01 +01:00
2a42e1010f fix error 2025-12-12 21:57:58 +01:00
2fa74ccba8 added UpdateQuotationDto.cs 2025-12-12 21:18:13 +01:00
65cff130e4 update deliverynote endpoint 2025-12-11 17:46:23 +01:00
e21e2afea4 fix error 2025-12-04 17:11:34 +01:00
17978e7c19 change response in endpoint to generate pdf 2025-12-04 16:38:27 +01:00
6a20676b32 added showcompagnon 2025-12-04 15:06:36 +01:00
e440dcd2b5 added pdf generation for all orders 2025-12-03 17:41:19 +01:00
bee1cfb0e3 added PDF generation for quotation 2025-12-03 17:00:02 +01:00
d709654410 fix error in GetTotalQuantityEndpoint.cs 2025-11-30 16:59:28 +01:00
4a82c51133 fixed errors 2025-11-30 15:43:59 +01:00
8a04adeec3 updated GetSupplierDto.cs 2025-11-30 15:35:08 +01:00
db9219e80f fix error in PatchRealDeliveryDateEndpoint.cs 2025-11-30 14:50:21 +01:00
9e6834754f added DeleteDeliveryNoteEndpoint.cs 2025-11-30 14:23:30 +01:00
efa7a0be6f added DeleteProductEndpoint.cs 2025-11-29 21:58:20 +01:00
2a439ccbb5 added mapper 2025-11-28 09:51:12 +01:00
5c6798a647 fixed errors 2025-11-27 17:24:48 +01:00
69 changed files with 1882 additions and 14904 deletions

View File

@@ -0,0 +1,6 @@
namespace PyroFetes.DTO.DeliveryNote.Request;
public class GetDeliveryNotePdfDto
{
public int Id { get; set; }
}

View File

@@ -10,16 +10,16 @@ public class GetPriceDto
public string? SupplierEmail { get; set; }
public string? SupplierPhone { get; set; }
public string? SupplierAddress { get; set; }
public int SupplierZipCode { get; set; }
public string? SupplierZipCode { get; set; }
public string? SupplierCity { get; set; }
public int SupplierDeliveryDelay { get; set; }
public int ProductId { get; set; }
public string? ProductReferences { get; set; }
public string? ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }

View File

@@ -3,11 +3,11 @@ namespace PyroFetes.DTO.ProductDelivery.Response;
public class GetProductDeliveryDto
{
public int ProductId { get; set; }
public int ProductReference { get; set; }
public string? ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }

View File

@@ -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; }
}

View File

@@ -0,0 +1,6 @@
namespace PyroFetes.DTO.PurchaseOrder.Request;
public class GetPurchaseOrderPdfDto
{
public int Id { get; set; }
}

View File

@@ -6,5 +6,5 @@ public class GetPurchaseOrderDto
{
public int Id { get; set; }
public string? PurchaseConditions { get; set; }
public List<GetPurchaseProductDto>? GetPurchaseProductDto { get; set; }
public List<GetPurchaseProductDto>? Products { get; set; }
}

View File

@@ -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; }
}

View File

@@ -7,11 +7,11 @@ public class UpdatePurchaseProductDto
public int Quantity { get; set; }
public int ProductReferences { get; set; }
public string? ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }

View File

@@ -6,13 +6,14 @@ public class GetPurchaseProductDto
public string? ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
public decimal ProductPrice { get; set; }
public int PurchaseOrderId { get; set; }
public string? PurchaseOrderPurchaseConditions { get; set; }

View 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; }
}

View File

@@ -0,0 +1,6 @@
namespace PyroFetes.DTO.Quotation.Request;
public class GetQuotationPdfDto
{
public int Id { get; set; }
}

View 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; }
}

View File

@@ -7,5 +7,5 @@ public class GetQuotationDto
public int Id { get; set; }
public string? Message { get; set; }
public string? ConditionsSale { get; set; }
public List<GetQuotationProductDto>? GetQuotationProductDto { get; set; }
public List<GetQuotationProductDto>? Products { get; set; }
}

View File

@@ -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; }
}

View File

@@ -12,8 +12,8 @@ public class CreateQuotationProductDto
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }

View File

@@ -13,8 +13,8 @@ public class UpdateQuotationProductDto
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }

View File

@@ -12,8 +12,8 @@ public class GetQuotationProductDto
public string? ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }

View File

@@ -1,3 +1,6 @@
using PyroFetes.DTO.Price.Response;
using PyroFetes.DTO.Product.Response;
namespace PyroFetes.DTO.Supplier.Response;
public class GetSupplierDto
@@ -10,4 +13,6 @@ public class GetSupplierDto
public string? ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
public List<GetProductDto>? Products { get; set; }
public List<GetPriceDto>? Prices { get; set; }
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -30,6 +30,12 @@ public class PatchRealDeliveryDateEndpoint(
return;
}
if (deliveryNoteToPath.RealDeliveryDate != null)
{
await Send.StringAsync("Impossible de modifier la date.", 400);
return;
}
deliveryNoteToPath.RealDeliveryDate = req.RealDeliveryDate;
await deliveryNotesRepository.UpdateAsync(deliveryNoteToPath, ct);

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View 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);
}
}

View File

@@ -1,8 +1,6 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Quotation.Request;
using PyroFetes.DTO.Quotation.Response;
using PyroFetes.DTO.QuotationProduct.Response;
using PyroFetes.Models;
using PyroFetes.Repositories;
using PyroFetes.Specifications.Quotations;

View 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);
}
}

View File

@@ -4,6 +4,7 @@ using PyroFetes.DTO.User.Request;
using PyroFetes.DTO.User.Response;
using PyroFetes.Models;
using PyroFetes.Repositories;
using PyroFetes.Specifications.Users;
namespace PyroFetes.Endpoints.Users;
@@ -19,6 +20,14 @@ public class CreateUserEndpoint(
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();
User user = new User()

View File

@@ -30,7 +30,7 @@ public class UpdateUserEndpoint(
return;
}
if (ckeckName != null)
if (ckeckName != null && ckeckName.Id != user.Id)
{
await Send.StringAsync("Ce nom d'utilisateur existe déjà.",409, cancellation: ct);
return;

View File

@@ -31,9 +31,10 @@ public class GetTotalQuantityEndpoint(
return;
}
int totalQuantity =
await warehouseProductsRepository.SumAsync(new GetProductTotalQuantitySpec(req.ProductId),
wp => wp.Quantity, ct);
int? totalQuantityNullable = await warehouseProductsRepository.
SumAsync(new GetProductTotalQuantitySpec(req.ProductId), wp => wp.Quantity, ct);
int totalQuantity = totalQuantityNullable ?? 0;
GetTotalQuantityDto responseDto = new()
{

View File

@@ -38,6 +38,7 @@ public class DtoToEntityMappings : Profile
CreateMap<CreateProductDeliveryDto, ProductDelivery>();
CreateMap<UpdateProductDeliveryDto, ProductDelivery>();
CreateMap<CreatePurchaseOrderDto, PurchaseOrder>();
CreateMap<PatchPurchaseOrderPurchaseConditionsDto,PurchaseOrder>();
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
@@ -46,6 +47,7 @@ public class DtoToEntityMappings : Profile
CreateMap<PatchQuotationConditionsSaleDto, Quotation>();
CreateMap<PatchQuotationMessageDto, Quotation>();
CreateMap<CreateProductQuotationDto, Quotation>();
CreateMap<CreateQuotationProductDto, QuotationProduct>();
CreateMap<UpdateQuotationProductDto, QuotationProduct>();

View File

@@ -9,6 +9,7 @@ using PyroFetes.DTO.PurchaseProduct.Response;
using PyroFetes.DTO.Quotation.Response;
using PyroFetes.DTO.QuotationProduct.Response;
using PyroFetes.DTO.SettingDTO.Response;
using PyroFetes.DTO.Supplier.Response;
using PyroFetes.DTO.User.Response;
using PyroFetes.DTO.WareHouseProduct.Response;
using PyroFetes.Models;
@@ -20,25 +21,52 @@ public class EntityToDtoMappings : Profile
public EntityToDtoMappings()
{
CreateMap<Deliverer, GetDelivererDto>();
CreateMap<Supplier, GetSupplierDto>();
CreateMap<DeliveryNote, GetDeliveryNoteDto>();
CreateMap<Price, GetPriceDto>();
CreateMap<Product, GetProductDto>();
CreateMap<ProductDelivery, GetProductDeliveryDto>();
CreateMap<PurchaseOrder, GetPurchaseOrderDto>();
CreateMap<PurchaseProduct, GetPurchaseProductDto>();
CreateMap<Quotation, GetQuotationDto>();
CreateMap<QuotationProduct, GetQuotationProductDto>();
// CreateMap<PurchaseOrder, GetPurchaseOrderDto>();
//
//CreateMap<PurchaseProduct, GetPurchaseProductDto>();
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
.ForMember(dest => dest.Products,
opt => opt.MapFrom(src => src.PurchaseProducts));
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<User, GetUserDto>();
CreateMap<WarehouseProduct, GetWareHouseProductDto>();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,68 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class FixTypeErrors : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ZipCode",
table: "Suppliers",
type: "nvarchar(5)",
maxLength: 5,
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<int>(
name: "Caliber",
table: "Products",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<string>(
name: "ApprovalNumber",
table: "Products",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "ZipCode",
table: "Suppliers",
type: "int",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(5)",
oldMaxLength: 5);
migrationBuilder.AlterColumn<decimal>(
name: "Caliber",
table: "Products",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<int>(
name: "ApprovalNumber",
table: "Products",
type: "int",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class UpdatedDatabaseProductType : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ApprovalNumber",
table: "Products",
type: "nvarchar(100)",
maxLength: 100,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ApprovalNumber",
table: "Products",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class UpdatedLengthOfPassword : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Password",
table: "Users",
type: "nvarchar(60)",
maxLength: 60,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Password",
table: "Users",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(60)",
oldMaxLength: 60);
}
}
}

View File

@@ -1,52 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class FixZipCode : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ZipCode",
table: "Warehouses",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<string>(
name: "ZipCode",
table: "Suppliers",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(5)",
oldMaxLength: 5);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "ZipCode",
table: "Warehouses",
type: "int",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "ZipCode",
table: "Suppliers",
type: "nvarchar(5)",
maxLength: 5,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
}
}

View File

@@ -12,8 +12,8 @@ using PyroFetes;
namespace PyroFetes.Migrations
{
[DbContext(typeof(PyroFetesDbContext))]
[Migration("20251127133430_FixZipCode")]
partial class FixZipCode
[Migration("20260326145104_AddSupplierToPurchaseOrder")]
partial class AddSupplierToPurchaseOrder
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -698,8 +698,13 @@ namespace PyroFetes.Migrations
.HasMaxLength(300)
.HasColumnType("nvarchar(300)");
b.Property<int>("SupplierId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("SupplierId");
b.ToTable("PurchaseOrders");
});
@@ -1548,6 +1553,17 @@ namespace PyroFetes.Migrations
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 =>
{
b.HasOne("PyroFetes.Models.Product", "Product")

View File

@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class InitialDatabase : Migration
public partial class AddSupplierToPurchaseOrder : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@@ -28,7 +28,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "City",
name: "Cities",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
@@ -38,7 +38,7 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_City", x => x.Id);
table.PrimaryKey("PK_Cities", x => x.Id);
});
migrationBuilder.CreateTable(
@@ -146,19 +146,6 @@ namespace PyroFetes.Migrations
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(
name: "Settings",
columns: table => new
@@ -173,6 +160,18 @@ namespace PyroFetes.Migrations
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(
name: "SoundCategories",
columns: table => new
@@ -214,7 +213,7 @@ namespace PyroFetes.Migrations
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Phone = table.Column<string>(type: "nvarchar(30)", maxLength: 30, 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),
DeliveryDelay = table.Column<int>(type: "int", nullable: false)
},
@@ -246,7 +245,7 @@ namespace PyroFetes.Migrations
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
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),
Email = 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),
MinWeight = table.Column<int>(type: "int", 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)
},
constraints: table =>
@@ -292,9 +291,9 @@ namespace PyroFetes.Migrations
{
table.PrimaryKey("PK_Shows", x => x.Id);
table.ForeignKey(
name: "FK_Shows_City_CityId",
name: "FK_Shows_Cities_CityId",
column: x => x.CityId,
principalTable: "City",
principalTable: "Cities",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@@ -329,7 +328,7 @@ namespace PyroFetes.Migrations
DelivererId = table.Column<int>(type: "int", nullable: false),
EstimateDeliveryDate = 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 =>
{
@@ -343,7 +342,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "Providers",
name: "ServiceProviders",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
@@ -353,9 +352,9 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_Providers", x => x.Id);
table.PrimaryKey("PK_ServiceProviders", x => x.Id);
table.ForeignKey(
name: "FK_Providers_ProviderTypes_ProviderTypeId",
name: "FK_ServiceProviders_ProviderTypes_ProviderTypeId",
column: x => x.ProviderTypeId,
principalTable: "ProviderTypes",
principalColumn: "Id",
@@ -456,6 +455,26 @@ namespace PyroFetes.Migrations
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(
name: "Materials",
columns: table => new
@@ -508,7 +527,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "ShowStaff",
name: "ShowStaffs",
columns: table => new
{
StaffId = table.Column<int>(type: "int", nullable: false),
@@ -516,15 +535,15 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_ShowStaff", x => new { x.StaffId, x.ShowId });
table.PrimaryKey("PK_ShowStaffs", x => new { x.StaffId, x.ShowId });
table.ForeignKey(
name: "FK_ShowStaff_Shows_ShowId",
name: "FK_ShowStaffs_Shows_ShowId",
column: x => x.ShowId,
principalTable: "Shows",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ShowStaff_Staffs_StaffId",
name: "FK_ShowStaffs_Staffs_StaffId",
column: x => x.StaffId,
principalTable: "Staffs",
principalColumn: "Id",
@@ -532,7 +551,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "ShowTruck",
name: "ShowTrucks",
columns: table => new
{
ShowId = table.Column<int>(type: "int", nullable: false),
@@ -540,15 +559,15 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_ShowTruck", x => new { x.ShowId, x.TruckId });
table.PrimaryKey("PK_ShowTrucks", x => new { x.ShowId, x.TruckId });
table.ForeignKey(
name: "FK_ShowTruck_Shows_ShowId",
name: "FK_ShowTrucks_Shows_ShowId",
column: x => x.ShowId,
principalTable: "Shows",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ShowTruck_Trucks_TruckId",
name: "FK_ShowTrucks_Trucks_TruckId",
column: x => x.TruckId,
principalTable: "Trucks",
principalColumn: "Id",
@@ -604,7 +623,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "Contract",
name: "Contracts",
columns: table => new
{
ShowId = table.Column<int>(type: "int", nullable: false),
@@ -613,15 +632,15 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_Contract", x => new { x.ShowId, x.ServiceProviderId });
table.PrimaryKey("PK_Contracts", x => new { x.ShowId, x.ServiceProviderId });
table.ForeignKey(
name: "FK_Contract_Providers_ServiceProviderId",
name: "FK_Contracts_ServiceProviders_ServiceProviderId",
column: x => x.ServiceProviderId,
principalTable: "Providers",
principalTable: "ServiceProviders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Contract_Shows_ShowId",
name: "FK_Contracts_Shows_ShowId",
column: x => x.ShowId,
principalTable: "Shows",
principalColumn: "Id",
@@ -655,7 +674,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "MaterialWarehouse",
name: "MaterialWarehouses",
columns: table => new
{
MaterialId = table.Column<int>(type: "int", nullable: false),
@@ -663,15 +682,15 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_MaterialWarehouse", x => new { x.MaterialId, x.WarehouseId });
table.PrimaryKey("PK_MaterialWarehouses", x => new { x.MaterialId, x.WarehouseId });
table.ForeignKey(
name: "FK_MaterialWarehouse_Materials_MaterialId",
name: "FK_MaterialWarehouses_Materials_MaterialId",
column: x => x.MaterialId,
principalTable: "Materials",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MaterialWarehouse_Warehouses_WarehouseId",
name: "FK_MaterialWarehouses_Warehouses_WarehouseId",
column: x => x.WarehouseId,
principalTable: "Warehouses",
principalColumn: "Id",
@@ -679,7 +698,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "ShowMaterial",
name: "ShowMaterials",
columns: table => new
{
ShowId = table.Column<int>(type: "int", nullable: false),
@@ -687,15 +706,15 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_ShowMaterial", x => new { x.ShowId, x.MaterialId });
table.PrimaryKey("PK_ShowMaterials", x => new { x.ShowId, x.MaterialId });
table.ForeignKey(
name: "FK_ShowMaterial_Materials_MaterialId",
name: "FK_ShowMaterials_Materials_MaterialId",
column: x => x.MaterialId,
principalTable: "Materials",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ShowMaterial_Shows_ShowId",
name: "FK_ShowMaterials_Shows_ShowId",
column: x => x.ShowId,
principalTable: "Shows",
principalColumn: "Id",
@@ -708,14 +727,13 @@ namespace PyroFetes.Migrations
{
Id = table.Column<int>(type: "int", nullable: false)
.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),
Duration = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Caliber = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
ApprovalNumber = table.Column<int>(type: "int", nullable: false),
Caliber = 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),
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),
Link = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
MinimalQuantity = table.Column<int>(type: "int", nullable: false),
@@ -769,7 +787,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "ContactServiceProvider",
name: "ContactServiceProviders",
columns: table => new
{
ContactId = table.Column<int>(type: "int", nullable: false),
@@ -777,17 +795,17 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_ContactServiceProvider", x => new { x.ContactId, x.ServiceProviderId });
table.PrimaryKey("PK_ContactServiceProviders", x => new { x.ContactId, x.ServiceProviderId });
table.ForeignKey(
name: "FK_ContactServiceProvider_Contacts_ContactId",
name: "FK_ContactServiceProviders_Contacts_ContactId",
column: x => x.ContactId,
principalTable: "Contacts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ContactServiceProvider_Providers_ServiceProviderId",
name: "FK_ContactServiceProviders_ServiceProviders_ServiceProviderId",
column: x => x.ServiceProviderId,
principalTable: "Providers",
principalTable: "ServiceProviders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@@ -809,9 +827,9 @@ namespace PyroFetes.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProviderContacts_Providers_ProviderId",
name: "FK_ProviderContacts_ServiceProviders_ProviderId",
column: x => x.ProviderId,
principalTable: "Providers",
principalTable: "ServiceProviders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@@ -959,7 +977,7 @@ namespace PyroFetes.Migrations
});
migrationBuilder.CreateTable(
name: "ProductTimecode",
name: "ProductTimecodes",
columns: table => new
{
ProductId = table.Column<int>(type: "int", nullable: false),
@@ -969,15 +987,15 @@ namespace PyroFetes.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_ProductTimecode", x => new { x.ProductId, x.ShowId });
table.PrimaryKey("PK_ProductTimecodes", x => new { x.ProductId, x.ShowId });
table.ForeignKey(
name: "FK_ProductTimecode_Products_ProductId",
name: "FK_ProductTimecodes_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProductTimecode_Shows_ShowId",
name: "FK_ProductTimecodes_Shows_ShowId",
column: x => x.ShowId,
principalTable: "Shows",
principalColumn: "Id",
@@ -1075,13 +1093,13 @@ namespace PyroFetes.Migrations
column: "CustomerId");
migrationBuilder.CreateIndex(
name: "IX_ContactServiceProvider_ServiceProviderId",
table: "ContactServiceProvider",
name: "IX_ContactServiceProviders_ServiceProviderId",
table: "ContactServiceProviders",
column: "ServiceProviderId");
migrationBuilder.CreateIndex(
name: "IX_Contract_ServiceProviderId",
table: "Contract",
name: "IX_Contracts_ServiceProviderId",
table: "Contracts",
column: "ServiceProviderId");
migrationBuilder.CreateIndex(
@@ -1105,8 +1123,8 @@ namespace PyroFetes.Migrations
column: "WarehouseId");
migrationBuilder.CreateIndex(
name: "IX_MaterialWarehouse_WarehouseId",
table: "MaterialWarehouse",
name: "IX_MaterialWarehouses_WarehouseId",
table: "MaterialWarehouses",
column: "WarehouseId");
migrationBuilder.CreateIndex(
@@ -1155,8 +1173,8 @@ namespace PyroFetes.Migrations
column: "ProductCategoryId");
migrationBuilder.CreateIndex(
name: "IX_ProductTimecode_ShowId",
table: "ProductTimecode",
name: "IX_ProductTimecodes_ShowId",
table: "ProductTimecodes",
column: "ShowId");
migrationBuilder.CreateIndex(
@@ -1165,9 +1183,9 @@ namespace PyroFetes.Migrations
column: "ProviderId");
migrationBuilder.CreateIndex(
name: "IX_Providers_ProviderTypeId",
table: "Providers",
column: "ProviderTypeId");
name: "IX_PurchaseOrders_SupplierId",
table: "PurchaseOrders",
column: "SupplierId");
migrationBuilder.CreateIndex(
name: "IX_PurchaseProducts_PurchaseOrderId",
@@ -1185,8 +1203,13 @@ namespace PyroFetes.Migrations
column: "CustomerId");
migrationBuilder.CreateIndex(
name: "IX_ShowMaterial_MaterialId",
table: "ShowMaterial",
name: "IX_ServiceProviders_ProviderTypeId",
table: "ServiceProviders",
column: "ProviderTypeId");
migrationBuilder.CreateIndex(
name: "IX_ShowMaterials_MaterialId",
table: "ShowMaterials",
column: "MaterialId");
migrationBuilder.CreateIndex(
@@ -1195,13 +1218,13 @@ namespace PyroFetes.Migrations
column: "CityId");
migrationBuilder.CreateIndex(
name: "IX_ShowStaff_ShowId",
table: "ShowStaff",
name: "IX_ShowStaffs_ShowId",
table: "ShowStaffs",
column: "ShowId");
migrationBuilder.CreateIndex(
name: "IX_ShowTruck_TruckId",
table: "ShowTruck",
name: "IX_ShowTrucks_TruckId",
table: "ShowTrucks",
column: "TruckId");
migrationBuilder.CreateIndex(
@@ -1245,16 +1268,16 @@ namespace PyroFetes.Migrations
name: "Communications");
migrationBuilder.DropTable(
name: "ContactServiceProvider");
name: "ContactServiceProviders");
migrationBuilder.DropTable(
name: "Contract");
name: "Contracts");
migrationBuilder.DropTable(
name: "ExperienceLevels");
migrationBuilder.DropTable(
name: "MaterialWarehouse");
name: "MaterialWarehouses");
migrationBuilder.DropTable(
name: "Prices");
@@ -1269,7 +1292,7 @@ namespace PyroFetes.Migrations
name: "ProductEffects");
migrationBuilder.DropTable(
name: "ProductTimecode");
name: "ProductTimecodes");
migrationBuilder.DropTable(
name: "ProviderContacts");
@@ -1284,13 +1307,16 @@ namespace PyroFetes.Migrations
name: "Settings");
migrationBuilder.DropTable(
name: "ShowMaterial");
name: "ShowMaterials");
migrationBuilder.DropTable(
name: "ShowStaff");
name: "ShowServiceProviders");
migrationBuilder.DropTable(
name: "ShowTruck");
name: "ShowStaffs");
migrationBuilder.DropTable(
name: "ShowTrucks");
migrationBuilder.DropTable(
name: "SoundTimecodes");
@@ -1310,9 +1336,6 @@ namespace PyroFetes.Migrations
migrationBuilder.DropTable(
name: "WarehouseProducts");
migrationBuilder.DropTable(
name: "Suppliers");
migrationBuilder.DropTable(
name: "Colors");
@@ -1323,7 +1346,7 @@ namespace PyroFetes.Migrations
name: "Effects");
migrationBuilder.DropTable(
name: "Providers");
name: "ServiceProviders");
migrationBuilder.DropTable(
name: "PurchaseOrders");
@@ -1365,7 +1388,10 @@ namespace PyroFetes.Migrations
name: "ProviderTypes");
migrationBuilder.DropTable(
name: "City");
name: "Suppliers");
migrationBuilder.DropTable(
name: "Cities");
migrationBuilder.DropTable(
name: "SoundCategories");

View File

@@ -695,8 +695,13 @@ namespace PyroFetes.Migrations
.HasMaxLength(300)
.HasColumnType("nvarchar(300)");
b.Property<int>("SupplierId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("SupplierId");
b.ToTable("PurchaseOrders");
});
@@ -1545,6 +1550,17 @@ namespace PyroFetes.Migrations
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 =>
{
b.HasOne("PyroFetes.Models.Product", "Product")

View File

@@ -7,5 +7,7 @@ public class PurchaseOrder
[Key] public int Id { 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; }
}

View File

@@ -4,11 +4,17 @@ using PyroFetes;
using FastEndpoints;
using FastEndpoints.Swagger;
using FastEndpoints.Security;
using Microsoft.Net.Http.Headers;
using PyroFetes.MappingProfiles;
using PyroFetes.Repositories;
using PyroFetes.Services.Pdf;
using QuestPDF.Infrastructure;
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
builder.Services
.AddAuthenticationJwtBearer(s => s.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong")
@@ -25,7 +31,8 @@ builder.Services
policyBuilder
.WithOrigins("http://localhost:4200")
.WithMethods("GET", "POST", "PUT", "DELETE", "PATCH")
.AllowAnyHeader();
.AllowAnyHeader()
.WithExposedHeaders(HeaderNames.ContentDisposition);
});
});
@@ -46,6 +53,11 @@ 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 =>
{
mc.AddCollectionMappers();

View File

@@ -23,7 +23,25 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.20" />
<PackageReference Include="PasswordGenerator" Version="2.1.0" />
<PackageReference Include="Plainquire.Page" Version="6.5.0" />
<PackageReference Include="QuestPDF" Version="2025.7.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
</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>

View File

@@ -63,13 +63,15 @@ public class PyroFetesDbContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
string connectionString =
"Server=romaric-thibault.fr;" +
"Database=PyroFetes;" +
"User Id=pyrofetes;" +
"Password=Crablike8-Fringe-Swimmable;" +
"Server=localhost,1433;" +
"Database=pyrofetes-db;" +
"User Id=sa;" +
"Password=AdminMotDePasse!;" +
"TrustServerCertificate=true;";
optionsBuilder.UseSqlServer(connectionString);
}
// Models customization

View File

@@ -0,0 +1,133 @@
using PyroFetes.Models;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace PyroFetes.Services.Pdf;
public interface IDeliveryNotePdfService
{
byte[] Generate(DeliveryNote deliveryNote, List<ProductDelivery> lignes);
}
public class DeliveryNotePdfService : IDeliveryNotePdfService
{
public byte[] Generate(DeliveryNote deliveryNote, List<ProductDelivery> lignes)
{
var logoPath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "Images", "logo.jpg");
var signaturePath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "Images", "signature.png");
int total = 0;
int totalQuantity = 0;
var document = Document.Create(container =>
{
container.Page(page =>
{
page.Size(PageSizes.A4);
page.Margin(30);
page.DefaultTextStyle(x => x.FontSize(11));
page.Header().Row(row =>
{
// Client à gauche
row.RelativeItem().Column(col =>
{
col.Item().Text("");
col.Item().Text("");
col.Item().Text("");
col.Item().Text("");
col.Item().Text("Transporteur").SemiBold().FontSize(12);
col.Item().Text($"{deliveryNote.Deliverer?.Transporter}");
col.Item().Height(5);
col.Item().AlignLeft().Text($"Expédiée le {deliveryNote.ExpeditionDate}");
col.Item().Height(5);
col.Item().AlignLeft().Text($"Estimée au {deliveryNote.EstimateDeliveryDate}");
col.Item().Height(5);
col.Item().AlignLeft().Text($"Reçu le {deliveryNote.RealDeliveryDate}");
});
// Logo + société à droite
row.ConstantItem(200).Column(col =>
{
col.Item().AlignRight().Height(70).Image(logoPath, ImageScaling.FitArea);
col.Item().Height(20);
col.Item().AlignRight().Text("Pyro-Fêtes").SemiBold();
col.Item().Height(5);
col.Item().AlignRight().Text("24, rue La Fosse Mardeau\n41700 Le Controis-en-Sologne");
col.Item().Height(5);
col.Item().AlignRight().Text("Téléphone: 02 54 78 77 66");
col.Item().Height(5);
col.Item().AlignRight().Text("SIRET: 82031463100012");
col.Item().Height(40);
});
});
page.Content().Column(col =>
{
// Titre + date
col.Item().Row(row =>
{
row.RelativeItem().Text($"Bon de livraison n° {deliveryNote.TrackingNumber}")
.FontSize(16).SemiBold();
});
col.Item().Height(20);
col.Item().LineHorizontal(1);
// Tableau des lignes
col.Item().Table(table =>
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(4); // Produit
columns.RelativeColumn(2); // Qté
columns.RelativeColumn(2); // PU
columns.RelativeColumn(2); // Total
});
// En-têtes
table.Header(header =>
{
header.Cell().Element(CellHeader).Text("Produit");
header.Cell().Element(CellHeader).AlignRight().Text("Qté");
header.Cell().Element(CellHeader).AlignRight().Text("PU");
header.Cell().Element(CellHeader).AlignRight().Text("Total");
});
foreach (var l in lignes)
{
table.Cell().Element(CellBody).Text(l.Product?.Name);
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity:n2} €");
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * l.Quantity:n2} €");
totalQuantity += l.Quantity;
total += l.Quantity * l.Quantity;
}
IContainer CellHeader(IContainer c) =>
c.BorderBottom(1).PaddingVertical(5).DefaultTextStyle(x => x.SemiBold());
IContainer CellBody(IContainer c) =>
c.PaddingVertical(2);
});
col.Item().LineHorizontal(1);
col.Item().Height(30);
col.Item().AlignRight().Text($"Total: {totalQuantity:n2} produits");
col.Item().AlignRight().Text($"Total HT: {total:n2} €");
col.Item().AlignRight().Text("Taxe : 20 %");
col.Item().AlignRight().Text($"Total TTC: {(total * 1.2):n2} €");
});
// Signature en bas à droite
page.Footer().AlignRight().Column(col =>
{
col.Item().AlignRight().Height(100).Image(signaturePath, ImageScaling.FitArea);
});
});
});
return document.GeneratePdf();
}
}

View File

@@ -0,0 +1,150 @@
using PyroFetes.Models;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace PyroFetes.Services.Pdf;
public interface IPurchaseOrderPdfService
{
byte[] Generate(PurchaseOrder purchaseOrder, List<PurchaseProduct> lignes);
}
public class PurchaseOrderPdfService : IPurchaseOrderPdfService
{
public byte[] Generate(PurchaseOrder purchaseOrder, List<PurchaseProduct> lignes)
{
var logoPath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "Images", "logo.jpg");
var signaturePath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "Images", "signature.png");
int totalQuantity = 0;
decimal total = 0;
var document = Document.Create(container =>
{
container.Page(page =>
{
page.Size(PageSizes.A4);
page.Margin(30);
page.DefaultTextStyle(x => x.FontSize(11));
page.Header().Row(row =>
{
// Client à gauche
row.RelativeItem().Column(col =>
{
col.Item().Text("");
col.Item().Text("");
col.Item().Text("");
col.Item().Text("");
col.Item().Text("Fournisseur").SemiBold().FontSize(12);
col.Item().Text("Mettre fournisseur ici");
});
// Logo + société à droite
row.ConstantItem(200).Column(col =>
{
col.Item().AlignRight().Height(70).Image(logoPath, ImageScaling.FitArea);
col.Item().Height(20);
col.Item().AlignRight().Text("Pyro-Fêtes").SemiBold();
col.Item().Height(5);
col.Item().AlignRight().Text("24, rue La Fosse Mardeau\n41700 Le Controis-en-Sologne");
col.Item().Height(5);
col.Item().AlignRight().Text("Téléphone: 02 54 78 77 66");
col.Item().Height(5);
col.Item().AlignRight().Text("SIRET: 82031463100012");
col.Item().Height(40);
});
});
page.Content().Column(col =>
{
// Titre + date
col.Item().Row(row =>
{
row.RelativeItem().Text($"Bon de commande n° {purchaseOrder.Id}")
.FontSize(16).SemiBold();
row.ConstantItem(200).AlignRight().Text(
$"Le {DateTime.Now:dd/MM/yyyy}");
});
col.Item().Height(20);
col.Item().LineHorizontal(1);
// Tableau des lignes
col.Item().Table(table =>
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(4); // Produit
columns.RelativeColumn(1); // Qté
columns.RelativeColumn(2); // PU
columns.RelativeColumn(2); // Total
});
// En-têtes
table.Header(header =>
{
header.Cell().Element(CellHeader).Text("Produit");
header.Cell().Element(CellHeader).AlignRight().Text("Qté");
header.Cell().Element(CellHeader).AlignRight().Text("PU");
header.Cell().Element(CellHeader).AlignRight().Text("Total");
});
foreach (var l in lignes)
{
decimal price = l.Product!.Prices!
.FirstOrDefault(p => p.SupplierId == l.PurchaseOrder!.SupplierId)
?.SellingPrice ?? 0;
table.Cell().Element(CellBody).Text(l.Product?.Name);
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
table.Cell().Element(CellBody).AlignRight().Text($"{price:n2} €");
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * price:n2} €");
totalQuantity += l.Quantity;
total += l.Quantity * price;
}
IContainer CellHeader(IContainer c) =>
c.BorderBottom(1).PaddingVertical(5).DefaultTextStyle(x => x.SemiBold());
IContainer CellBody(IContainer c) =>
c.PaddingVertical(2);
});
col.Item().LineHorizontal(1);
col.Item().Height(30);
col.Item().Row(row =>
{
// Colonne gauche : conditions de vente
row.RelativeItem().Column(left =>
{
left.Item().Text("Conditions de vente")
.SemiBold().FontSize(12);
left.Item().Text(purchaseOrder.PurchaseConditions)
.FontSize(9);
});
// Colonne droite : totaux
row.ConstantItem(180).Column(right =>
{
right.Item().AlignRight().Text($"Total: {totalQuantity:n2} produits");
right.Item().AlignRight().Text($"Total HT: {total:n2} €");
right.Item().AlignRight().Text("Taxe: 20 %");
right.Item().AlignRight().Text($"Total TTC: {(total * 1,2):n2} €");
});
});
});
// Signature en bas à droite
page.Footer().AlignRight().Column(col =>
{
col.Item().AlignRight().Height(100).Image(signaturePath, ImageScaling.FitArea);
});
});
});
return document.GeneratePdf();
}
}

View File

@@ -0,0 +1,147 @@
using PyroFetes.Models;
using QuestPDF.Companion;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace PyroFetes.Services.Pdf;
public interface IQuotationPdfService
{
byte[] Generate(Quotation quotation, List<QuotationProduct> lignes);
}
public class QuotationPdfService : IQuotationPdfService
{
public byte[] Generate(Quotation quotation, List<QuotationProduct> lignes)
{
var logoPath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "Images", "logo.jpg");
var signaturePath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "Images", "signature.png");
int total = 0;
var document = Document.Create(container =>
{
container.Page(page =>
{
page.Size(PageSizes.A4);
page.Margin(30);
page.DefaultTextStyle(x => x.FontSize(11));
page.Header().Row(row =>
{
// Client à gauche
row.RelativeItem().Column(col =>
{
col.Item().Text("");
col.Item().Text("");
col.Item().Text("");
col.Item().Text("");
col.Item().Text("Client").SemiBold().FontSize(12);
col.Item().Text($"{quotation.Customer}");
});
// Logo + société à droite
row.ConstantItem(200).Column(col =>
{
col.Item().AlignRight().Height(70).Image(logoPath, ImageScaling.FitArea);
col.Item().Height(20);
col.Item().AlignRight().Text("Pyro-Fêtes").SemiBold();
col.Item().Height(5);
col.Item().AlignRight().Text("24, rue La Fosse Mardeau\n41700 Le Controis-en-Sologne");
col.Item().Height(5);
col.Item().AlignRight().Text("Téléphone: 02 54 78 77 66");
col.Item().Height(5);
col.Item().AlignRight().Text("SIRET: 82031463100012");
col.Item().Height(40);
});
});
page.Content().Column(col =>
{
// Titre + date
col.Item().Row(row =>
{
row.RelativeItem().Text($"Devis n° {quotation.Id}")
.FontSize(16).SemiBold();
row.ConstantItem(200).AlignRight().Text(
$"Le {DateTime.Now:dd/MM/yyyy}");
});
col.Item().Height(20);
col.Item().LineHorizontal(1);
// Tableau des lignes
col.Item().Table(table =>
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(10); // Produit
columns.RelativeColumn(2); // Qté
columns.RelativeColumn(3); // PU
columns.RelativeColumn(3); // Total
});
// En-têtes
table.Header(header =>
{
header.Cell().Element(CellHeader).Text("Produit");
header.Cell().Element(CellHeader).AlignRight().Text("Qté");
header.Cell().Element(CellHeader).AlignRight().Text("PU");
header.Cell().Element(CellHeader).AlignRight().Text("Total");
});
foreach (var l in lignes)
{
table.Cell().Element(CellBody).Text(l.Product?.Name);
table.Cell().Element(CellBody).AlignRight().Text(l.Quantity.ToString());
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity:n2} €");
table.Cell().Element(CellBody).AlignRight().Text($"{l.Quantity * l.Quantity:n2} €");
total = total + l.Quantity * l.Quantity;
}
IContainer CellHeader(IContainer c) =>
c.BorderBottom(1).PaddingVertical(5).DefaultTextStyle(x => x.SemiBold());
IContainer CellBody(IContainer c) =>
c.PaddingVertical(2);
});
col.Item().LineHorizontal(1);
col.Item().Height(30);
col.Item().Row(row =>
{
// Colonne gauche : conditions de vente
row.RelativeItem().Column(left =>
{
left.Item().Text("Conditions de vente")
.SemiBold().FontSize(12);
left.Item().Text(quotation.ConditionsSale)
.FontSize(9);
});
// Colonne droite : totaux
row.ConstantItem(180).Column(right =>
{
right.Item().AlignRight().Text($"Total HT : {total:n2} €");
right.Item().AlignRight().Text("Taxe : 20 %");
right.Item().AlignRight().Text($"Total TTC : {(total * 1.2):n2} €");
});
});
});
// Signature en bas à droite
page.Footer().AlignRight().Column(col =>
{
col.Item().AlignRight().Height(100).Image(signaturePath, ImageScaling.FitArea);
});
});
});
// Pour avoir la vue du PDF en temps réel
// document.ShowInCompanion();
return document.GeneratePdf();
}
}

View File

@@ -0,0 +1,15 @@
using Ardalis.Specification;
using PyroFetes.Models;
namespace PyroFetes.Specifications.DeliveryNotes;
public class GetDeliveryNoteByIdWithProductsSpec : Specification<DeliveryNote>
{
public GetDeliveryNoteByIdWithProductsSpec(int deliveryNoteId)
{
Query
.Where(d => d.Id == deliveryNoteId)
.Include(d => d.ProductDeliveries!)
.ThenInclude(dp => dp.Product);
}
}

View File

@@ -8,6 +8,7 @@ public sealed class GetProductByIdSpec : Specification<Product>
public GetProductByIdSpec(int? productId)
{
Query
.Where(p => p.Id == productId);
.Where(p => p.Id == productId)
.Include(p => p.Prices);
}
}

View File

@@ -0,0 +1,14 @@
using Ardalis.Specification;
using PyroFetes.Models;
namespace PyroFetes.Specifications.Products;
public sealed class GetProductsUnderLimitSpec : Specification<Product>
{
public GetProductsUnderLimitSpec()
{
Query
.Include(p => p.QuotationProducts)
.Where(p => p.QuotationProducts.Any(q => q.Quantity < p.MinimalQuantity));
}
}

View File

@@ -0,0 +1,16 @@
using Ardalis.Specification;
using PyroFetes.Models;
namespace PyroFetes.Specifications.PurchaseOrders;
public class GetPurchaseOrderByIdWithProductsSpec : Specification<PurchaseOrder>
{
public GetPurchaseOrderByIdWithProductsSpec(int purchaseOrderId)
{
Query
.Where(p => p.Id == purchaseOrderId)
.Include(p => p.PurchaseProducts!)
.ThenInclude(pp => pp.Product)
.ThenInclude(pp=> pp!.Prices);
}
}

View File

@@ -8,7 +8,7 @@ public sealed class GetQuotationByIdSpec : Specification<Quotation>
public GetQuotationByIdSpec(int quotationId)
{
Query
.Include(q => q.QuotationProducts)
.Include(q => q.QuotationProducts)
.Where(x => x.Id == quotationId);
}
}

View File

@@ -0,0 +1,15 @@
using Ardalis.Specification;
using PyroFetes.Models;
namespace PyroFetes.Specifications.Quotations;
public class GetQuotationByIdWithProductsSpec : Specification<Quotation>
{
public GetQuotationByIdWithProductsSpec(int quotationId)
{
Query
.Where(q => q.Id == quotationId)
.Include(q => q.QuotationProducts!)
.ThenInclude(qp => qp.Product);
}
}

615
PyroFetes/data.sql Normal file
View File

@@ -0,0 +1,615 @@
-- ============================================================
-- PyroFetes Jeu de données complet
-- Compatible SQL Server / EF Core
-- Ordre d'insertion respectant les contraintes FK
-- ============================================================
-- -------------------------------------------------------
-- 1. Settings
-- -------------------------------------------------------
INSERT INTO Settings ( Logo, ElectronicSignature) VALUES
( 'assets/logo_pyrofetes.png', 'assets/signature_direction.png');
-- -------------------------------------------------------
-- 2. Cities
-- -------------------------------------------------------
INSERT INTO Cities ( Name, ZipCode) VALUES
( 'Paris', 75001),
( 'Lyon', 69001),
( 'Marseille', 13001),
('Bordeaux', 33000),
( 'Strasbourg', 67000),
( 'Nantes', 44000),
('Toulouse', 31000),
( 'Lille', 59000),
( 'Nice', 06000),
('Montpellier', 34000);
-- -------------------------------------------------------
-- 3. Classifications
-- -------------------------------------------------------
INSERT INTO Classifications ( Label) VALUES
('F1 Faible danger'),
( 'F2 Danger moyen'),
( 'F3 Danger élevé'),
( 'F4 Usage professionnel'),
( 'T1 Théâtral usage général'),
( 'T2 Théâtral usage professionnel');
-- -------------------------------------------------------
-- 4. ProductCategories
-- -------------------------------------------------------
INSERT INTO ProductCategories ( Label) VALUES
( 'Bouquet final'),
( 'Chandelle romaine'),
( 'Fontaine'),
( 'Fusée'),
( 'Mine'),
( 'Pétard'),
( 'Torche'),
( 'Batterie'),
( 'Cascades'),
( 'Lanceur électrique');
-- -------------------------------------------------------
-- 5. Colors
-- -------------------------------------------------------
INSERT INTO Colors ( Label) VALUES
( 'Rouge'),
( 'Vert'),
( 'Bleu'),
( 'Or'),
( 'Argent'),
( 'Blanc'),
( 'Orange'),
( 'Violet'),
( 'Rose'),
( 'Multicolore');
-- -------------------------------------------------------
-- 6. Effects
-- -------------------------------------------------------
INSERT INTO Effects ( Label) VALUES
( 'Craquement'),
( 'Sifflement'),
( 'Scintillement'),
( 'Pluie dorée'),
( 'Bouquet étoilé'),
( 'Palmier'),
( 'Chrysanthème'),
( 'Peony'),
( 'Comet'),
( 'Strobe'),
( 'Nishiki Kamuro'),
('Pistil');
-- -------------------------------------------------------
-- 7. Movements (avant Products car FK)
-- -------------------------------------------------------
INSERT INTO Movements ( Date, Start, Arrival, Quantity, SourceWarehouseId, DestinationWarehouseId) VALUES
('2024-01-10 08:00:00', '2024-01-10 08:00:00', '2024-01-10 14:00:00', 200, NULL, 1),
( '2024-02-15 09:00:00', '2024-02-15 09:00:00', '2024-02-15 16:30:00', 150, NULL, 2),
('2024-03-01 07:30:00', '2024-03-01 07:30:00', '2024-03-01 12:00:00', 80, 1, 3),
( '2024-04-20 10:00:00', '2024-04-20 10:00:00', '2024-04-20 18:00:00', 300, 2, 1),
( '2024-05-05 08:00:00', '2024-05-05 08:00:00', '2024-05-05 15:00:00', 120, 3, 2),
('2024-06-14 06:00:00', '2024-06-14 06:00:00', '2024-06-14 10:00:00', 500, 1, NULL),
( '2024-07-04 07:00:00', '2024-07-04 07:00:00', '2024-07-04 11:00:00', 250, 2, NULL),
( '2024-08-12 09:00:00', '2024-08-12 09:00:00', '2024-08-12 17:00:00', 180, NULL, 3);
-- -------------------------------------------------------
-- 8. Products
-- -------------------------------------------------------
INSERT INTO Products ( Reference, Name, Duration, Caliber, ApprovalNumber, Weight, Nec, Image, Link, MinimalQuantity, ClassificationId, ProductCategoryId, MovementId) VALUES
( 'PYR-001', 'Bouquet Tricolore 30T', 45.5, 30, 'APP-2023-001', 1.200, 0.850, 'products/bouquet_tricolore.jpg', 'https://catalogue.pyrofetes.fr/PYR-001', 10, 4, 1, 1),
( 'PYR-002', 'Chandelle Or 25T', 30.0, 25, 'APP-2023-002', 0.800, 0.560, 'products/chandelle_or.jpg', 'https://catalogue.pyrofetes.fr/PYR-002', 20, 3, 2, 2),
( 'PYR-003', 'Fontaine Argentée 20T', 60.0, 20, 'APP-2023-003', 0.500, 0.300, 'products/fontaine_arg.jpg', 'https://catalogue.pyrofetes.fr/PYR-003', 15, 2, 3, 3),
( 'PYR-004', 'Fusée Palmier 50T', 25.0, 50, 'APP-2023-004', 2.500, 1.800, 'products/fusee_palmier.jpg', 'https://catalogue.pyrofetes.fr/PYR-004', 5, 4, 4, 4),
( 'PYR-005', 'Mine Chrysanthème 75T', 15.0, 75, 'APP-2023-005', 3.200, 2.400, 'products/mine_chrysantheme.jpg', 'https://catalogue.pyrofetes.fr/PYR-005', 5, 4, 5, 5),
( 'PYR-006', 'Batterie Festival 100T', 120.0, 100, 'APP-2023-006', 8.000, 5.600, 'products/batterie_festival.jpg', 'https://catalogue.pyrofetes.fr/PYR-006', 3, 4, 8, 6),
( 'PYR-007', 'Torche Colorée 15T', 90.0, 15, 'APP-2023-007', 0.300, 0.180, 'products/torche_coloree.jpg', 'https://catalogue.pyrofetes.fr/PYR-007', 30, 2, 7, 7),
( 'PYR-008', 'Cascade Dorée 40T', 75.0, 40, 'APP-2023-008', 1.800, 1.200, 'products/cascade_doree.jpg', 'https://catalogue.pyrofetes.fr/PYR-008', 10, 4, 9, 8),
( 'PYR-009', 'Peony Multicolore 60T', 30.0, 60, 'APP-2023-009', 4.500, 3.200, 'products/peony_multi.jpg', 'https://catalogue.pyrofetes.fr/PYR-009', 5, 4, 1, 1),
( 'PYR-010', 'Lanceur 36 Tirs EL', 0.0, 0, 'APP-2023-010', 2.100, 0.000, 'products/lanceur_36.jpg', 'https://catalogue.pyrofetes.fr/PYR-010', 2, 6, 10,2),
( 'PYR-011', 'Strobe Blanc Intense 25T', 45.0, 25, 'APP-2023-011', 0.900, 0.650, 'products/strobe_blanc.jpg', 'https://catalogue.pyrofetes.fr/PYR-011', 10, 3, 3, 3),
( 'PYR-012', 'Comet Violet 30T', 20.0, 30, 'APP-2023-012', 1.100, 0.800, 'products/comet_violet.jpg', 'https://catalogue.pyrofetes.fr/PYR-012', 12, 3, 4, 4);
-- -------------------------------------------------------
-- 9. Brands
-- -------------------------------------------------------
INSERT INTO Brands ( Name, ProductId) VALUES
( 'PyroMaster', 1),
( 'GoldFlame', 1),
( 'ArtificePlus', 2),
( 'ArtificePlus', 3),
( 'StarBurst', 4),
( 'StarBurst', 5),
( 'FestivalFire', 6),
( 'TorchCo', 7),
( 'GoldFlame', 8),
( 'PyroMaster', 9),
( 'ElecFire', 10),
( 'PyroMaster', 11),
( 'StarBurst', 12);
-- -------------------------------------------------------
-- 10. ProductColors
-- -------------------------------------------------------
INSERT INTO ProductColors (ProductId, ColorId) VALUES
(1, 1), (1, 3), (1, 6), -- Bouquet Tricolore : rouge, bleu, blanc
(2, 4), -- Chandelle Or
(3, 5), -- Fontaine Argentée
(4, 4), (4, 2), -- Fusée Palmier : or, vert
(5, 7), (5, 4), -- Mine Chrysanthème : orange, or
(6, 10), -- Batterie Festival : multicolore
(7, 1), (7, 2), (7, 3), -- Torche : rouge, vert, bleu
(8, 4), (8, 5), -- Cascade Dorée : or, argent
(9, 10), -- Peony Multicolore
(11, 6), -- Strobe Blanc
(12, 8); -- Comet Violet
-- -------------------------------------------------------
-- 11. ProductEffects
-- -------------------------------------------------------
INSERT INTO ProductEffects (ProductId, EffectId) VALUES
(1, 5), (1, 8), -- Bouquet : bouquet étoilé, peony
(2, 4), (2, 3), -- Chandelle Or : pluie dorée, scintillement
(3, 3), -- Fontaine : scintillement
(4, 6), (4, 9), -- Fusée Palmier : palmier, comet
(5, 7), (5, 1), -- Mine : chrysanthème, craquement
(6, 5), (6, 7), (6, 10), -- Batterie : bouquet, chrysanthème, strobe
(7, 3), (7, 2), -- Torche : scintillement, sifflement
(8, 4), (8, 11), -- Cascade : pluie dorée, Nishiki
(9, 8), (9, 12), -- Peony : peony, pistil
(11, 10), -- Strobe
(12, 9); -- Comet
-- -------------------------------------------------------
-- 12. Warehouses
-- -------------------------------------------------------
INSERT INTO Warehouses ( Name, MaxWeight, [Current], MinWeight, Address, ZipCode, City) VALUES
( 'Entrepôt Central Paris', 50000, 18500, 5000, '12 rue de la Pyrotechnie', '75019', 'Paris'),
( 'Dépôt Sud Marseille', 30000, 12000, 3000, '8 avenue du Port Sec', '13016', 'Marseille'),
( 'Stockage Est Strasbourg', 20000, 8200, 2000, '5 chemin des Entrepôts', '67200', 'Strasbourg'),
( 'Site Ouest Nantes', 25000, 6500, 2500, '22 zone industrielle Ouest','44800', 'Nantes');
-- -------------------------------------------------------
-- 13. WarehouseProducts
-- -------------------------------------------------------
INSERT INTO WarehouseProducts (ProductId, WarehouseId, Quantity) VALUES
(1, 1, 120), (1, 2, 60),
(2, 1, 200), (2, 3, 80),
(3, 1, 150), (3, 4, 90),
(4, 1, 40), (4, 2, 25),
(5, 1, 30), (5, 2, 15),
(6, 1, 20), (6, 3, 10),
(7, 2, 300), (7, 4, 180),
(8, 1, 75), (8, 2, 50),
(9, 1, 35),
(10, 1, 18), (10, 3, 12),
(11, 2, 60),
(12, 3, 45);
-- -------------------------------------------------------
-- 14. Materials
-- -------------------------------------------------------
INSERT INTO Materials ( Name, Quantity, WarehouseId) VALUES
( 'Câble électrique 50m', 40, 1),
( 'Détonateur électrique', 500, 1),
( 'Bouchon sécurité rouge', 300, 1),
( 'Trépied aluminium', 25, 2),
( 'Tuyau métallique 1m', 80, 2),
( 'Boitier de tir 36 sorties', 10, 1),
( 'Rallonge 10m IP67', 60, 3),
( 'Mortier plastique 50mm', 200, 3),
( 'Mortier acier 75mm', 100, 1),
('Tableau de tir 100 CH', 5, 4),
( 'Caisse de transport étanche',30, 2),
( 'Lunettes de protection', 50, 1);
-- -------------------------------------------------------
-- 15. MaterialWarehouses
-- -------------------------------------------------------
INSERT INTO MaterialWarehouses (MaterialId, WarehouseId) VALUES
(1, 1), (1, 3),
(2, 1), (2, 2),
(3, 1),
(4, 2), (4, 4),
(5, 2), (5, 3),
(6, 1), (6, 4),
(7, 3),
(8, 3), (8, 1),
(9, 1),
(10, 4),
(11, 2),
(12, 1), (12, 2);
-- -------------------------------------------------------
-- 16. Suppliers
-- -------------------------------------------------------
INSERT INTO Suppliers ( Name, Email, Phone, Address, ZipCode, City, DeliveryDelay) VALUES
('Pyrotechnie Ruggieri', 'commandes@ruggieri.fr', '01 47 00 11 22', '14 avenue de la Fête', '75015', 'Paris', 7),
( 'Lacroix Défense Feux', 'pro@lacroix-feux.com', '04 78 92 00 10', '3 zone industrielle Nord','69130', 'Lyon', 10),
( 'Jorge Banus Pyro', 'info@jorgebanus-pyro.es', '+34 952 810 000','Pol. Ind. Las Maravillas', '29600', 'Marbella', 21),
('Brother Pyro Import', 'sales@brotherpyro.com', '+1 555 010 2020','1200 Fireworks Blvd', '30301', 'Atlanta', 30),
( 'Nico Pyrotechnie', 'achats@nico-pyro.fr', '04 91 25 36 47', '27 impasse des Artifices','13010', 'Marseille', 5),
( 'Surex Pyrotechnie', 'contact@surex.fr', '03 90 00 12 34', '10 rue Gutenberg', '67600', 'Sélestat', 6);
-- -------------------------------------------------------
-- 17. Prices (Product x Supplier)
-- -------------------------------------------------------
INSERT INTO Prices (ProductId, SupplierId, SellingPrice) VALUES
(1, 1, 12.50), (1, 2, 13.00),
(2, 1, 6.80), (2, 5, 7.20),
(3, 1, 4.50), (3, 5, 4.80),
(4, 2, 28.00), (4, 3, 26.50),
(5, 2, 35.00), (5, 3, 33.00),
(6, 1, 95.00), (6, 2, 98.50),
(7, 5, 3.20), (7, 6, 3.50),
(8, 1, 22.00), (8, 2, 23.50),
(9, 2, 42.00), (9, 4, 39.00),
(10,1, 185.00),(10,6, 190.00),
(11,5, 8.90), (11,6, 9.20),
(12,3, 14.00), (12,4, 13.50);
-- -------------------------------------------------------
-- 18. Deliverers
-- -------------------------------------------------------
INSERT INTO Deliverers ( Transporter) VALUES
( 'Chronopost Marchandises Dangereuses'),
( 'DHL Fret Spécial'),
( 'TNT Express ADR'),
('Transport Pyro Interne'),
( 'Geodis Fret');
-- -------------------------------------------------------
-- 19. DeliveryNotes
-- -------------------------------------------------------
INSERT INTO DeliveryNotes (TrackingNumber, DelivererId, EstimateDeliveryDate, ExpeditionDate, RealDeliveryDate) VALUES
('CPM-2024-001234', 1, '2024-01-12', '2024-01-09', '2024-01-12'),
( 'DHL-2024-005678', 2, '2024-02-18', '2024-02-14', '2024-02-17'),
( 'TNT-2024-009012', 3, '2024-03-05', '2024-03-01', '2024-03-06'),
('INT-2024-000001', 4, '2024-04-22', '2024-04-20', '2024-04-22'),
( 'GEO-2024-001111', 5, '2024-05-10', '2024-05-07', NULL);
-- -------------------------------------------------------
-- 20. ProductDeliveries
-- -------------------------------------------------------
INSERT INTO ProductDeliveries (ProductId, DeliveryNoteId, Quantity) VALUES
(1, 1, 60), (2, 1, 100),
(3, 2, 80), (4, 2, 20),
(5, 3, 15), (6, 3, 8),
(7, 4, 150), (8, 4, 40),
(9, 5, 30), (10,5, 6);
-- -------------------------------------------------------
-- 21. PurchaseOrders
-- -------------------------------------------------------
INSERT INTO PurchaseOrders ( PurchaseConditions, SupplierId) VALUES
('Paiement à 30 jours transport inclus palette EUR 80x120', 1),
('Paiement à 60 jours Incoterm EXW Lyon assurance acheteur', 2),
('Paiement anticipé -2% transport DDP Paris emballage ADR inclus', 5),
('Paiement à 45 jours transport à la charge du vendeur jusqu au dépôt', 3),
( 'Paiement à 30 jours transport maritime consolidé', 4);
-- -------------------------------------------------------
-- 22. PurchaseProducts
-- -------------------------------------------------------
INSERT INTO PurchaseProducts (ProductId, PurchaseOrderId, Quantity) VALUES
(1, 1, 200), (2, 1, 300), (3, 1, 150),
(4, 2, 50), (5, 2, 30), (6, 2, 20),
(7, 3, 500), (8, 3, 100),
(9, 4, 40),(10, 4, 15),
(11,5, 100),(12, 5, 80);
-- -------------------------------------------------------
-- 23. ProviderTypes
-- -------------------------------------------------------
INSERT INTO ProviderTypes ( Label) VALUES
( 'Sonorisation'),
('Éclairage scénique'),
( 'Sécurité / Protection'),
( 'Logistique & Transport'),
( 'Location de matériel'),
( 'Médical / Secours');
-- -------------------------------------------------------
-- 24. ServiceProviders
-- -------------------------------------------------------
INSERT INTO ServiceProviders ( Price, ProviderTypeId) VALUES
( 4500.00, 1),
(3200.00, 1),
(5800.00, 2),
(2800.00, 3),
(7500.00, 3),
( 1200.00, 4),
(73500.00, 5),
( 900.00, 6);
-- -------------------------------------------------------
-- 25. CustomerTypes
-- -------------------------------------------------------
INSERT INTO CustomerTypes ( Label) VALUES
( 'Mairie / Collectivité'),
( 'Association'),
( 'Entreprise privée'),
( 'Particulier'),
( 'Organisateur d événements');
-- -------------------------------------------------------
-- 26. Customers
-- -------------------------------------------------------
-- 27. Contacts
-- -------------------------------------------------------
-- -------------------------------------------------------
-- 31. QuotationProducts
-- -------------------------------------------------------
INSERT INTO QuotationProducts (ProductId, QuotationId, Quantity) VALUES
(1, 1, 80), (4, 1, 30), (5, 1, 20), (6, 1, 5), (8, 1, 40),
(2, 2, 50), (3, 2, 40), (7, 2, 80),
(1, 3, 40), (6, 3, 3), (9, 3, 15),
(1, 4, 60), (4, 4, 20), (6, 4, 4), (7, 4,100),
(1, 5, 70), (5, 5, 15), (8, 5, 30),
(2, 6, 60), (3, 6, 50), (7, 6, 90);
-- -------------------------------------------------------
-- 32. Staff
-- -------------------------------------------------------
INSERT INTO Staffs ( FirstName, LastName, Profession, Email, F4T2NumberApproval, F4T2ExpirationDate) VALUES
( 'Antoine', 'Duval', 'Chef artificier', 'a.duval@pyrofetes.fr', 'F4-2021-00142', '2025-12-31'),
( 'Camille', 'Renard', 'Artificier', 'c.renard@pyrofetes.fr', 'F4-2022-00255', '2026-06-30'),
( 'Nicolas', 'Lefort', 'Artificier', 'n.lefort@pyrofetes.fr', 'F4-2020-00387', '2024-12-31'),
( 'Emma', 'Vidal', 'Technicien pyrotechnie', 'e.vidal@pyrofetes.fr', 'T2-2023-00104', '2027-03-31'),
( 'Julien', 'Moreau', 'Chef de chantier', 'j.moreau@pyrofetes.fr', 'F4-2021-00521', '2025-09-30'),
( 'Laura', 'Blanc', 'Artificière', 'l.blanc@pyrofetes.fr', 'F4-2022-00698', '2026-12-31'),
( 'Pierre', 'Garnier', 'Technicien électronique', 'p.garnier@pyrofetes.fr', 'T2-2021-00789', '2025-11-30'),
( 'Marie', 'Lefebvre', 'Responsable sécurité', 'm.lefebvre@pyrofetes.fr', 'F4-2023-00901', '2027-06-30'),
( 'Hugo', 'Simon', 'Artificier junior', 'h.simon@pyrofetes.fr', 'T1-2023-01023', '2025-06-30'),
( 'Pauline', 'Robert', 'Coordinatrice logistique', 'p.robert@pyrofetes.fr', 'T2-2022-01145', '2026-09-30');
-- -------------------------------------------------------
-- 33. ExperienceLevels
-- -------------------------------------------------------
INSERT INTO ExperienceLevels ( Label, StaffId) VALUES
( 'Expert +15 ans', 1),
( 'Confirmé 8 ans', 2),
( 'Confirmé 6 ans', 3),
( 'Intermédiaire 3 ans', 4),
( 'Expert +12 ans', 5),
( 'Confirmé 7 ans', 6),
( 'Intermédiaire 4 ans', 7),
( 'Confirmé 5 ans', 8),
( 'Débutant 1 an', 9),
( 'Intermédiaire 3 ans', 10);
-- -------------------------------------------------------
-- 34. HistoryOfApprovals
-- -------------------------------------------------------
INSERT INTO HistoryOfApprovals ( DeliveryDate, ExpirationDate) VALUES
( '2021-03-15', '2025-12-31'),
( '2022-06-01', '2026-06-30'),
( '2020-09-10', '2024-12-31'),
( '2023-01-20', '2027-03-31'),
( '2021-09-05', '2025-09-30'),
( '2022-12-15', '2026-12-31'),
( '2021-11-01', '2025-11-30'),
( '2023-06-10', '2027-06-30'),
( '2019-03-15', '2021-03-14'), -- expirée (historique)
('2023-09-01', '2026-09-30');
-- -------------------------------------------------------
-- 35. StaffHistoryOfApprovals
-- -------------------------------------------------------
INSERT INTO StaffHistoryOfApprovals (StaffId, HistoryOfApprovalId) VALUES
(1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
(6, 6), (7, 7), (8, 8), (9, 9), (10,10),
(3, 1); -- Nicolas a eu une précédente approbation
-- -------------------------------------------------------
-- 36. Availabilities
-- -------------------------------------------------------
INSERT INTO Availabilities (AvailabilityDate, DeliveryDate, ExpirationDate, RenewallDate) VALUES
( '2024-07-14', '2024-07-14', '2024-07-15', '2025-07-14'),
( '2024-07-14', '2024-07-14', '2024-07-15', '2025-07-14'),
( '2024-08-15', '2024-08-15', '2024-08-16', '2025-08-15'),
( '2024-08-15', '2024-08-15', '2024-08-16', '2025-08-15'),
( '2024-09-21', '2024-09-21', '2024-09-22', '2025-09-21'),
( '2024-12-31', '2024-12-31', '2025-01-01', '2025-12-31'),
( '2024-07-04', '2024-07-04', '2024-07-05', '2025-07-04'),
( '2024-06-21', '2024-06-21', '2024-06-22', '2025-06-21');
-- -------------------------------------------------------
-- 37. StaffAvailabilities
-- -------------------------------------------------------
INSERT INTO StaffAvailabilities (StaffId, AvailabilityId) VALUES
(1, 1), (2, 1), (5, 1), (8, 1), -- Paris 14 juillet
(1, 3), (3, 3), (6, 3), (7, 3), -- Marseille 15 août
(2, 5), (4, 5), (9, 5), -- Bordeaux
(1, 6), (2, 6), (5, 6), (10,6), -- Nouvel an
(3, 7), (6, 7), (8, 7), -- 4 juillet Lyon
(4, 8), (7, 8), (9, 8); -- Fête musique
-- -------------------------------------------------------
-- 38. StaffContacts
-- -------------------------------------------------------
INSERT INTO StaffContacts (StaffId, ContactId) VALUES
(1, 1), (1, 2),
(2, 4),
(5, 6),
(6, 3),
(8, 5),
(10,8);
-- -------------------------------------------------------
-- 39. Trucks
-- -------------------------------------------------------
INSERT INTO Trucks ( Type, MaxExplosiveCapacity, Sizes, Status) VALUES
( 'Fourgon 20m³', 500.0, '5.5m x 2.2m x 2.5m', 'Disponible'),
( 'Semi-remorque ADR 82m³',3000.0, '13.6m x 2.4m x 2.8m','Disponible'),
( 'Camion 40m³ frigorifié',1000.0, '7.2m x 2.4m x 2.6m', 'En maintenance'),
( 'Fourgon 15m³', 300.0, '4.2m x 2.0m x 2.2m', 'Disponible'),
( 'Pick-up plateau', 80.0, '2.0m x 1.8m x 0.5m', 'Disponible');
-- -------------------------------------------------------
-- 40. SoundCategories
-- -------------------------------------------------------
INSERT INTO SoundCategories (Name) VALUES
( 'Ouverture / Intro'),
( 'Corps de spectacle'),
( 'Bouquet final'),
( 'Transition'),
( 'Ambiance');
-- -------------------------------------------------------
-- 41. Sounds
-- -------------------------------------------------------
INSERT INTO Sounds ( Name, Type, Artist, Duration, Kind, Format, CreationDate, SoundCategoryId) VALUES
( '1812 Ouverture', 'Classique', 'Tchaïkovski', 900, 'Musique', 'WAV 48kHz 24bit', '2023-05-10', 1),
( 'La Marseillaise Orchestrale','Hymne', 'Berlioz arr.', 210, 'Musique', 'WAV 48kHz 24bit', '2023-05-10', 1),
( 'Also Sprach Zarathustra', 'Classique', 'Richard Strauss', 480, 'Musique', 'WAV 48kHz 24bit', '2023-06-01', 1),
( 'Fanfare Spectacle 01', 'Fanfare', 'Studio Pyro', 60, 'Jingle', 'WAV 44.1kHz', '2024-01-15', 4),
( 'Symphonie Feu & Lumière', 'Orchestral', 'Studio Pyro', 1200, 'Musique', 'WAV 48kHz 24bit', '2024-02-20', 2),
( 'Rock the Fireworks', 'Rock', 'PyroRock Band', 780, 'Musique', 'MP3 320kbps', '2023-09-05', 2),
( 'Electronic Fire Mix', 'Électronique', 'DJ Pyro', 960, 'Mix', 'WAV 44.1kHz', '2023-11-15', 2),
( 'Finale Épique', 'Orchestral', 'Studio Pyro', 180, 'Musique', 'WAV 48kHz 24bit', '2024-01-15', 3),
( 'Grand Finale 2024', 'Orchestral', 'Philharmonique Pyro', 240, 'Musique', 'WAV 48kHz 24bit', '2024-03-01', 3),
( 'Ambiance Nocturne', 'Ambient', 'Sound Design Studio', 600, 'Musique', 'WAV 44.1kHz', '2023-07-20', 5);
-- -------------------------------------------------------
-- 42. Shows
-- -------------------------------------------------------
INSERT INTO Shows (Name, Place, Description, Date, PyrotechnicImplementationPlan, CityId) VALUES
( 'Feux du 14 Juillet Paris 2024', 'Trocadéro Tour Eiffel', 'Grand spectacle national 30 minutes 120 000 spectateurs', '2024-07-14', 'plans/paris_14juillet_2024_v3.pdf', 1),
( 'Festival Lumières Lyon 2024', 'Place Bellecour', 'Spectacle estival 20 minutes 50 000 spectateurs', '2024-08-03', 'plans/lyon_festival_2024_v2.pdf', 2),
( 'Fête Nationale Marseille 2024', 'Vieux-Port', 'Show nautique et aérien 25 minutes', '2024-07-14', 'plans/marseille_14juillet_2024_v1.pdf',3),
('Gala Entreprise Paris 2024', 'Château de Versailles', 'Show privé soirée de gala 15 minutes', '2024-09-21', 'plans/versailles_gala_2024_v2.pdf', 1),
('Saint-Sylvestre Bordeaux 2024', 'Place de la Bourse', 'Feux du nouvel an 20 minutes', '2024-12-31', 'plans/bordeaux_sylvestre_2024_v1.pdf', 4),
('Fête de la Musique Nantes 2024', 'Île de Nantes', 'Show pyrotechnique de clôture 10 minutes', '2024-06-21', 'plans/nantes_musique_2024_v1.pdf', 6),
( 'Inauguration Parc Strasbourg 2025', 'Parc de l Orangerie', 'Feux d\inauguration 12 minutes', '2025-04-15', 'plans/strasbourg_inaug_2025_v1.pdf', 5),
('Feux Casino Nice 2024', 'Promenade des Anglais', 'Show prestige casino 18 minutes', '2024-11-01', 'plans/nice_casino_2024_v2.pdf', 9);
-- -------------------------------------------------------
-- 43. ShowStaffs
-- -------------------------------------------------------
INSERT INTO ShowStaffs (StaffId, ShowId) VALUES
(1,1),(2,1),(5,1),(8,1),(7,1),
(1,2),(3,2),(6,2),(10,2),
(2,3),(4,3),(6,3),(8,3),
(1,4),(5,4),(7,4),
(2,5),(3,5),(9,5),(10,5),
(4,6),(7,6),(9,6),
(1,7),(6,7),(8,7),
(2,8),(5,8),(7,8);
-- -------------------------------------------------------
-- 44. ShowTrucks
-- -------------------------------------------------------
INSERT INTO ShowTrucks (ShowId, TruckId) VALUES
(1,2),(1,4),
(2,1),(2,4),
(3,2),(3,5),
(4,1),
(5,2),(5,4),
(6,4),(6,5),
(7,1),
(8,2);
-- -------------------------------------------------------
-- 45. ShowMaterials
-- -------------------------------------------------------
INSERT INTO ShowMaterials (ShowId, MaterialId) VALUES
(1,1),(1,2),(1,3),(1,6),(1,9),(1,10),(1,12),
(2,1),(2,2),(2,4),(2,6),(2,8),(2,12),
(3,1),(3,2),(3,5),(3,6),(3,9),
(4,1),(4,2),(4,6),(4,7),(4,11),
(5,1),(5,2),(5,3),(5,6),(5,9),
(6,1),(6,4),(6,6),(6,8),
(7,1),(7,2),(7,6),(7,7),
(8,1),(8,2),(8,6),(8,10);
-- -------------------------------------------------------
-- 46. Contracts (Show x ServiceProvider)
-- -------------------------------------------------------
INSERT INTO Contracts (ShowId, ServiceProviderId, TermsAndConditions) VALUES
(1, 1, 'Prestation sono 4h montage J-1 inclus démo technique 13/07'),
(1, 4, 'Sécurité périmètre 25 agents 12h de présence'),
(2, 2, 'Sono scène + diffusion installation J-1'),
(2, 3, 'Éclairage scénique 200 projecteurs LED'),
(3, 5, 'Sécurité renforcée port zone pyro 40 agents'),
(4, 1, 'Sono de prestige régie son Versailles'),
(4, 3, 'Éclairage château mapping vidéo inclus'),
(5, 2, 'Sono place de la Bourse diffusion périmètre'),
(6, 7, 'Location groupe électrogène 100kVA'),
(7, 6, 'Transport matériel Strasbourg 2 rotations'),
(8, 1, 'Sono promenade diffusion linéaire'),
(8, 8, 'Équipe médicale de permanence 4h');
-- -------------------------------------------------------
-- 47. SoundTimecodes (Show x Sound)
-- -------------------------------------------------------
INSERT INTO SoundTimecodes (ShowId, SoundId, Start, [End]) VALUES
(1, 1, 0.0, 900.0),
(1, 5, 900.0, 2100.0),
(1, 9, 2100.0, 2340.0),
(2, 3, 0.0, 480.0),
(2, 7, 480.0, 1440.0),
(2, 8, 1440.0, 1620.0),
(3, 2, 0.0, 210.0),
(3, 6, 210.0, 990.0),
(3, 9, 990.0, 1230.0),
(4, 10, 0.0, 600.0),
(4, 5, 600.0, 1500.0),
(4, 8, 1500.0, 1680.0),
(5, 7, 0.0, 960.0),
(5, 9, 960.0, 1200.0),
(8, 10, 0.0, 600.0),
(8, 5, 600.0, 1320.0),
(8, 9, 1320.0, 1560.0);
-- -------------------------------------------------------
-- 48. ProductTimecodes (Product x Show)
-- -------------------------------------------------------
INSERT INTO ProductTimecodes (ProductId, ShowId, Start, [End]) VALUES
-- Paris 14 juillet
(3, 1, 0.0, 60.0),
(7, 1, 30.0, 300.0),
(2, 1, 300.0, 600.0),
(1, 1, 600.0, 1200.0),
(8, 1, 1200.0, 1800.0),
(4, 1, 1800.0, 2100.0),
(5, 1, 2100.0, 2200.0),
(6, 1, 2200.0, 2340.0),
-- Lyon festival
(7, 2, 0.0, 240.0),
(2, 2, 240.0, 600.0),
(1, 2, 600.0, 1000.0),
(9, 2, 1000.0, 1200.0),
-- Marseille
(3, 3, 0.0, 90.0),
(7, 3, 60.0, 360.0),
(4, 3, 360.0, 900.0),
(6, 3, 900.0, 1230.0),
-- Gala Versailles
(10,4, 0.0, 60.0),
(2, 4, 60.0, 300.0),
(1, 4, 300.0, 700.0),
(6, 4, 700.0, 900.0),
-- Bordeaux Sylvestre
(7, 5, 0.0, 300.0),
(1, 5, 300.0, 900.0),
(5, 5, 900.0, 1000.0),
(6, 5, 1000.0, 1200.0);
-- -------------------------------------------------------
-- 49. Users
-- -------------------------------------------------------
INSERT INTO Users (Name, Password, Salt, Email, Fonction) VALUES
('admin', '$2a$12$hashed_password_admin', 'salt_admin_abc123', 'admin@pyrofetes.fr', 'Administrateur système'),
('jean.dupuis', '$2a$12$hashed_password_jd', 'salt_jd_xyz789', 'j.dupuis@pyrofetes.fr', 'Directeur commercial'),
('sophie.martin', '$2a$12$hashed_password_sm', 'salt_sm_qrs456', 's.martin@pyrofetes.fr', 'Responsable production'),
('marc.leroy', '$2a$12$hashed_password_ml', 'salt_ml_tuv321', 'm.leroy@pyrofetes.fr', 'Gestionnaire stock'),
( 'alice.henry', '$2a$12$hashed_password_ah', 'salt_ah_wxy654', 'a.henry@pyrofetes.fr', 'Chargée de projets');

View File

@@ -0,0 +1,33 @@
name: 'pyrofetes-api'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: ${COMPOSE_PROJECT_NAME}-sqlserver
ports:
- 127.0.0.1:1433:1433
volumes:
- type: volume
source: sqlserver-volume
target: /var/opt/mssql
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: ${SA_PASSWORD}
MSSQL_PID: "Developer"
healthcheck:
test: ["CMD", "/opt/mssql-tools18/bin/sqlcmd", "-S", "localhost", "-U", "sa", "-P", "${SA_PASSWORD}", "-Q", "SELECT 1", "-No"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- network
networks:
network:
name: ${COMPOSE_PROJECT_NAME}-network
driver: bridge
volumes:
sqlserver-volume:
driver: local

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB