24 Commits

Author SHA1 Message Date
f155d03559 Actualiser PyroFetes/DTO/Material/Response/GetMaterialDto.cs 2025-10-08 16:55:00 +02:00
f3ed82f4a4 Actualiser PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs 2025-10-08 16:54:31 +02:00
22275b63f2 Actualiser PyroFetes/DTO/Material/Request/CreateMaterialDto.cs 2025-10-08 16:54:02 +02:00
018f7c5c25 Ajouter PyroFetes/Endpoints/Material/UpdateMaterialEndpoint 2025-10-08 16:45:05 +02:00
81ab26f765 Ajouter PyroFetes/Endpoints/Material/GetMaterialEndpoint 2025-10-08 16:44:35 +02:00
75ab503dfc Ajouter PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint 2025-10-08 16:43:09 +02:00
52f0e84323 Ajouter PyroFetes/Endpoints/Material/DeleteMaterialEndpoint 2025-10-08 16:42:33 +02:00
9b9ec133aa Ajouter PyroFetes/Endpoints/Material/CreateMaterialEndpoint 2025-10-08 16:41:53 +02:00
4aa6db31b0 Ajouter PyroFetes/Endpoints/Effect/UpdateEffectEndpoint 2025-10-08 16:40:48 +02:00
149cd9eb33 Ajouter PyroFetes/Endpoints/Effect/GetEffectEndpoint 2025-10-08 16:40:22 +02:00
d7bc054cb5 Ajouter PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint 2025-10-08 16:39:54 +02:00
abe508bd7c Ajouter PyroFetes/Endpoints/Effect/DeleteEffectEndpoint 2025-10-08 16:39:29 +02:00
94ea571a42 Ajouter PyroFetes/Endpoints/Effect/CreateEffectEndpoint 2025-10-08 16:39:11 +02:00
93d259638a Ajouter PyroFetes/Endpoints/Color/UpdateColorEndpoint 2025-10-08 16:38:39 +02:00
e6030cacf2 Ajouter PyroFetes/Endpoints/Color/GetColorEndpoint 2025-10-08 16:38:21 +02:00
ccaaf25dbc Ajouter PyroFetes/Endpoints/Color/GetAllColorsEndpoint 2025-10-08 16:38:00 +02:00
abc1c42b53 Ajouter PyroFetes/Endpoints/Color/DeleteColorEndpoint 2025-10-08 16:37:32 +02:00
7e3eaa3b51 Merge remote-tracking branch 'origin/develop' into develop 2025-10-08 16:36:09 +02:00
658d346dd0 MAJ 2025-10-08 16:35:46 +02:00
997d7c64fb Ajouter PyroFetes/Endpoints/Color/CreateColorEndpoint 2025-10-08 16:35:28 +02:00
81854417d8 Merge branch 'feature/matheo' into develop 2025-10-08 16:30:56 +02:00
423f8f9645 MAJ Product's DTO 2025-10-08 16:30:20 +02:00
bd8495b79a MAJ Program en FastEndpoint 2025-10-08 16:27:55 +02:00
c729af3d32 AJout des DTO et endpoint sur le nouveau git 2025-10-08 15:46:36 +02:00
153 changed files with 2228 additions and 6286 deletions

View File

