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
+1 -1
View File
@@ -7,7 +7,7 @@ public class GetPriceDto
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; }
@@ -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; }
@@ -7,7 +7,7 @@ public class GetQuotationProductDto
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; }
@@ -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()
{
@@ -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)
{
@@ -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)
{
@@ -40,7 +40,7 @@ public class DtoToEntityMappings : Profile
.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>();
+7 -7
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;}
[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;}
[Required] public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public List<ShowMaterial>? ShowMaterials {get; set;}
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
public List<ShowMaterial>? ShowMaterials { get; set; }
public List<MaterialWarehouse>? MaterialWarehouses { get; set; }
}
+7 -7
View File
@@ -6,14 +6,14 @@ 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;}
[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; }
}
+3 -5
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; }
@@ -23,8 +23,8 @@ 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; }
}
}
-1
View File
@@ -11,5 +11,4 @@ public class ProductEffect
public Effect? Effect { get; set; }
[Required] public int EffectId { get; set; }
}
-1
View File
@@ -11,5 +11,4 @@ public class ShowMaterial
public Material? Material { get; set; }
[Required] public int MaterialId { get; set; }
}
-1
View File
@@ -5,5 +5,4 @@ namespace PyroFetes.Models;
public class ShowServiceProvider
{
[Key] public int Id { get; set; }
}
+1 -1
View File
@@ -9,7 +9,7 @@ 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; }
+7 -7
View File
@@ -4,18 +4,18 @@ 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 -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 =>
@@ -121,10 +121,7 @@ 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); });
});
});
@@ -132,16 +132,13 @@ 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); });
});
});
@@ -131,10 +131,7 @@ 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); });
});
});
@@ -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);
}
}
@@ -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);
}
}