Cleaned code

This commit is contained in:
2026-05-24 17:24:44 +01:00
parent 656100d15e
commit 1434a5d77a
88 changed files with 197 additions and 213 deletions
@@ -6,6 +6,6 @@ public class GetDelivererDto
{
public int Id { get; set; }
public string? Transporter { get; set; }
public List<GetDeliveryNoteDto>? DeliveryNotes { get; set; }
}
@@ -7,6 +7,6 @@ public class UpdateDeliveryNoteDto
public DateOnly EstimateDeliveryDate { get; set; }
public DateOnly ExpeditionDate { get; set; }
public DateOnly? RealDeliveryDate { get; set; }
public int DelivererId { get; set; }
}
@@ -9,9 +9,9 @@ public class GetDeliveryNoteDto
public DateOnly EstimateDeliveryDate { get; set; }
public DateOnly ExpeditionDate { get; set; }
public DateOnly? RealDeliveryDate { get; set; }
public int DelivererId { get; set; }
public string? DelivererTransporter { get; set; }
public List<GetProductDeliveryDto>? Products { get; set; }
public List<GetProductDeliveryDto>? Products { get; set; }
}
+2 -2
View File
@@ -3,11 +3,11 @@
public class GetPriceDto
{
public decimal SellingPrice { get; set; }
public int ProductId { get; set; }
public string? ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductDuration { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
@@ -5,7 +5,7 @@ public class UpdateProductDto
public int Id { get; set; }
public string? References { get; set; }
public string? Name { get; set; }
public decimal Duration {get; set;}
public decimal Duration { get; set; }
public int Caliber { get; set; }
public string? ApprovalNumber { get; set; }
public decimal Weight { get; set; }
@@ -5,7 +5,7 @@ public class GetProductDto
public int Id { get; set; }
public string? References { get; set; }
public string? Name { get; set; }
public decimal Duration {get; set;}
public decimal Duration { get; set; }
public int Caliber { get; set; }
public string? ApprovalNumber { get; set; }
public decimal Weight { get; set; }
@@ -5,7 +5,7 @@ public class GetProductDeliveryDto
public int ProductId { get; set; }
public string? ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductDuration { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
@@ -13,6 +13,6 @@ public class GetProductDeliveryDto
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
public int Quantity { get; set; }
}
@@ -6,4 +6,4 @@ public class CreatePurchaseOrderDto
{
public string? PurchaseConditions { get; set; }
public List<CreatePurchaseOrderProductDto>? Products { get; set; }
}
}
@@ -2,7 +2,7 @@ namespace PyroFetes.DTO.PurchaseProduct.Request;
public class CreatePurchaseProductDto
{
public int Quantity { get; set; }
public int Quantity { get; set; }
public int ProductId { get; set; }
public int PurchaseOrderId { get; set; }
}
@@ -4,5 +4,5 @@ public class PatchPurchaseProductQuantityDto
{
public int ProductId { get; set; }
public int PurchaseOrderId { get; set; }
public int Quantity { get; set; }
public int Quantity { get; set; }
}
@@ -5,7 +5,7 @@ public class GetPurchaseProductDto
public int ProductId { get; set; }
public string? ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductDuration { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
@@ -14,6 +14,6 @@ public class GetPurchaseProductDto
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
public decimal ProductPrice { get; set; }
public int Quantity { get; set; }
}
@@ -2,5 +2,5 @@
public class GetQuotationPdfDto
{
public int Id { get; set; }
public int Id { get; set; }
}
@@ -3,11 +3,11 @@ namespace PyroFetes.DTO.QuotationProduct.Response;
public class GetQuotationProductDto
{
public int Quantity { get; set; }
public int ProductId { get; set; }
public string? ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductDuration { get; set; }
public int ProductCaliber { get; set; }
public string? ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
@@ -51,7 +51,7 @@ public class CreateDeliveryNoteEndpoint(
DeliveryNote = newDeliveryNote,
Quantity = productQuantity.Value,
Product = product,
ProductId = product.Id,
ProductId = product.Id,
DeliveryNoteId = newDeliveryNote.Id
};
@@ -15,6 +15,6 @@ public class GetAllDeliveryNoteEndpoint(DeliveryNotesRepository deliveryNotesRep
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await deliveryNotesRepository.ProjectToListAsync<GetDeliveryNoteDto>(new GetAllDeliveryNoteSpec() ,ct), ct);
await Send.OkAsync(await deliveryNotesRepository.ProjectToListAsync<GetDeliveryNoteDto>(new GetAllDeliveryNoteSpec(), ct), ct);
}
}
@@ -8,7 +8,8 @@ using PyroFetes.Specifications.DeliveryNotes;
namespace PyroFetes.Endpoints.DeliveryNotes;
public class GetDeliveryNotePdfEndpoint(DeliveryNotesRepository deliveryNotesRepository, IDeliveryNotePdfService deliveryNotePdfService, SettingsRepository settingsRepository) : Endpoint<GetDeliveryNotePdfDto, byte[]>
public class GetDeliveryNotePdfEndpoint(DeliveryNotesRepository deliveryNotesRepository, IDeliveryNotePdfService deliveryNotePdfService, SettingsRepository settingsRepository)
: Endpoint<GetDeliveryNotePdfDto, byte[]>
{
public override void Configure()
{
@@ -25,7 +25,7 @@ public class PatchProductMinimalStockEndpoint(ProductsRepository productsReposit
}
mapper.Map(req, product);
await productsRepository.UpdateAsync(product, ct);
await Send.NoContentAsync(ct);
}
@@ -34,8 +34,8 @@ public class CreatePurchaseOrder(
await Send.NotFoundAsync(ct);
return;
}
PurchaseProduct? purchaseProduct =
PurchaseProduct? purchaseProduct =
await purchaseProductsRepository.SingleOrDefaultAsync(new GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(line.ProductId, purchaseOrder.Id), ct);
if (purchaseProduct is not null)
@@ -10,7 +10,7 @@ namespace PyroFetes.Endpoints.PurchaseOrders;
public class GetPurchaseOrderPdfEndpoint(
PurchaseOrdersRepository purchaseOrdersRepository,
IPurchaseOrderPdfService purchaseOrderPdfService,
IPurchaseOrderPdfService purchaseOrderPdfService,
SettingsRepository settingsRepository)
: Endpoint<GetPurchaseOrderPdfDto, byte[]>
{
@@ -24,7 +24,7 @@ public class GetPurchaseOrderPdfEndpoint(
public override async Task HandleAsync(GetPurchaseOrderPdfDto req, CancellationToken ct)
{
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.SingleOrDefaultAsync(new GetPurchaseOrderByIdWithProductsSpec(req.Id), ct);
if (purchaseOrder is null)
{
await Send.NotFoundAsync(ct);
@@ -32,7 +32,7 @@ public class GetPurchaseOrderPdfEndpoint(
}
Setting? setting = await settingsRepository.FirstOrDefaultAsync(ct);
byte[] bytes = purchaseOrderPdfService.Generate(purchaseOrder, purchaseOrder.PurchaseProducts!, setting!);
await Send.BytesAsync(
@@ -28,7 +28,7 @@ public class PatchPurchaseProductQuantityEndpoint(PurchaseProductsRepository pur
}
mapper.Map(req, purchaseProduct);
await purchaseProductsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -19,7 +19,8 @@ public class AddProductoToQuotationEndpoint(
public override async Task HandleAsync(AddQuotationProductDto req, CancellationToken ct)
{
QuotationProduct? productQuotation = await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(req.ProductId, req.QuotationId), ct);
QuotationProduct? productQuotation =
await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(req.ProductId, req.QuotationId), ct);
if (productQuotation is not null)
{
@@ -28,7 +29,7 @@ public class AddProductoToQuotationEndpoint(
}
QuotationProduct quotationProduct = mapper.Map<QuotationProduct>(req);
await quotationProductsRepository.AddAsync(quotationProduct, ct);
await Send.NoContentAsync(ct);
}
@@ -33,7 +33,7 @@ public class CreateQuotationEndpoint(
Product? product = await productsRepository.SingleOrDefaultAsync(new GetProductByIdSpec(line.ProductId), ct);
QuotationProduct? quotationProduct =
await quotationProductsRepository.SingleOrDefaultAsync(new GetQuotationProductByProductIdAndQuotationIdSpec(line.ProductId, quotation.Id), ct);
if (product is null)
{
await Send.NotFoundAsync(ct);
@@ -10,7 +10,7 @@ namespace PyroFetes.Endpoints.Quotations;
public class GetQuotationPdfEndpoint(
QuotationsRepository quotationRepository,
IQuotationPdfService quotationPdfService,
IQuotationPdfService quotationPdfService,
SettingsRepository settingsRepository)
: Endpoint<GetQuotationPdfDto, byte[]>
{
@@ -32,7 +32,7 @@ public class GetQuotationPdfEndpoint(
}
Setting? setting = await settingsRepository.FirstOrDefaultAsync(ct);
byte[] bytes = quotationPdfService.Generate(quotation, quotation.QuotationProducts!, setting!);
await Send.BytesAsync(
@@ -28,7 +28,7 @@ public class PatchQuotationConditionsSaleEndpoint(
}
mapper.Map(req, quotation);
await quotationsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -28,7 +28,7 @@ public class PatchQuotationMessageEndpoint(
}
mapper.Map(req, quotation);
await quotationsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -28,7 +28,7 @@ public class PatchQuotationProductQuantityEndpoint(
}
mapper.Map(req, quotationProduct);
await quotationProductsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -28,7 +28,7 @@ public class UpdateQuotationEndpoint(
}
mapper.Map(req, quotation);
await quotationsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -22,7 +22,7 @@ public class CreateSettingEndpoint(SettingsRepository settingsRepository) : Endp
if (req.ElectronicSignature != null) await req.ElectronicSignature.CopyToAsync(memoryStream, ct);
byte[] signatureBytes = memoryStream.ToArray();
Setting setting = new()
{
ElectronicSignature = Convert.ToBase64String(signatureBytes),
@@ -28,9 +28,9 @@ public class PatchSettingElectronicSignatureEndpoint(SettingsRepository settings
using MemoryStream memoryStream = new();
if (req.ElectronicSignature != null) await req.ElectronicSignature.CopyToAsync(memoryStream, ct);
byte[] signatureBytes = memoryStream.ToArray();
setting.ElectronicSignature = Convert.ToBase64String(signatureBytes);
await settingsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -28,9 +28,9 @@ public class PatchSettingLogoEndpoint(SettingsRepository settingsRepository) : E
using MemoryStream memoryStream = new();
if (req.Logo != null) await req.Logo.CopyToAsync(memoryStream, ct);
byte[] logoBytes = memoryStream.ToArray();
setting.Logo = Convert.ToBase64String(logoBytes);
await settingsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -11,7 +11,7 @@ namespace PyroFetes.Endpoints.Suppliers;
public class AddProductToSupplierEndpoint(
SuppliersRepository suppliersRepository,
ProductsRepository productsRepository,
PricesRepository pricesRepository,
PricesRepository pricesRepository,
AutoMapper.IMapper mapper) : Endpoint<CreatePriceDto>
{
public override void Configure()
@@ -36,7 +36,7 @@ public class AddProductToSupplierEndpoint(
await Send.StringAsync("Le fournisseur a déjà un prix pour ce produit.", 400, cancellation: ct);
return;
}
await pricesRepository.AddAsync(mapper.Map<Price>(req), ct);
await Send.NoContentAsync(ct);
}
@@ -27,7 +27,7 @@ public class PatchPriceEndpoint(
}
mapper.Map(req, price);
await pricesRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
@@ -7,7 +7,7 @@ using PyroFetes.Specifications.Users;
namespace PyroFetes.Endpoints.Users;
public class PatchUserPasswordEndpoint(UsersRepository usersRepository,AutoMapper.IMapper mapper) : Endpoint<PatchUserPasswordDto, GetUserDto>
public class PatchUserPasswordEndpoint(UsersRepository usersRepository, AutoMapper.IMapper mapper) : Endpoint<PatchUserPasswordDto, GetUserDto>
{
public override void Configure()
{
@@ -17,7 +17,7 @@ public class PatchWareHouseProductQuantityEndpoint(WarehouseProductsRepository w
public override async Task HandleAsync(PatchWareHouseProductQuantityDto req, CancellationToken ct)
{
WarehouseProduct? wareHouseProduct = await warehouseProductsRepository.FirstOrDefaultAsync(new GetWarehouseProductByProductIdSpec(req.ProductId, req.WareHouseId) , ct);
WarehouseProduct? wareHouseProduct = await warehouseProductsRepository.FirstOrDefaultAsync(new GetWarehouseProductByProductIdSpec(req.ProductId, req.WareHouseId), ct);
if (wareHouseProduct is null)
{
@@ -27,7 +27,7 @@ public class PatchWareHouseProductQuantityEndpoint(WarehouseProductsRepository w
wareHouseProduct.Quantity = req.Quantity;
await warehouseProductsRepository.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -38,16 +38,16 @@ public class DtoToEntityMappings : Profile
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<PatchProductMinimalStockDto, Product>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreatePurchaseOrderDto, PurchaseOrder>();
CreateMap<PatchPurchaseOrderPurchaseConditionsDto,PurchaseOrder>()
CreateMap<PatchPurchaseOrderPurchaseConditionsDto, PurchaseOrder>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreatePurchaseProductDto, PurchaseProduct>();
CreateMap<PatchPurchaseProductQuantityDto, PurchaseProduct>()
.ForMember(dest => dest.ProductId, opt => opt.Ignore())
.ForMember(dest => dest.PurchaseOrderId, opt => opt.Ignore());
CreateMap<PatchQuotationConditionsSaleDto, Quotation>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<PatchQuotationMessageDto, Quotation>()
@@ -58,19 +58,19 @@ public class DtoToEntityMappings : Profile
CreateMap<PatchQuotationProductQuantityDto, QuotationProduct>()
.ForMember(dest => dest.ProductId, opt => opt.Ignore())
.ForMember(dest => dest.QuotationId, opt => opt.Ignore());
CreateMap<CreateSettingDto, Setting>();
CreateMap<PatchSettingElectronicSignatureDto, Setting>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<PatchSettingLogoDto, Setting>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateSupplierDto, Supplier>();
CreateMap<UpdateSupplierDto, Supplier>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<PatchSupplierDeliveryDelayDto, Supplier>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateUserDto, User>();
CreateMap<UpdateUserDto, User>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
@@ -28,10 +28,10 @@ public class EntityToDtoMappings : Profile
.ForMember(dest => dest.Products, opt => opt.MapFrom(src => src.ProductDeliveries));
CreateMap<Price, GetPriceDto>();
CreateMap<Product, GetProductDto>()
.ForMember(dest => dest.References, opt => opt.MapFrom(src => src.Reference));
CreateMap<ProductDelivery, GetProductDeliveryDto>();
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
+1 -1
View File
@@ -9,6 +9,6 @@ public class Availability
[Required] public DateOnly DeliveryDate { get; set; }
[Required] public DateOnly ExpirationDate { get; set; }
[Required] public DateOnly RenewallDate { get; set; }
public List<StaffAvailability>? StaffAvailabilities { get; set; }
}
+3 -3
View File
@@ -4,9 +4,9 @@ namespace PyroFetes.Models;
public class Brand
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int ProductId { get; set; }
[Required] public Product? Product { get; set; }
}
+3 -3
View File
@@ -4,9 +4,9 @@ namespace PyroFetes.Models;
public class City
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int ZipCode { get; set; }
public List<Show>? Shows { get; set; }
}
+3 -3
View File
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
public class Classification
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<Product>? Products { get; set; }
}
+3 -3
View File
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
public class Color
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<ProductColor>? ProductColors { get; set; }
}
+2 -2
View File
@@ -4,11 +4,11 @@ namespace PyroFetes.Models;
public class Communication
{
[Key] public int Id { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Calling { get; set; }
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(300)] public string? Meeting { get; set; }
[Required] public int ContactId { get; set; }
public Contact? Contact { get; set; }
}
+2 -2
View File
@@ -13,10 +13,10 @@ public class Contact
[Required] public int ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
[Required, MaxLength(100)] public string? Role { get; set; }
public Customer? Customer { get; set; }
[Required] public int CustomerId { get; set; }
public List<Communication>? Communications { get; set; }
public List<StaffContact>? StaffContacts { get; set; }
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
+1 -1
View File
@@ -8,7 +8,7 @@ public class ContactServiceProvider
{
[Required] public int ContactId { get; set; }
[Required] public int ServiceProviderId { get; set; }
public Contact? Contact { get; set; }
public ServiceProvider? ServiceProvider { get; set; }
}
+3 -3
View File
@@ -6,11 +6,11 @@ public class Customer
{
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Note { get; set; }
//Relations
[Required] public int CustomerTypeId { get; set; }
public CustomerType? CustomerType { get; set; }
public List<Contact>? Contacts { get; set; }
public List<Quotation>? Quotations { get; set; }
}
}
+2 -2
View File
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
public class CustomerType
{
[Key] public int Id { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<Customer>? Customers { get; set; }
}
+1 -1
View File
@@ -6,6 +6,6 @@ public class Deliverer
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Transporter { get; set; }
public List<DeliveryNote>? DeliveryNotes { get; set; }
}
+1 -1
View File
@@ -10,7 +10,7 @@ public class DeliveryNote
[Required] public DateOnly EstimateDeliveryDate { get; set; }
[Required] public DateOnly ExpeditionDate { get; set; }
public DateOnly? RealDeliveryDate { get; set; }
public Deliverer? Deliverer { get; set; }
public List<ProductDelivery>? ProductDeliveries { get; set; }
}
+3 -3
View File
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
public class Effect
{
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Label { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Label { get; set; }
public List<ProductEffect>? ProductEffects { get; set; }
}
+1 -1
View File
@@ -6,7 +6,7 @@ public class ExperienceLevel
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public Staff? Staff { get; set; }
[Required] public int StaffId { get; set; }
}
+2 -2
View File
@@ -4,9 +4,9 @@ namespace PyroFetes.Models;
public class HistoryOfApproval
{
[Key] public int Id { get; set; }
[Key] public int Id { get; set; }
[Required] public DateOnly DeliveryDate { get; set; }
[Required] public DateOnly ExpirationDate { get; set; }
public List<StaffHistoryOfApproval>? StaffHistoryOfApprovals { get; set; }
}
+9 -9
View File
@@ -4,13 +4,13 @@ namespace PyroFetes.Models;
public class Material
{
[Key] public int Id {get; set;}
[Required, MaxLength(100)] public string? Name {get; set;}
[Required] public int Quantity {get; set;}
[Required] public int WarehouseId {get; set;}
public Warehouse? Warehouse {get; set;}
public List<ShowMaterial>? ShowMaterials {get; set;}
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int Quantity { get; set; }
[Required] public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public List<ShowMaterial>? ShowMaterials { get; set; }
public List<MaterialWarehouse>? MaterialWarehouses { get; set; }
}
+1 -1
View File
@@ -8,7 +8,7 @@ public class MaterialWarehouse
{
[Required] public int MaterialId { get; set; }
[Required] public int WarehouseId { get; set; }
public Material? Material { get; set; }
public Warehouse? Warehouse { get; set; }
}
+11 -11
View File
@@ -4,16 +4,16 @@ namespace PyroFetes.Models;
public class Movement
{
[Key] public int Id { get; set; }
[Required] public DateTime Date { get; set; }
[Required] public DateTime Start {get; set;}
[Required] public DateTime Arrival {get; set;}
[Required] public int Quantity {get; set;}
[Key] public int Id { get; set; }
[Required] public DateTime Date { get; set; }
[Required] public DateTime Start { get; set; }
[Required] public DateTime Arrival { get; set; }
[Required] public int Quantity { get; set; }
public List<Product>? Products { get; set; }
public int? SourceWarehouseId {get; set;}
public Warehouse? SourceWarehouse {get; set;}
public int? DestinationWarehouseId {get; set;}
public Warehouse? DestinationWarehouse {get; set;}
public int? SourceWarehouseId { get; set; }
public Warehouse? SourceWarehouse { get; set; }
public int? DestinationWarehouseId { get; set; }
public Warehouse? DestinationWarehouse { get; set; }
}
+1 -1
View File
@@ -10,7 +10,7 @@ public class Price
[Required] public int ProductId { get; set; }
[Required] public int SupplierId { get; set; }
[Required] public decimal SellingPrice { get; set; }
public Product? Product { get; set; }
public Supplier? Supplier { get; set; }
}
+4 -6
View File
@@ -7,7 +7,7 @@ namespace PyroFetes.Models
[Key] public int Id { get; set; }
[Required, MaxLength(20)] public string? Reference { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public decimal Duration {get; set;}
[Required] public decimal Duration { get; set; }
[Required] public int Caliber { get; set; }
[Required, MaxLength(100)] public string? ApprovalNumber { get; set; }
[Required] public decimal Weight { get; set; }
@@ -22,9 +22,9 @@ namespace PyroFetes.Models
[Required] public int ProductCategoryId { get; set; }
public ProductCategory? ProductCategory { get; set; }
[Required] public int MovementId {get; set;}
public Movement? Movement {get; set;}
[Required] public int MovementId { get; set; }
public Movement? Movement { get; set; }
public List<ProductDelivery>? ProductDeliveries { get; set; }
public List<Brand>? Brands { get; set; }
@@ -35,7 +35,5 @@ namespace PyroFetes.Models
public List<QuotationProduct>? QuotationProducts { get; set; }
public List<WarehouseProduct>? WarehouseProducts { get; set; }
public List<ProductTimecode>? ProductTimecodes { get; set; }
}
}
+3 -3
View File
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
public class ProductCategory
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<Product>? Products { get; set; }
}
+1 -1
View File
@@ -8,7 +8,7 @@ public class ProductColor
{
public Product? Product { get; set; }
[Required] public int ProductId { get; set; }
public Color? Color { get; set; }
[Required] public int ColorId { get; set; }
}
+1 -1
View File
@@ -9,7 +9,7 @@ public class ProductDelivery
[Required] public int ProductId { get; set; }
[Required] public int DeliveryNoteId { get; set; }
[Required] public int Quantity { get; set; }
public Product? Product { get; set; }
public DeliveryNote? DeliveryNote { get; set; }
}
-1
View File
@@ -11,5 +11,4 @@ public class ProductEffect
public Effect? Effect { get; set; }
[Required] public int EffectId { get; set; }
}
+2 -2
View File
@@ -8,10 +8,10 @@ public class ProductTimecode
{
public Product? Product { get; set; }
[Required] public int ProductId { get; set; }
public Show? Show { get; set; }
[Required] public int ShowId { get; set; }
[Required] public decimal Start { get; set; }
[Required] public decimal End { get; set; }
}
+2 -2
View File
@@ -4,8 +4,8 @@ namespace PyroFetes.Models;
public class ProviderType
{
[Key] public int Id { get; set; }
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<ServiceProvider>? ServiceProviders { get; set; }
}
+1 -1
View File
@@ -6,7 +6,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; }
+2 -2
View File
@@ -7,9 +7,9 @@ public class Quotation
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Message { get; set; }
[Required, MaxLength(300)] public string? ConditionsSale { get; set; }
[Required] public int CustomerId { get; set; }
public Customer? Customer { get; set; }
public List<QuotationProduct>? QuotationProducts { get; set; }
}
+2 -2
View File
@@ -8,8 +8,8 @@ public class QuotationProduct
{
[Required] public int ProductId { get; set; }
[Required] public int QuotationId { get; set; }
[Required] public int Quantity { get; set; }
[Required] public int Quantity { get; set; }
public Product? Product { get; set; }
public Quotation? Quotation { get; set; }
}
+3 -3
View File
@@ -4,13 +4,13 @@ namespace PyroFetes.Models;
public class ServiceProvider
{
[Key] public int Id { get; set; }
[Key] public int Id { get; set; }
[Required] public decimal Price { get; set; }
//Relations
[Required] public int ProviderTypeId { get; set; }
public ProviderType? ProviderType { get; set; }
public List<Contract>? Contracts { get; set; }
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
}
+3 -3
View File
@@ -9,13 +9,13 @@ public class Show
[Required, MaxLength(120)] public string? Place { get; set; }
[MaxLength(500)] public string? Description { get; set; }
public DateOnly? Date { get; set; }
// Link (path/URL/file name) to the pyrotechnic implementation plan
[Required, MaxLength(500)] public string? PyrotechnicImplementationPlan { get; set; }
[Required] public int CityId { get; set; }
public City? City { get; set; }
public List<ShowStaff>? ShowStaffs { get; set; }
public List<ShowTruck>? ShowTrucks { get; set; }
public List<SoundTimecode>? SoundTimecodes { get; set; }
-1
View File
@@ -11,5 +11,4 @@ public class ShowMaterial
public Material? Material { get; set; }
[Required] public int MaterialId { get; set; }
}
+1 -2
View File
@@ -4,6 +4,5 @@ namespace PyroFetes.Models;
public class ShowServiceProvider
{
[Key] public int Id { get; set; }
[Key] public int Id { get; set; }
}
+2 -2
View File
@@ -12,9 +12,9 @@ public class Sound
[Required, MaxLength(40)] public string? Kind { get; set; }
[Required, MaxLength(40)] public string? Format { get; set; }
public DateTime? CreationDate { get; set; }
[Required] public int SoundCategoryId { get; set; }
public SoundCategory? SoundCategory { get; set; }
public List<SoundTimecode>? SoundTimecodes { get; set; }
}
+1 -1
View File
@@ -6,6 +6,6 @@ public class SoundCategory
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string Name { get; set; } = null!;
public List<Sound>? Sounds { get; set; }
}
+1 -1
View File
@@ -10,7 +10,7 @@ public class SoundTimecode
public Show? Show { get; set; }
[Required] public int SoundId { get; set; }
public Sound? Sound { get; set; }
[Required] public decimal Start { get; set; }
[Required] public decimal End { get; set; }
}
+1 -1
View File
@@ -11,7 +11,7 @@ public class Staff
[Required, MaxLength(120)] public string? Email { get; set; }
[Required, MaxLength(100)] public string? F4T2NumberApproval { get; set; }
[Required] public DateOnly F4T2ExpirationDate { get; set; }
public List<ShowStaff>? ShowStaffs { get; set; }
public List<ExperienceLevel>? ExperienceLevels { get; set; }
public List<StaffAvailability>? StaffAvailabilities { get; set; }
+2 -2
View File
@@ -9,9 +9,9 @@ public class Supplier
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(30)] public string? Phone { get; set; }
[Required, MaxLength(100)] public string? Address { get; set; }
[Required,Length(5,5)] public string? ZipCode { get; set; }
[Required, Length(5, 5)] public string? ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
[Required] public int DeliveryDelay { get; set; }
public List<Price>? Prices { get; set; }
}
+1 -1
View File
@@ -9,6 +9,6 @@ public class Truck
[Required] public double? MaxExplosiveCapacity { get; set; }
[Required, MaxLength(80)] public string? Sizes { get; set; }
[Required, MaxLength(40)] public string? Status { get; set; }
public List<ShowTruck>? ShowTrucks { get; set; }
}
+10 -10
View File
@@ -4,19 +4,19 @@ namespace PyroFetes.Models;
public class Warehouse
{
[Key] public int Id {get; set;}
[Required, MaxLength(100)] public string? Name {get; set;}
[Required] public int MaxWeight {get; set;}
[Required] public int Current {get; set;}
[Required] public int MinWeight {get; set;}
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int MaxWeight { get; set; }
[Required] public int Current { get; set; }
[Required] public int MinWeight { get; set; }
[Required, MaxLength(100)] public string? Address { get; set; }
[Required, Length(5,5)] public string? ZipCode { get; set; }
[Required, Length(5, 5)] public string? ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
public List<WarehouseProduct>? WarehouseProducts { get; set; }
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
public List<MaterialWarehouse>? MaterialWarehouses { get; set; }
public List<Movement>? MovementsSource { get; set; }
public List<Movement>? MovementsDestination { get; set; }
}
+1 -1
View File
@@ -10,6 +10,6 @@ public class WarehouseProduct
public Product? Product { get; set; }
[Required] public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
[Required] public int Quantity { get; set; }
}
+1 -4
View File
@@ -20,10 +20,7 @@ builder.Services
.AddAuthenticationJwtBearer(s => s.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong")
.AddAuthorization()
.AddFastEndpoints()
.SwaggerDocument(options =>
{
options.ShortSchemaNames = true;
})
.SwaggerDocument(options => { options.ShortSchemaNames = true; })
.AddCors(options =>
{
options.AddDefaultPolicy(policyBuilder =>
+3 -3
View File
@@ -71,7 +71,7 @@ public class PyroFetesDbContext : DbContext
optionsBuilder.UseSqlServer(connectionString);
}
// Models customization
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -80,13 +80,13 @@ public class PyroFetesDbContext : DbContext
.WithMany(w => w.MovementsSource)
.HasForeignKey(m => m.SourceWarehouseId)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Movement>()
.HasOne(m => m.DestinationWarehouse)
.WithMany(w => w.MovementsDestination)
.HasForeignKey(m => m.DestinationWarehouseId)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<MaterialWarehouse>()
.HasOne(mw => mw.Material)
.WithMany(m => m.MaterialWarehouses)
@@ -2,4 +2,4 @@ using PyroFetes.Models;
namespace PyroFetes.Repositories;
public class DeliverersRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<Deliverer>(pyrofetesContext, mapper);
public class DeliverersRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<Deliverer>(pyrofetesContext, mapper);
@@ -2,4 +2,4 @@ using PyroFetes.Models;
namespace PyroFetes.Repositories;
public class QuotationProductsRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<QuotationProduct>(pyrofetesContext, mapper);
public class QuotationProductsRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<QuotationProduct>(pyrofetesContext, mapper);
@@ -78,10 +78,10 @@ public class DeliveryNotePdfService : IDeliveryNotePdfService
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(4); // Produit
columns.RelativeColumn(2); // Qté
columns.RelativeColumn(2); // PU
columns.RelativeColumn(2); // Total
columns.RelativeColumn(4); // Produit
columns.RelativeColumn(2); // Qté
columns.RelativeColumn(2); // PU
columns.RelativeColumn(2); // Total
});
// En-têtes
@@ -92,16 +92,16 @@ public class DeliveryNotePdfService : IDeliveryNotePdfService
header.Cell().Element(CellHeader).AlignRight().Text("PU");
header.Cell().Element(CellHeader).AlignRight().Text("Total");
});
foreach (ProductDelivery 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;
total += l.Quantity * l.Quantity;
}
IContainer CellHeader(IContainer c) =>
@@ -121,13 +121,10 @@ public class DeliveryNotePdfService : IDeliveryNotePdfService
});
// Signature en bas à droite
page.Footer().AlignRight().Column(col =>
{
col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea);
});
page.Footer().AlignRight().Column(col => { col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea); });
});
});
return document.GeneratePdf();
}
}
}
@@ -75,10 +75,10 @@ public class PurchaseOrderPdfService : IPurchaseOrderPdfService
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(4); // Produit
columns.RelativeColumn(1); // Qté
columns.RelativeColumn(2); // PU
columns.RelativeColumn(2); // Total
columns.RelativeColumn(4); // Produit
columns.RelativeColumn(1); // Qté
columns.RelativeColumn(2); // PU
columns.RelativeColumn(2); // Total
});
// En-têtes
@@ -89,20 +89,20 @@ public class PurchaseOrderPdfService : IPurchaseOrderPdfService
header.Cell().Element(CellHeader).AlignRight().Text("PU");
header.Cell().Element(CellHeader).AlignRight().Text("Total");
});
foreach (PurchaseProduct 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;
total += l.Quantity * price;
}
IContainer CellHeader(IContainer c) =>
@@ -132,19 +132,16 @@ public class PurchaseOrderPdfService : IPurchaseOrderPdfService
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} €");
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(signature, ImageScaling.FitArea);
});
page.Footer().AlignRight().Column(col => { col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea); });
});
});
return document.GeneratePdf();
}
}
}
+10 -13
View File
@@ -74,10 +74,10 @@ public class QuotationPdfService : IQuotationPdfService
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(10); // Produit
columns.RelativeColumn(2); // Qté
columns.RelativeColumn(3); // PU
columns.RelativeColumn(3); // Total
columns.RelativeColumn(10); // Produit
columns.RelativeColumn(2); // Qté
columns.RelativeColumn(3); // PU
columns.RelativeColumn(3); // Total
});
// En-têtes
@@ -88,15 +88,15 @@ public class QuotationPdfService : IQuotationPdfService
header.Cell().Element(CellHeader).AlignRight().Text("PU");
header.Cell().Element(CellHeader).AlignRight().Text("Total");
});
foreach (QuotationProduct 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;
total = total + l.Quantity * l.Quantity;
}
IContainer CellHeader(IContainer c) =>
@@ -131,16 +131,13 @@ public class QuotationPdfService : IQuotationPdfService
});
// Signature en bas à droite
page.Footer().AlignRight().Column(col =>
{
col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea);
});
page.Footer().AlignRight().Column(col => { col.Item().AlignRight().Height(100).Image(signature, ImageScaling.FitArea); });
});
});
// Pour avoir la vue du PDF en temps réel
// document.ShowInCompanion();
return document.GeneratePdf();
}
}
}
@@ -11,6 +11,6 @@ public class GetPurchaseOrderByIdWithProductsSpec : SingleResultSpecification<Pu
.Where(x => x.Id == purchaseOrderId)
.Include(x => x.PurchaseProducts!)
.ThenInclude(p => p.Product)
.ThenInclude(p=> p!.Prices);
.ThenInclude(p => p!.Prices);
}
}
}
@@ -5,7 +5,7 @@ namespace PyroFetes.Specifications.PurchaseProducts;
public sealed class GetPurchaseProductByProductIdAndPurchaseOrderIdSpec : SingleResultSpecification<PurchaseProduct>
{
public GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(int productId, int purchaseOrderId)
public GetPurchaseProductByProductIdAndPurchaseOrderIdSpec(int productId, int purchaseOrderId)
{
Query
.Where(p => p.ProductId == productId && p.PurchaseOrderId == purchaseOrderId);
@@ -8,6 +8,6 @@ public sealed class GetUserByNameSpec : SingleResultSpecification<User>
public GetUserByNameSpec(string userName)
{
Query
.Where(x=> x.Name == userName);
.Where(x => x.Name == userName);
}
}
@@ -9,6 +9,5 @@ public sealed class GetProductTotalQuantitySpec : Specification<WarehouseProduct
{
Query
.Where(wp => wp.ProductId == productId);
}
}