@@ -0,0 +1,7 @@
namespace API.DTO.Brand.Request;
public class CreateBrandDto
{
public string? Name { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace API.DTO.Brand.Request;
public class UpdateBrandDto
{
public int Id { get; set; }
public string? Name { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace API.DTO.Brand.Response;
public class GetBrandDto
{
public int Id { get; set; }
public string? Name { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace API.DTO.Classification.Request;
public class CreateClassificationDto
{
public string? Label { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace API.DTO.Classification.Request;
public class UpdateClassificationDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace API.DTO.Classification.Response;
public class GetClassificationDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace API.DTO.Color.Request;
public class CreateColorDto
{
public string? Label { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace API.DTO.Color.Request;
public class UpdateColorDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace API.DTO.Color.Response;
public class GetColorDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -1,6 +0,0 @@
namespace PyroFetes.DTO.Deliverer.Request;
public class CreateDelivererDto
{
public string? Transporter { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.Deliverer.Request;
public class UpdateDelivererDto
{
public int Id { get; set; }
public string? Transporter { get; set; }
}

View File

@@ -1,11 +0,0 @@
using PyroFetes.DTO.DeliveryNote.Response;
namespace PyroFetes.DTO.Deliverer.Response;
public class GetDelivererDto
{
public int Id { get; set; }
public string? Transporter { get; set; }
public List<GetDeliveryNoteDto>? DeliveryNotes { get; set; }
}

View File

@@ -1,11 +0,0 @@
namespace PyroFetes.DTO.DeliveryNote.Request;
public class CreateDeliveryNoteDto
{
public string? TrackingNumber { get; set; }
public DateOnly EstimateDeliveryDate { get; set; }
public DateOnly ExpeditionDate { get; set; }
public DateOnly RealDeliveryDate { get; set; }
public int DelivererId { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.DeliveryNote.Request;
public class PatchDeliveryNoteRealDeliveryDateDto
{
public int Id { get; set; }
public DateOnly RealDeliveryDate { get; set; }
}

View File

@@ -1,12 +0,0 @@
namespace PyroFetes.DTO.DeliveryNote.Request;
public class UpdateDeliveryNoteDto
{
public int Id { get; set; }
public string? TrackingNumber { get; set; }
public DateOnly EstimateDeliveryDate { get; set; }
public DateOnly ExpeditionDate { get; set; }
public DateOnly? RealDeliveryDate { get; set; }
public int DelivererId { get; set; }
}

View File

@@ -1,17 +0,0 @@
using PyroFetes.DTO.ProductDelivery.Response;
namespace PyroFetes.DTO.DeliveryNote.Response;
public class GetDeliveryNoteDto
{
public int Id { get; set; }
public string? TrackingNumber { get; set; }
public DateOnly EstimateDeliveryDate { get; set; }
public DateOnly ExpeditionDate { get; set; }
public DateOnly? RealDeliveryDate { get; set; }
public int DelivererId { get; set; }
public string? DelivererTransporter { get; set; }
public List<GetProductDeliveryDto>? Products { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace API.DTO.Effect.Request;
public class CreateEffectDto
{
public string? Label { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace API.DTO.Effect.Request;
public class UpdateEffectDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace API.DTO.Effect.Response;
public class GetEffectDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace API.DTO.Material.Request;
public class CreateMaterialDto
{
public string? Label { get; set; }
public int Quantity { get; set; }
public int WarehouseId {get; set;}
}

View File

@@ -0,0 +1,10 @@
namespace API.DTO.Material.Request;
public class UpdateMaterialDto
{
public int Id { get; set; }
public string? Label { get; set; }
public int Quantity { get; set; }
public int WarehouseId {get; set;}
}

View File

@@ -0,0 +1,10 @@
namespace API.DTO.Material.Response;
public class GetMaterialDto
{
public int Id { get; set; }
public string? Label { get; set; }
public int Quantity { get; set; }
public int WarehouseId {get; set;}
}

View File

@@ -0,0 +1,10 @@
namespace API.DTO.Movement.Request;
public class CreateMovementDto
{
public DateTime Date { get; set; }
public DateTime Start {get; set;}
public DateTime Arrival {get; set;}
public int Quantity {get; set;}
}

View File

@@ -0,0 +1,11 @@
namespace API.DTO.Movement.Request;
public class UpdateMovementDto
{
public int Id { get; set; }
public DateTime Date { get; set; }
public DateTime Start {get; set;}
public DateTime Arrival {get; set;}
public int Quantity {get; set;}
}

View File

@@ -0,0 +1,11 @@
namespace API.DTO.Movement.Response;
public class GetMovementDto
{
public int Id { get; set; }
public DateTime Date { get; set; }
public DateTime Start {get; set;}
public DateTime Arrival {get; set;}
public int Quantity {get; set;}
}

View File

@@ -1,27 +0,0 @@
namespace PyroFetes.DTO.Price.Request;
public class CreatePriceDto
{
public decimal SellingPrice { get; set; }
public int SupplierId { get; set; }
public string? SupplierName { get; set; }
public string? SupplierEmail { get; set; }
public string? SupplierPhone { get; set; }
public string? SupplierAddress { get; set; }
public int SupplierZipCode { get; set; }
public string? SupplierCity { get; set; }
public int SupplierDeliveryDelay { get; set; }
public int ProductId { get; set; }
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.Price.Request;
public class PatchPriceSellingPriceDto
{
public int Id { get; set; }
public decimal SellingPrice { get; set; }
}

View File

@@ -1,28 +0,0 @@
namespace PyroFetes.DTO.Price.Request;
public class UpdatePriceDto
{
public int Id { get; set; }
public decimal SellingPrice { get; set; }
public int SupplierId { get; set; }
public string? SupplierName { get; set; }
public string? SupplierEmail { get; set; }
public string? SupplierPhone { get; set; }
public string? SupplierAddress { get; set; }
public int SupplierZipCode { get; set; }
public string? SupplierCity { get; set; }
public int SupplierDeliveryDelay { get; set; }
public int ProductId { get; set; }
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
}

View File

@@ -1,28 +0,0 @@
namespace PyroFetes.DTO.Price.Response;
public class GetPriceDto
{
public int Id { get; set; }
public decimal SellingPrice { get; set; }
public int SupplierId { get; set; }
public string? SupplierName { get; set; }
public string? SupplierEmail { get; set; }
public string? SupplierPhone { get; set; }
public string? SupplierAddress { get; set; }
public int SupplierZipCode { get; set; }
public string? SupplierCity { get; set; }
public int SupplierDeliveryDelay { get; set; }
public int ProductId { get; set; }
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
}

View File

@@ -1,15 +1,21 @@
using PyroFetes.Models;
namespace PyroFetes.DTO.Product.Request;
public class CreateProductDto
{
public int References { get; set; }
public string? Name { get; set; }
public decimal Duration {get; set;}
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice {get; set;}
public string? Image { get; set; }
public string? Link { get; set; }
public int MinimalQuantity { get; set; }
public int ClassificationId { get; set;}
public int ProductCategoryId { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.Product.Request;
public class PatchProductMinimalStockDto
{
public int Id { get; set; }
public int MinimalQuantity { get; set; }
}

View File

@@ -1,16 +1,20 @@
using PyroFetes.Models;
namespace PyroFetes.DTO.Product.Request;
public class UpdateProductDto
{
public int Id { get; set; }
public int References { get; set; }
public int Reference { get; set; }
public string? Name { get; set; }
public decimal Duration {get; set;}
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice {get; set;}
public string? Image { get; set; }
public string? Link { get; set; }
public int MinimalQuantity { get; set; }
public int ClassificationId { get; set;}
public int ProductCategoryId { get; set; }
}

View File

@@ -1,16 +1,23 @@
using PyroFetes.Models;
namespace PyroFetes.DTO.Product.Response;
public class GetProductDto
{
public int Id { get; set; }
public int References { get; set; }
public int Reference { get; set; }
public string? Name { get; set; }
public decimal Duration {get; set;}
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice {get; set;}
public string? Image { get; set; }
public string? Link { get; set; }
public int MinimalQuantity { get; set; }
public int ClassificationId { get; set;}
public string? ClassificationLabel { get; set; }
public int ProductCategoryId { get; set; }
public string? ProductCategoryLabel { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace API.DTO.ProductCategory.Request;
public class CreateProductCategoryDto
{
public string? Label { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace API.DTO.ProductCategory.Request;
public class UpdateProductCategoryDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace API.DTO.ProductCategory.Response;
public class GetProductCategoryDto
{
public int Id { get; set; }
public string? Label { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.ProductDelivery.Request;
public class CreateProductDeliveryDto
{
public int ProductId { get; set; }
public int DeliveryNoteId { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.ProductDelivery.Request;
public class UpdateProductDeliveryDto
{
public int Quantity { get; set; }
public int ProductId { get; set; }
public int DeliveryNoteId { get; set; }
}

View File

@@ -1,28 +0,0 @@
namespace PyroFetes.DTO.ProductDelivery.Response;
public class GetProductDeliveryDto
{
public int ProductId { get; set; }
public int ProductReference { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
public int DeliveryNoteId { get; set; }
public string? DeliveryNoteTrackingNumber { get; set; }
public DateOnly DeliveryNoteEstimateDeliveryDate { get; set; }
public DateOnly DeliveryNoteExpeditionDate { get; set; }
public DateOnly? DeliveryNoteRealDeliveryDate { get; set; }
public int DeliveryNoteDeliverId { get; set; }
public string? DeliveryNoteDeliverTransporter { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.PurchaseOrder.Request;
public class PatchPurchaseOrderPurchaseConditionsDto
{
public int Id { get; set; }
public string? PurchaseConditions { get; set; }
}

View File

@@ -1,10 +0,0 @@
using PyroFetes.DTO.PurchaseProduct.Response;
namespace PyroFetes.DTO.PurchaseOrder.Response;
public class GetPurchaseOrderDto
{
public int Id { get; set; }
public string? PurchaseConditions { get; set; }
public List<GetPurchaseProductDto>? GetPurchaseProductDto { get; set; }
}

View File

@@ -1,9 +0,0 @@
namespace PyroFetes.DTO.PurchaseProduct.Request;
public class CreatePurchaseProductDto
{
public int Quantity { get; set; }
public int ProductId { get; set; }
public int PurchaseOrderId { get; set; }
public string? PurchaseOrderPurchaseConditions { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.PurchaseProduct.Request;
public class PatchPurchaseProductQuantityDto
{
public int ProductId { get; set; }
public int PurchaseOrderId { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,22 +0,0 @@
namespace PyroFetes.DTO.PurchaseProduct.Request;
public class UpdatePurchaseProductDto
{
public int ProductId { get; set; }
public int PurchaseOrderId { get; set; }
public int Quantity { get; set; }
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
public string? PurchaseOrderPurchaseConditions { get; set; }
}

View File

@@ -1,21 +0,0 @@
namespace PyroFetes.DTO.PurchaseProduct.Response;
public class GetPurchaseProductDto
{
public int ProductId { 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 decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
public int PurchaseOrderId { get; set; }
public string? PurchaseOrderPurchaseConditions { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.Quotation.Request;
public class PatchQuotationConditionsSaleDto
{
public int Id { get; set; }
public string? ConditionsSale { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.Quotation.Request;
public class PatchQuotationMessageDto
{
public int Id { get; set; }
public string? Message { get; set; }
}

View File

@@ -1,11 +0,0 @@
using PyroFetes.DTO.QuotationProduct.Response;
namespace PyroFetes.DTO.Quotation.Response;
public class GetQuotationDto
{
public int Id { get; set; }
public string? Message { get; set; }
public string? ConditionsSale { get; set; }
public List<GetQuotationProductDto>? GetQuotationProductDto { get; set; }
}

View File

@@ -1,22 +0,0 @@
namespace PyroFetes.DTO.QuotationProduct.Request;
public class CreateQuotationProductDto
{
public int Quantity { get; set; }
public int QuotationId { get; set; }
public string? QuotationMessage { get; set; }
public string? QuotationConditionsSale { get; set; }
public int ProductId { get; set; }
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.QuotationProduct.Request;
public class PatchQuotationProductQuantityDto
{
public int ProductId { get; set; }
public int QuotationId { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,23 +0,0 @@
namespace PyroFetes.DTO.QuotationProduct.Request;
public class UpdateQuotationProductDto
{
public int Id { get; set; }
public int Quantity { get; set; }
public int QuotationId { get; set; }
public string? QuotationMessage { get; set; }
public string? QuotationConditionsSale { get; set; }
public int ProductId { get; set; }
public int ProductReferences { get; set; }
public string? ProductName { get; set; }
public decimal ProductDuration {get; set;}
public decimal ProductCaliber { get; set; }
public int ProductApprovalNumber { get; set; }
public decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
}

View File

@@ -1,22 +0,0 @@
namespace PyroFetes.DTO.QuotationProduct.Response;
public class GetQuotationProductDto
{
public int Quantity { get; set; }
public int QuotationId { get; set; }
public string? QuotationMessage { get; set; }
public string? QuotationConditionsSale { get; set; }
public int ProductId { 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 decimal ProductWeight { get; set; }
public decimal ProductNec { get; set; }
public string? ProductImage { get; set; }
public string? ProductLink { get; set; }
public int ProductMinimalQuantity { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.SettingDTO.Request;
public class CreateSettingDto
{
public string? ElectronicSignature { get; set; }
public string? Logo { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.SettingDTO.Request;
public class PatchSettingElectronicSignatureDto
{
public int Id { get; set; }
public string? ElectronicSignature { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.SettingDTO.Request;
public class PatchSettingLogoDto
{
public int Id { get; set; }
public string? Logo { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.SettingDTO.Response;
public class GetSettingDto
{
public int Id { get; set; }
public string? ElectronicSignature { get; set; }
public string? Logo { get; set; }
}

View File

@@ -1,12 +1,11 @@
namespace PyroFetes.DTO.Supplier.Request;
namespace API.DTO.Supplier.Request;
public class CreateSupplierDto
{
public string? Name { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? Address { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string Adress { get; set; }
public int ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
public string City { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.Supplier.Request;
public class PatchSupplierDeliveryDelayDto
{
public int Id { get; set; }
public int DeliveryDelay { get; set; }
}

View File

@@ -1,13 +1,12 @@
namespace PyroFetes.DTO.Supplier.Request;
namespace API.DTO.Supplier.Request;
public class UpdateSupplierDto
{
public int Id { get; set; }
public string? Name { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? Address { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string Adress { get; set; }
public int ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
public string City { get; set; }
}

View File

@@ -1,13 +1,12 @@
namespace PyroFetes.DTO.Supplier.Response;
namespace API.DTO.Supplier.Response;
public class GetSupplierDto
{
public int Id { get; set; }
public string? Name { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? Address { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string Adress { get; set; }
public int ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
public string City { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.User.Request;
public class ConnectUserDto
{
public string? Username { get; set; }
public string? Password { get; set; }
}

View File

@@ -1,10 +0,0 @@
namespace PyroFetes.DTO.User.Request;
public class CreateUserDto
{
public string? Name { get; set; }
public string? Password { get; set; }
public string? Salt { get; set; }
public string? Fonction { get; set; }
public string? Email { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.User.Request;
public class PatchUserPasswordDto
{
public int Id { get; set; }
public string? Password { get; set; }
}

View File

@@ -1,10 +0,0 @@
namespace PyroFetes.DTO.User.Request;
public class UpdateUserDto
{
public int Id { get; set; }
public string? Name { get; set; }
public string? Password { get; set; }
public string? Fonction { get; set; }
public string? Email { get; set; }
}

View File

@@ -1,6 +0,0 @@
namespace PyroFetes.DTO.User.Response;
public class GetTokenDto
{
public string? Token { get; set; }
}

View File

@@ -1,11 +0,0 @@
namespace PyroFetes.DTO.User.Response;
public class GetUserDto
{
public int Id { get; set; }
public string? Name { get; set; }
public string? Password { get; set; }
public string? Salt { get; set; }
public string? Fonction { get; set; }
public string? Email { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.WareHouseProduct.Request;
public class PatchWareHouseProductQuantityDto
{
public int WareHouseId { get; set; }
public int ProductId { get; set; }
public int Quantity { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace PyroFetes.DTO.WareHouseProduct.Response;
public class GetTotalQuantityDto
{
public int ProductId { get; set; }
public int TotalQuantity { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace PyroFetes.DTO.WareHouseProduct.Response;
public class GetWareHouseProductDto
{
public int Quantity { get; set; }
public int WareHouseId { get; set; }
public int ProductId { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace API.DTO.Warehouse.Request;
public class CreateWarehouseDto
{
public string Name {get; set;}
public int MaxWeight {get; set;}
public int Current {get; set;}
public int MinWeight {get; set;}
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}

View File

@@ -0,0 +1,13 @@
namespace API.DTO.Warehouse.Request;
public class UpdateWarehouseDto
{
public int Id {get; set;}
public string Name {get; set;}
public int MaxWeight {get; set;}
public int Current {get; set;}
public int MinWeight {get; set;}
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}

View File

@@ -0,0 +1,13 @@
namespace API.DTO.Warehouse.Response;
public class GetWarehouseDto
{
public int Id {get; set;}
public string Name {get; set;}
public int MaxWeight {get; set;}
public int Current {get; set;}
public int MinWeight {get; set;}
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}

View File

@@ -0,0 +1,35 @@
using API.DTO.Brand.Request;
using API.DTO.Brand.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Brand;
public class CreateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateBrandDto, GetBrandDto>
{
public override void Configure()
{
Post("/api/brands");
AllowAnonymous();
}
public override async Task HandleAsync(CreateBrandDto req, CancellationToken ct)
{
Models.Brand brand = new ()
{
Name = req.Name
};
pyrofetesdbcontext.Brands.Add(brand);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Marque créé avec succès !");
GetBrandDto responseDto = new ()
{
Name = req.Name
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Brand;
public class DeleteBrandRequest
{
public int Id { get; set; }
}
public class DeleteBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteBrandRequest>
{
public override void Configure()
{
Delete("/api/brands/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteBrandRequest req, CancellationToken ct)
{
Models.Brand? brandToDelete = await pyrofetesdbcontext
.Brands
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (brandToDelete == null)
{
Console.WriteLine($"Aucune marque avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Brands.Remove(brandToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

@@ -0,0 +1,28 @@
using API.DTO.Brand.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Brand;
public class GetAllBrandsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetBrandDto>>
{
public override void Configure()
{
Get("/api/brands");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetBrandDto> responseDto = await pyrofetesdbcontext.Brands
.Select(a => new GetBrandDto
{
Id = a.Id,
Name = a.Name,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,42 @@
using API.DTO.Brand.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Brand;
public class GetBrandRequest
{
public int Id { get; set; }
}
public class GetBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetBrandRequest, GetBrandDto>
{
public override void Configure()
{
Get("/api/brands/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetBrandRequest req, CancellationToken ct)
{
Models.Brand? brand = await pyrofetesdbcontext
.Brands
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (brand == null)
{
Console.WriteLine($"Aucune marque avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetBrandDto responseDto = new()
{
Id = req.Id,
Name = brand.Name
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,34 @@
using API.DTO.Brand.Request;
using API.DTO.Brand.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Brand;
public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateBrandDto, GetBrandDto>
{
public override void Configure()
{
Post("/api/brands");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateBrandDto req, CancellationToken ct)
{
Models.Brand brand = new()
{
Name = req.Name
};
pyrofetesdbcontext.Add(brand);
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetBrandDto response = new()
{
Id = req.Id,
Name = req.Name
};
await Send.OkAsync(response, ct);
}
}

View File

@@ -0,0 +1,35 @@
using API.DTO.Classification.Request;
using API.DTO.Classification.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Classification;
public class CreateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateClassificationDto, GetClassificationDto>
{
public override void Configure()
{
Post("/api/classifications");
AllowAnonymous();
}
public override async Task HandleAsync(CreateClassificationDto req, CancellationToken ct)
{
Models.Classification classification = new ()
{
Label = req.Label
};
pyrofetesdbcontext.Classifications.Add(classification);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Classification créée avec succès !");
GetClassificationDto responseDto = new ()
{
Label = req.Label
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Classification;
public class DeleteClassificationRequest
{
public int Id { get; set; }
}
public class DeleteClassificationEndpoint(PyroFetesDbContext libraryDbContext) : Endpoint<DeleteClassificationRequest>
{
public override void Configure()
{
Delete("/api/classifications/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteClassificationRequest req, CancellationToken ct)
{
Models.Classification? classificationToDelete = await libraryDbContext
.Classifications
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (classificationToDelete == null)
{
Console.WriteLine($"Aucune classification avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
libraryDbContext.Classifications.Remove(classificationToDelete);
await libraryDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

@@ -0,0 +1,28 @@
using API.DTO.Classification.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Classification;
public class GetAllClassificationsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetClassificationDto>>
{
public override void Configure()
{
Get("/api/classifications");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications
.Select(a => new GetClassificationDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,42 @@
using API.DTO.Classification.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Classification;
public class GetClassificationRequest
{
public int Id { get; set; }
}
public class GetClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetClassificationRequest, GetClassificationDto>
{
public override void Configure()
{
Get("/api/classifications/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetClassificationRequest req, CancellationToken ct)
{
Models.Classification? classification = await pyrofetesdbcontext
.Classifications
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (classification == null)
{
Console.WriteLine($"Aucune classification avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetClassificationDto responseDto = new()
{
Id = req.Id,
Label = classification.Label
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,34 @@
using API.DTO.Classification.Request;
using API.DTO.Classification.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Classification;
public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateClassificationDto, GetClassificationDto>
{
public override void Configure()
{
Post("/api/classifications");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateClassificationDto req, CancellationToken ct)
{
Models.Classification classification = new()
{
Label = req.Label
};
pyrofetesdbcontext.Add(classification);
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetClassificationDto response = new()
{
Id = req.Id,
Label = req.Label
};
await Send.OkAsync(response, ct);
}
}

View File

@@ -0,0 +1,35 @@
using API.DTO.Color.Request;
using API.DTO.Color.Response;
using FastEndpoints;
namespace API.Endpoints.Color;
public class CreateColorEndpoint(AppDbContext appDbContext) : Endpoint<CreateColorDto, GetColorDto>
{
public override void Configure()
{
Post("/color/create");
AllowAnonymous();
}
public override async Task HandleAsync(CreateColorDto req, CancellationToken ct)
{
Models.Color color = new()
{
Label = req.Label,
};
appDbContext.Colors.Add(color);
await appDbContext.SaveChangesAsync(ct);
Console.WriteLine("Added Color");
GetColorDto responseDto = new()
{
Id = color.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Color;
public class DeleteColorRequest
{
public int Id { get; set; }
}
public class DeleteColorEndpoint(AppDbContext appDbContext) : Endpoint<DeleteColorRequest>
{
public override void Configure()
{
Delete("/colors/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteColorRequest req, CancellationToken ct)
{
Models.Color? colorToDelete = await appDbContext
.Colors
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (colorToDelete == null)
{
Console.WriteLine($"Aucune couleur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
appDbContext.Colors.Remove(colorToDelete);
await appDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

@@ -0,0 +1,26 @@
using API.DTO.Color.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Color;
public class GetAllColorsEndpoint(AppDbContext appDbContext) : EndpointWithoutRequest<List<GetColorDto>>
{
public override void Configure()
{
Get("/colors");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetColorDto> responseDto = await appDbContext.Colors
.Select(a => new GetColorDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,42 @@
using API.DTO.Color.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Color;
public class GetColorRequest
{
public int Id { get; set; }
}
public class GetColorEndpoint(AppDbContext appDbContext) : Endpoint<GetColorRequest, GetColorDto>
{
public override void Configure()
{
Get("/colors/{@id}", x => new { x.Id});
AllowAnonymous();
}
public override async Task HandleAsync(GetColorRequest req, CancellationToken ct)
{
Models.Color? color = await appDbContext
.Colors
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (color == null)
{
Console.WriteLine("Aucune couleur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetColorDto responseDto = new()
{
Id = color.Id,
Label = color.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,42 @@
using API.DTO.Color.Request;
using API.DTO.Color.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Color;
public class UpdateColorEndpoint(AppDbContext appDbContext) : Endpoint<UpdateColorDto, GetColorDto>
{
public override void Configure()
{
Put("/colors/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateColorDto req, CancellationToken ct)
{
Models.Color? colorToEdit = await appDbContext
.Colors
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (colorToEdit == null)
{
Console.WriteLine("Aucune couleur avec l'id {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
colorToEdit.Label = req.Label;
await appDbContext.SaveChangesAsync(ct);
GetColorDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,34 @@
using API.DTO.Effect.Request;
using API.DTO.Effect.Response;
using FastEndpoints;
namespace API.Endpoints.Effect;
public class CreateEffectEndpoint(AppDbContext appDbContext) : Endpoint<CreateEffectDto, GetEffectDto>
{
public override void Configure()
{
Post("/effect/create");
AllowAnonymous();
}
public override async Task HandleAsync(CreateEffectDto req, CancellationToken ct)
{
Models.Effect effect = new()
{
Label = req.Label,
};
appDbContext.Effects.Add(effect);
await appDbContext.SaveChangesAsync(ct);
Console.WriteLine("Effect added");
GetEffectDto responseDto = new()
{
Id = effect.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,36 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Effect;
public class DeleteEffectRequest
{
public int Id { get; set; }
}
public class DeleteEffectEndpoint(AppDbContext appDbContext) : Endpoint<DeleteEffectRequest>
{
public override void Configure()
{
Delete("/effects/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteEffectRequest req, CancellationToken ct)
{
Models.Effect? effectToDelete = await appDbContext
.Effects
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (effectToDelete == null)
{
Console.WriteLine($"Aucun effet avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
appDbContext.Effects.Remove(effectToDelete);
await appDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

@@ -0,0 +1,27 @@
using API.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Effect;
public class GetAllEffectsEndpoint(AppDbContext appDbContext) : EndpointWithoutRequest<List<GetEffectDto>>
{
public override void Configure()
{
Get("/effects");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetEffectDto> responseDto = await appDbContext.Effects
.Select(a => new GetEffectDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,42 @@
using API.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Effect;
public class GetEffectRequest
{
public int Id { get; set; }
}
public class GetEffectEndpoint(AppDbContext appDbContext) : Endpoint<GetEffectRequest, GetEffectDto>
{
public override void Configure()
{
Get("/effect/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetEffectRequest req, CancellationToken ct)
{
Models.Effect? effect = await appDbContext
.Effects
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (effect == null)
{
Console.WriteLine("Aucun effet avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetEffectDto responseDto = new()
{
Id = effect.Id,
Label = effect.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,42 @@
using API.DTO.Effect.Request;
using API.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Effect;
public class UpdateEffectEndpoint(AppDbContext appDbContext) : Endpoint<UpdateEffectDto, GetEffectDto>
{
public override void Configure()
{
Put("/effect/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateEffectDto req, CancellationToken ct)
{
Models.Effect? effectToEdit = await appDbContext
.Effects
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (effectToEdit == null)
{
Console.WriteLine("Aucun effet avec l'id {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
effectToEdit.Label = req.Label;
await appDbContext.SaveChangesAsync(ct);
GetEffectDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,36 @@
using API.DTO.Material.Request;
using API.DTO.Material.Response;
using FastEndpoints;
namespace API.Endpoints.Material;
public class CreateMaterialEndpoint(AppDbContext appDbContext) : Endpoint<CreateMaterialDto, GetMaterialDto>
{
public override void Configure()
{
Post("/material/create");
AllowAnonymous();
}
public override async Task HandleAsync(CreateMaterialDto req, CancellationToken ct)
{
Models.Material quantity = new()
{
Name = req.Name,
Quantity = req.Quantity,
WarehouseId = req.WarehouseId,
};
appDbContext.Materials.Add(quantity);
await appDbContext.SaveChangesAsync(ct);
Console.WriteLine("Material added");
GetMaterialDto responseDto = new()
{
Id = quantity.Id,
WarehouseId = quantity.WarehouseId,
Name = req.Name,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,35 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Material;
public class DeleteMaterialRequest
{
public int Id { get; set; }
}
public class DeleteMaterialEndpoint(AppDbContext appDbContext) : Endpoint<DeleteMaterialRequest>
{
public override void Configure()
{
Delete("/materials/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteMaterialRequest req, CancellationToken ct)
{
Models.Material? materialToDelete = await appDbContext
.Materials
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (materialToDelete == null)
{
Console.WriteLine($"Aucun matériel avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
appDbContext.Materials.Remove(materialToDelete);
await appDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

@@ -0,0 +1,28 @@
using API.DTO.Material.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Material;
public class GetAllMaterialsEndpoint(AppDbContext appDbContext) : EndpointWithoutRequest<List<GetMaterialDto>>
{
public override void Configure()
{
Get("/material");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetMaterialDto> responseDto = await appDbContext.Materials
.Select(a => new GetMaterialDto
{
Id = a.Id,
Name = a.Name,
Quantity = a.Quantity,
WarehouseId = a.WarehouseId,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,43 @@
using API.DTO.Material.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Material;
public class GetMaterialRequest
{
public int Id { get; set; }
}
public class GetMaterialEndpoint(AppDbContext appDbContext) : Endpoint<GetMaterialRequest, GetMaterialDto>
{
public override void Configure()
{
Get("/material/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetMaterialRequest req, CancellationToken ct)
{
Models.Material? material = await appDbContext
.Materials
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (material == null)
{
Console.WriteLine("Aucun matériel avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetMaterialDto responseDto = new()
{
Id = material.Id,
Name = material.Name,
WarehouseId = material.WarehouseId,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,43 @@
using API.DTO.Material.Request;
using API.DTO.Material.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Material;
public class UpdateMaterialEndpoint(AppDbContext appDbContext) : Endpoint<UpdateMaterialDto, GetMaterialDto>
{
public override void Configure()
{
Put("/material/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateMaterialDto req, CancellationToken ct)
{
Models.Material? materialToEdit = await appDbContext
.Materials
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (materialToEdit == null)
{
Console.WriteLine("Aucun matériel avec l'id {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
materialToEdit.Name = req.Name;
materialToEdit.WarehouseId = req.WarehouseId;
await appDbContext.SaveChangesAsync(ct);
GetMaterialDto responseDto = new()
{
Id = req.Id,
Name = req.Name,
WarehouseId = req.WarehouseId,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,41 @@
using API.DTO.Movement.Request;
using API.DTO.Movement.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Movement;
public class CreateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateMovementDto, GetMovementDto>
{
public override void Configure()
{
Post("/api/movements");
AllowAnonymous();
}
public override async Task HandleAsync(CreateMovementDto req, CancellationToken ct)
{
Models.Movement movement = new ()
{
Date = req.Date,
Start = req.Start,
Arrival = req.Arrival,
Quantity = req.Quantity
};
pyrofetesdbcontext.Movements.Add(movement);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Movement créée avec succès !");
GetMovementDto responseDto = new ()
{
Date = req.Date,
Start = req.Start,
Arrival = req.Arrival,
Quantity = req.Quantity
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Movement;
public class DeleteMovementRequest
{
public int Id { get; set; }
}
public class DeleteMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteMovementRequest>
{
public override void Configure()
{
Delete("/api/Movements/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteMovementRequest req, CancellationToken ct)
{
Models.Movement? movementToDelete = await pyrofetesdbcontext
.Movements
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (movementToDelete == null)
{
Console.WriteLine($"Aucune mouvement avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Movements.Remove(movementToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

@@ -0,0 +1,31 @@
using API.DTO.Movement.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Movement;
public class GetAllMovementsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetMovementDto>>
{
public override void Configure()
{
Get("/api/movements");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetMovementDto> responseDto = await pyrofetesdbcontext.Movements
.Select(a => new GetMovementDto
{
Id = a.Id,
Date = a.Date,
Start = a.Start,
Arrival = a.Arrival,
Quantity = a.Quantity
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}

Some files were not shown because too many files have changed in this diff Show More