From 8a8a47c99cf9be5860111a3185ee5eb4cc21725c Mon Sep 17 00:00:00 2001 From: oistig Date: Thu, 9 Oct 2025 16:52:35 +0200 Subject: [PATCH 1/7] Initial commit From 8f4171a045bf1aa25f2c038870f04dd256e137d1 Mon Sep 17 00:00:00 2001 From: oistig Date: Thu, 9 Oct 2025 16:55:29 +0200 Subject: [PATCH 2/7] 09/10 --- PyroFetes/DTO/Brand/Request/CreateBrandDto.cs | 7 + PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs | 8 + PyroFetes/DTO/Brand/Response/GetBrandDto.cs | 8 + .../Request/CreateClassificationDto.cs | 7 + .../Request/UpdateClassificationDto.cs | 8 + .../Response/GetClassificationDto.cs | 8 + PyroFetes/DTO/Color/Request/CreateColorDto.cs | 6 + PyroFetes/DTO/Color/Request/UpdateColorDto.cs | 7 + PyroFetes/DTO/Color/Response/GetColorDto.cs | 7 + .../DTO/Effect/Request/CreateEffectDto.cs | 6 + .../DTO/Effect/Request/UpdateEffectDto.cs | 7 + PyroFetes/DTO/Effect/Response/GetEffectDto.cs | 7 + .../DTO/Material/Request/CreateMaterialDto.cs | 9 + .../DTO/Material/Request/UpdateMaterialDto.cs | 10 + .../DTO/Material/Response/GetMaterialDto.cs | 10 + .../DTO/Movement/Request/CreateMovementDto.cs | 10 + .../DTO/Movement/Request/UpdateMovementDto.cs | 11 + .../DTO/Movement/Response/GetMovementDto.cs | 11 + .../DTO/Product/Request/CreateProductDto.cs | 21 + .../DTO/Product/Request/UpdateProductDto.cs | 20 + .../DTO/Product/Response/GetProductDto.cs | 23 + .../Request/CreateProductCategoryDto.cs | 6 + .../Request/UpdateProductCategoryDto.cs | 7 + .../Response/GetProductCategoryDto.cs | 8 + .../DTO/Supplier/Request/CreateSupplierDto.cs | 11 + .../DTO/Supplier/Request/UpdateSupplierDto.cs | 12 + .../DTO/Supplier/Response/GetSupplierDto.cs | 12 + .../Warehouse/Request/CreateWarehouseDto.cs | 12 + .../Warehouse/Request/UpdateWarehouseDto.cs | 13 + .../DTO/Warehouse/Response/GetWarehouseDto.cs | 13 + .../Endpoints/Brand/CreateBrandEndpoint.cs | 35 + .../Endpoints/Brand/DeleteBrandEndpoint.cs | 38 + .../Endpoints/Brand/GetAllBrandsEndpoint.cs | 28 + PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs | 42 + .../Endpoints/Brand/UpdateBrandEndpoint.cs | 34 + .../CreateClassificationEndpoint.cs | 35 + .../DeleteClassificationEndpoint.cs | 38 + .../GetAllClassificationsEndpoint.cs | 28 + .../GetClassificationEndpoint.cs | 42 + .../UpdateClassificationEndpoint.cs | 34 + .../Endpoints/Color/CreateColorEndpoint.cs | 35 + .../Endpoints/Color/DeleteColorEndpoint.cs | 37 + .../Endpoints/Color/GetAllColorsEndpoint.cs | 26 + PyroFetes/Endpoints/Color/GetColorEndpoint.cs | 42 + .../Endpoints/Color/UpdateColorEndpoint.cs | 42 + .../Endpoints/Effect/CreateEffectEndpoint.cs | 34 + .../Endpoints/Effect/DeleteEffectEndpoint.cs | 36 + .../Endpoints/Effect/GetAllEffectsEndpoint.cs | 27 + .../Endpoints/Effect/GetEffectEndpoint.cs | 42 + .../Endpoints/Effect/UpdateEffectEndpoint.cs | 42 + .../Material/CreateMaterialEndpoint.cs | 36 + .../Material/DeleteMaterialEndpoint.cs | 35 + .../Material/GetAllMaterialsEndpoint.cs | 28 + .../Endpoints/Material/GetMaterialEndpoint.cs | 43 + .../Material/UpdateMaterialEndpoint.cs | 43 + .../Movement/CreateMovementEndpoint.cs | 41 + .../Movement/DeleteMovementEndpoint.cs | 38 + .../Movement/GetAllMovementsEndpoint.cs | 31 + .../Endpoints/Movement/GetMovementEndpoint.cs | 45 + .../Movement/UpdateMovementEndpoint.cs | 40 + .../Product/CreateProductEndpoint.cs | 57 + .../Product/DeleteProductEndpoint.cs | 37 + .../Product/GetAllProductsEndpoint.cs | 40 + .../Endpoints/Product/GetProductEndpoint.cs | 55 + .../Product/UpdateProductEndpoint.cs | 58 + .../CreateProductCategoryEndpoint.cs | 37 + .../DeleteProductCategoryEndpoint.cs | 36 + .../GetAllProductCategoriesEndpoint.cs | 27 + .../GetProductCategoryEndpoint.cs | 42 + .../UpdateProductCategoryEndpoint.cs | 39 + .../Supplier/CreateSupplierEndpoint.cs | 48 + .../Supplier/DeleteSupplierEndpoint.cs | 37 + .../Supplier/GetAllSupplierEndpoint.cs | 32 + .../Endpoints/Supplier/GetSupplierEndpoint.cs | 46 + .../Supplier/UpdateSupplierEndpoint.cs | 52 + .../Warehouse/CreateWarehouseEndpoint.cs | 47 + .../Warehouse/DeleteWarehouseEndpoint.cs | 37 + .../Warehouse/GetAllWarehouseEndpoint.cs | 33 + .../Warehouse/GetWarehouseEndpoint.cs | 47 + .../Warehouse/UpdateWarehouseEndpoint.cs | 54 + .../PyroFetesDbContextModelSnapshot.cs | 1948 +++++++++++++++++ PyroFetes/Models/Availability.cs | 16 + PyroFetes/Models/Brand.cs | 14 + PyroFetes/Models/City.cs | 14 + PyroFetes/Models/Classification.cs | 13 + PyroFetes/Models/Color.cs | 13 + PyroFetes/Models/Communication.cs | 16 + PyroFetes/Models/Contact.cs | 26 + PyroFetes/Models/ContactServiceProvider.cs | 14 + PyroFetes/Models/Contract.cs | 15 + PyroFetes/Models/Customer.cs | 16 + PyroFetes/Models/CustomerType.cs | 11 + PyroFetes/Models/Deliverer.cs | 11 + PyroFetes/Models/DeliveryNote.cs | 16 + PyroFetes/Models/Effect.cs | 11 + PyroFetes/Models/ExperienceLevel.cs | 12 + PyroFetes/Models/HistoryOfApproval.cs | 12 + PyroFetes/Models/Material.cs | 16 + PyroFetes/Models/MaterialWarehouse.cs | 14 + PyroFetes/Models/Movement.cs | 19 + PyroFetes/Models/Price.cs | 16 + PyroFetes/Models/Product.cs | 42 + PyroFetes/Models/ProductCategory.cs | 11 + PyroFetes/Models/ProductColor.cs | 14 + PyroFetes/Models/ProductDelivery.cs | 15 + PyroFetes/Models/ProductEffect.cs | 15 + PyroFetes/Models/ProductTimecode.cs | 17 + PyroFetes/Models/ProviderContact.cs | 12 + PyroFetes/Models/ProviderType.cs | 11 + PyroFetes/Models/PurchaseOrder.cs | 11 + PyroFetes/Models/PurchaseProduct.cs | 16 + PyroFetes/Models/Quotation.cs | 15 + PyroFetes/Models/QuotationProduct.cs | 15 + PyroFetes/Models/ServiceProvider.cs | 16 + PyroFetes/Models/Setting.cs | 10 + PyroFetes/Models/Show.cs | 25 + PyroFetes/Models/ShowMaterial.cs | 15 + PyroFetes/Models/ShowServiceProvider.cs | 9 + PyroFetes/Models/ShowStaff.cs | 14 + PyroFetes/Models/ShowTruck.cs | 14 + PyroFetes/Models/Sound.cs | 20 + PyroFetes/Models/SoundCategory.cs | 11 + PyroFetes/Models/SoundTimecode.cs | 16 + PyroFetes/Models/Staff.cs | 20 + PyroFetes/Models/StaffAvailability.cs | 12 + PyroFetes/Models/StaffContact.cs | 13 + PyroFetes/Models/StaffHistoryOfApproval.cs | 12 + PyroFetes/Models/Supplier.cs | 17 + PyroFetes/Models/Truck.cs | 14 + PyroFetes/Models/User.cs | 13 + PyroFetes/Models/Warehouse.cs | 22 + PyroFetes/Models/WarehouseProduct.cs | 15 + PyroFetes/Program.cs | 20 + PyroFetes/PyroFetesDbContext.cs | 93 + 134 files changed, 5101 insertions(+) create mode 100644 PyroFetes/DTO/Brand/Request/CreateBrandDto.cs create mode 100644 PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs create mode 100644 PyroFetes/DTO/Brand/Response/GetBrandDto.cs create mode 100644 PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs create mode 100644 PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs create mode 100644 PyroFetes/DTO/Classification/Response/GetClassificationDto.cs create mode 100644 PyroFetes/DTO/Color/Request/CreateColorDto.cs create mode 100644 PyroFetes/DTO/Color/Request/UpdateColorDto.cs create mode 100644 PyroFetes/DTO/Color/Response/GetColorDto.cs create mode 100644 PyroFetes/DTO/Effect/Request/CreateEffectDto.cs create mode 100644 PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs create mode 100644 PyroFetes/DTO/Effect/Response/GetEffectDto.cs create mode 100644 PyroFetes/DTO/Material/Request/CreateMaterialDto.cs create mode 100644 PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs create mode 100644 PyroFetes/DTO/Material/Response/GetMaterialDto.cs create mode 100644 PyroFetes/DTO/Movement/Request/CreateMovementDto.cs create mode 100644 PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs create mode 100644 PyroFetes/DTO/Movement/Response/GetMovementDto.cs create mode 100644 PyroFetes/DTO/Product/Request/CreateProductDto.cs create mode 100644 PyroFetes/DTO/Product/Request/UpdateProductDto.cs create mode 100644 PyroFetes/DTO/Product/Response/GetProductDto.cs create mode 100644 PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs create mode 100644 PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs create mode 100644 PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs create mode 100644 PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs create mode 100644 PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs create mode 100644 PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs create mode 100644 PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs create mode 100644 PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs create mode 100644 PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs create mode 100644 PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs create mode 100644 PyroFetes/Endpoints/Brand/DeleteBrandEndpoint.cs create mode 100644 PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs create mode 100644 PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs create mode 100644 PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs create mode 100644 PyroFetes/Endpoints/Classification/DeleteClassificationEndpoint.cs create mode 100644 PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs create mode 100644 PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs create mode 100644 PyroFetes/Endpoints/Color/CreateColorEndpoint.cs create mode 100644 PyroFetes/Endpoints/Color/DeleteColorEndpoint.cs create mode 100644 PyroFetes/Endpoints/Color/GetAllColorsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Color/GetColorEndpoint.cs create mode 100644 PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs create mode 100644 PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs create mode 100644 PyroFetes/Endpoints/Effect/DeleteEffectEndpoint.cs create mode 100644 PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs create mode 100644 PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs create mode 100644 PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs create mode 100644 PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs create mode 100644 PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs create mode 100644 PyroFetes/Endpoints/Material/UpdateMaterialEndpoint.cs create mode 100644 PyroFetes/Endpoints/Movement/CreateMovementEndpoint.cs create mode 100644 PyroFetes/Endpoints/Movement/DeleteMovementEndpoint.cs create mode 100644 PyroFetes/Endpoints/Movement/GetAllMovementsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Movement/GetMovementEndpoint.cs create mode 100644 PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs create mode 100644 PyroFetes/Endpoints/Product/CreateProductEndpoint.cs create mode 100644 PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs create mode 100644 PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Product/GetProductEndpoint.cs create mode 100644 PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs create mode 100644 PyroFetes/Endpoints/ProductCategory/CreateProductCategoryEndpoint.cs create mode 100644 PyroFetes/Endpoints/ProductCategory/DeleteProductCategoryEndpoint.cs create mode 100644 PyroFetes/Endpoints/ProductCategory/GetAllProductCategoriesEndpoint.cs create mode 100644 PyroFetes/Endpoints/ProductCategory/GetProductCategoryEndpoint.cs create mode 100644 PyroFetes/Endpoints/ProductCategory/UpdateProductCategoryEndpoint.cs create mode 100644 PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs create mode 100644 PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs create mode 100644 PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs create mode 100644 PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs create mode 100644 PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs create mode 100644 PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs create mode 100644 PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs create mode 100644 PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs create mode 100644 PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs create mode 100644 PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs create mode 100644 PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs create mode 100644 PyroFetes/Models/Availability.cs create mode 100644 PyroFetes/Models/Brand.cs create mode 100644 PyroFetes/Models/City.cs create mode 100644 PyroFetes/Models/Classification.cs create mode 100644 PyroFetes/Models/Color.cs create mode 100644 PyroFetes/Models/Communication.cs create mode 100644 PyroFetes/Models/Contact.cs create mode 100644 PyroFetes/Models/ContactServiceProvider.cs create mode 100644 PyroFetes/Models/Contract.cs create mode 100644 PyroFetes/Models/Customer.cs create mode 100644 PyroFetes/Models/CustomerType.cs create mode 100644 PyroFetes/Models/Deliverer.cs create mode 100644 PyroFetes/Models/DeliveryNote.cs create mode 100644 PyroFetes/Models/Effect.cs create mode 100644 PyroFetes/Models/ExperienceLevel.cs create mode 100644 PyroFetes/Models/HistoryOfApproval.cs create mode 100644 PyroFetes/Models/Material.cs create mode 100644 PyroFetes/Models/MaterialWarehouse.cs create mode 100644 PyroFetes/Models/Movement.cs create mode 100644 PyroFetes/Models/Price.cs create mode 100644 PyroFetes/Models/Product.cs create mode 100644 PyroFetes/Models/ProductCategory.cs create mode 100644 PyroFetes/Models/ProductColor.cs create mode 100644 PyroFetes/Models/ProductDelivery.cs create mode 100644 PyroFetes/Models/ProductEffect.cs create mode 100644 PyroFetes/Models/ProductTimecode.cs create mode 100644 PyroFetes/Models/ProviderContact.cs create mode 100644 PyroFetes/Models/ProviderType.cs create mode 100644 PyroFetes/Models/PurchaseOrder.cs create mode 100644 PyroFetes/Models/PurchaseProduct.cs create mode 100644 PyroFetes/Models/Quotation.cs create mode 100644 PyroFetes/Models/QuotationProduct.cs create mode 100644 PyroFetes/Models/ServiceProvider.cs create mode 100644 PyroFetes/Models/Setting.cs create mode 100644 PyroFetes/Models/Show.cs create mode 100644 PyroFetes/Models/ShowMaterial.cs create mode 100644 PyroFetes/Models/ShowServiceProvider.cs create mode 100644 PyroFetes/Models/ShowStaff.cs create mode 100644 PyroFetes/Models/ShowTruck.cs create mode 100644 PyroFetes/Models/Sound.cs create mode 100644 PyroFetes/Models/SoundCategory.cs create mode 100644 PyroFetes/Models/SoundTimecode.cs create mode 100644 PyroFetes/Models/Staff.cs create mode 100644 PyroFetes/Models/StaffAvailability.cs create mode 100644 PyroFetes/Models/StaffContact.cs create mode 100644 PyroFetes/Models/StaffHistoryOfApproval.cs create mode 100644 PyroFetes/Models/Supplier.cs create mode 100644 PyroFetes/Models/Truck.cs create mode 100644 PyroFetes/Models/User.cs create mode 100644 PyroFetes/Models/Warehouse.cs create mode 100644 PyroFetes/Models/WarehouseProduct.cs create mode 100644 PyroFetes/Program.cs create mode 100644 PyroFetes/PyroFetesDbContext.cs diff --git a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs new file mode 100644 index 0000000..4d5e3f0 --- /dev/null +++ b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Brand.Request; + +public class CreateBrandDto +{ + public string? Name { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs new file mode 100644 index 0000000..c111b09 --- /dev/null +++ b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.Brand.Request; + +public class UpdateBrandDto +{ + public int Id { get; set; } + public string? Name { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Brand/Response/GetBrandDto.cs b/PyroFetes/DTO/Brand/Response/GetBrandDto.cs new file mode 100644 index 0000000..e57228f --- /dev/null +++ b/PyroFetes/DTO/Brand/Response/GetBrandDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.Brand.Response; + +public class GetBrandDto +{ + public int Id { get; set; } + public string? Name { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs b/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs new file mode 100644 index 0000000..dfa6238 --- /dev/null +++ b/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Classification.Request; + +public class CreateClassificationDto +{ + public string? Label { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs b/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs new file mode 100644 index 0000000..2cc2b8d --- /dev/null +++ b/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.Classification.Request; + +public class UpdateClassificationDto +{ + public int Id { get; set; } + public string? Label { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs b/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs new file mode 100644 index 0000000..e7a1cae --- /dev/null +++ b/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.Classification.Response; + +public class GetClassificationDto +{ + public int Id { get; set; } + public string? Label { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Color/Request/CreateColorDto.cs b/PyroFetes/DTO/Color/Request/CreateColorDto.cs new file mode 100644 index 0000000..43b1851 --- /dev/null +++ b/PyroFetes/DTO/Color/Request/CreateColorDto.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Color.Request; + +public class CreateColorDto +{ + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Color/Request/UpdateColorDto.cs b/PyroFetes/DTO/Color/Request/UpdateColorDto.cs new file mode 100644 index 0000000..3838a49 --- /dev/null +++ b/PyroFetes/DTO/Color/Request/UpdateColorDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Color.Request; + +public class UpdateColorDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Color/Response/GetColorDto.cs b/PyroFetes/DTO/Color/Response/GetColorDto.cs new file mode 100644 index 0000000..d53c0fc --- /dev/null +++ b/PyroFetes/DTO/Color/Response/GetColorDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Color.Response; + +public class GetColorDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs b/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs new file mode 100644 index 0000000..cb6f630 --- /dev/null +++ b/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Effect.Request; + +public class CreateEffectDto +{ + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs b/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs new file mode 100644 index 0000000..004a0c5 --- /dev/null +++ b/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Effect.Request; + +public class UpdateEffectDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Effect/Response/GetEffectDto.cs b/PyroFetes/DTO/Effect/Response/GetEffectDto.cs new file mode 100644 index 0000000..1708fc6 --- /dev/null +++ b/PyroFetes/DTO/Effect/Response/GetEffectDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Effect.Response; + +public class GetEffectDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs b/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs new file mode 100644 index 0000000..54fecd5 --- /dev/null +++ b/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs @@ -0,0 +1,9 @@ +namespace PyroFetes.DTO.Material.Request; + +public class CreateMaterialDto +{ + public string? Label { get; set; } + public int Quantity { get; set; } + public int WarehouseId {get; set;} + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs b/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs new file mode 100644 index 0000000..e462751 --- /dev/null +++ b/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs @@ -0,0 +1,10 @@ +namespace PyroFetes.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;} + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Material/Response/GetMaterialDto.cs b/PyroFetes/DTO/Material/Response/GetMaterialDto.cs new file mode 100644 index 0000000..bad4c77 --- /dev/null +++ b/PyroFetes/DTO/Material/Response/GetMaterialDto.cs @@ -0,0 +1,10 @@ +namespace PyroFetes.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;} + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs b/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs new file mode 100644 index 0000000..043b1e0 --- /dev/null +++ b/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs @@ -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;} + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs b/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs new file mode 100644 index 0000000..f932ec9 --- /dev/null +++ b/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs @@ -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;} + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Movement/Response/GetMovementDto.cs b/PyroFetes/DTO/Movement/Response/GetMovementDto.cs new file mode 100644 index 0000000..3d8f452 --- /dev/null +++ b/PyroFetes/DTO/Movement/Response/GetMovementDto.cs @@ -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;} + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Request/CreateProductDto.cs b/PyroFetes/DTO/Product/Request/CreateProductDto.cs new file mode 100644 index 0000000..a704c38 --- /dev/null +++ b/PyroFetes/DTO/Product/Request/CreateProductDto.cs @@ -0,0 +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 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 ClassificationId { get; set;} + public int ProductCategoryId { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Request/UpdateProductDto.cs b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs new file mode 100644 index 0000000..1bc96a4 --- /dev/null +++ b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs @@ -0,0 +1,20 @@ +using PyroFetes.Models; + +namespace PyroFetes.DTO.Product.Request; + +public class UpdateProductDto +{ + public int Id { get; set; } + public int Reference { get; set; } + public string? Name { 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 ClassificationId { get; set;} + public int ProductCategoryId { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Response/GetProductDto.cs b/PyroFetes/DTO/Product/Response/GetProductDto.cs new file mode 100644 index 0000000..dbfed6a --- /dev/null +++ b/PyroFetes/DTO/Product/Response/GetProductDto.cs @@ -0,0 +1,23 @@ +using PyroFetes.Models; + +namespace PyroFetes.DTO.Product.Response; + +public class GetProductDto +{ + public int Id { get; set; } + public int Reference { get; set; } + public string? Name { 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 ClassificationId { get; set;} + public string? ClassificationLabel { get; set; } + public int ProductCategoryId { get; set; } + public string? ProductCategoryLabel { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs b/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs new file mode 100644 index 0000000..cf5ebe9 --- /dev/null +++ b/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs @@ -0,0 +1,6 @@ +namespace API.DTO.ProductCategory.Request; + +public class CreateProductCategoryDto +{ + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs b/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs new file mode 100644 index 0000000..2856e23 --- /dev/null +++ b/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs @@ -0,0 +1,7 @@ +namespace API.DTO.ProductCategory.Request; + +public class UpdateProductCategoryDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs b/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs new file mode 100644 index 0000000..ee64f0a --- /dev/null +++ b/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs @@ -0,0 +1,8 @@ +namespace API.DTO.ProductCategory.Response; + +public class GetProductCategoryDto +{ + public int Id { get; set; } + public string? Label { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs b/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs new file mode 100644 index 0000000..25a94a4 --- /dev/null +++ b/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs @@ -0,0 +1,11 @@ +namespace API.DTO.Supplier.Request; + +public class CreateSupplierDto +{ + 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; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs b/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs new file mode 100644 index 0000000..20ae5f0 --- /dev/null +++ b/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs @@ -0,0 +1,12 @@ +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 PhoneNumber { get; set; } + public string Adress { get; set; } + public int ZipCode { get; set; } + public string City { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs b/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs new file mode 100644 index 0000000..ddc2365 --- /dev/null +++ b/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs @@ -0,0 +1,12 @@ +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 PhoneNumber { get; set; } + public string Adress { get; set; } + public int ZipCode { get; set; } + public string City { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs new file mode 100644 index 0000000..9f2e7cb --- /dev/null +++ b/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs @@ -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; } +} diff --git a/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs new file mode 100644 index 0000000..a154737 --- /dev/null +++ b/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs @@ -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; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs new file mode 100644 index 0000000..77df53c --- /dev/null +++ b/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs @@ -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; } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs new file mode 100644 index 0000000..265abc6 --- /dev/null +++ b/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs @@ -0,0 +1,35 @@ +using PyroFetes.DTO.Brand.Request; +using PyroFetes.DTO.Brand.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Brand; + +public class CreateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Brand/DeleteBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/DeleteBrandEndpoint.cs new file mode 100644 index 0000000..eb4fa26 --- /dev/null +++ b/PyroFetes/Endpoints/Brand/DeleteBrandEndpoint.cs @@ -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 +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs b/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs new file mode 100644 index 0000000..c4995ae --- /dev/null +++ b/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs @@ -0,0 +1,28 @@ +using PyroFetes.DTO.Brand.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Brand; + +public class GetAllBrandsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/brands"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + + List responseDto = await pyrofetesdbcontext.Brands + .Select(a => new GetBrandDto + { + Id = a.Id, + Name = a.Name, + } + ).ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs new file mode 100644 index 0000000..86d7da9 --- /dev/null +++ b/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs @@ -0,0 +1,42 @@ +using PyroFetes.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 +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs new file mode 100644 index 0000000..652291c --- /dev/null +++ b/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs @@ -0,0 +1,34 @@ +using PyroFetes.DTO.Brand.Request; +using PyroFetes.DTO.Brand.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Brand; + +public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + 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); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs new file mode 100644 index 0000000..bc7ed9e --- /dev/null +++ b/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs @@ -0,0 +1,35 @@ +using PyroFetes.DTO.Classification.Request; +using PyroFetes.DTO.Classification.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Classification; + +public class CreateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Classification/DeleteClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/DeleteClassificationEndpoint.cs new file mode 100644 index 0000000..0982278 --- /dev/null +++ b/PyroFetes/Endpoints/Classification/DeleteClassificationEndpoint.cs @@ -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 +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs b/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs new file mode 100644 index 0000000..7513e7e --- /dev/null +++ b/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs @@ -0,0 +1,28 @@ +using PyroFetes.DTO.Classification.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Classification; + +public class GetAllClassificationsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/classifications"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + + List responseDto = await pyrofetesdbcontext.Classifications + .Select(a => new GetClassificationDto + { + Id = a.Id, + Label = a.Label, + } + ).ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs new file mode 100644 index 0000000..a972863 --- /dev/null +++ b/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs @@ -0,0 +1,42 @@ +using PyroFetes.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 +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs new file mode 100644 index 0000000..cee10d3 --- /dev/null +++ b/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs @@ -0,0 +1,34 @@ +using PyroFetes.DTO.Classification.Request; +using PyroFetes.DTO.Classification.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Classification; + +public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + 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); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs b/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs new file mode 100644 index 0000000..e926e52 --- /dev/null +++ b/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs @@ -0,0 +1,35 @@ +using PyroFetes.DTO.Color.Request; +using PyroFetes.DTO.Color.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Color; + +public class CreateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/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); + } + +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Color/DeleteColorEndpoint.cs b/PyroFetes/Endpoints/Color/DeleteColorEndpoint.cs new file mode 100644 index 0000000..7fa6e50 --- /dev/null +++ b/PyroFetes/Endpoints/Color/DeleteColorEndpoint.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Color; + +public class DeleteColorRequest +{ + public int Id { get; set; } +} + +public class DeleteColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Delete("/api/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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Color/GetAllColorsEndpoint.cs b/PyroFetes/Endpoints/Color/GetAllColorsEndpoint.cs new file mode 100644 index 0000000..c5c4bee --- /dev/null +++ b/PyroFetes/Endpoints/Color/GetAllColorsEndpoint.cs @@ -0,0 +1,26 @@ +using PyroFetes.DTO.Color.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Color; + +public class GetAllColorsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/colors"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await appDbContext.Colors + .Select(a => new GetColorDto + { + Id = a.Id, + Label = a.Label, + } + ).ToListAsync(ct); + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Color/GetColorEndpoint.cs b/PyroFetes/Endpoints/Color/GetColorEndpoint.cs new file mode 100644 index 0000000..ad29958 --- /dev/null +++ b/PyroFetes/Endpoints/Color/GetColorEndpoint.cs @@ -0,0 +1,42 @@ +using PyroFetes.DTO.Color.Response; +using FastEndpoints; +using Microsoft.AspNetCore.Authentication; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Color; + +public class GetColorRequest +{ + public int Id { get; set; } +} + +public class GetColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Get("/api/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); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs b/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs new file mode 100644 index 0000000..43c9ee9 --- /dev/null +++ b/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs @@ -0,0 +1,42 @@ +using PyroFetes.DTO.Color.Request; +using PyroFetes.DTO.Color.Response; +using FastEndpoints; +using Microsoft.AspNetCore.Server.Kestrel; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Color; + +public class UpdateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Put("/api/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); + + } + +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs new file mode 100644 index 0000000..1e6aafa --- /dev/null +++ b/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs @@ -0,0 +1,34 @@ +using PyroFetes.DTO.Effect.Request; +using PyroFetes.DTO.Effect.Response; + +using FastEndpoints; +namespace PyroFetes.Endpoints.Effect; + +public class CreateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Effect/DeleteEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/DeleteEffectEndpoint.cs new file mode 100644 index 0000000..fddb5fa --- /dev/null +++ b/PyroFetes/Endpoints/Effect/DeleteEffectEndpoint.cs @@ -0,0 +1,36 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Effect; + +public class DeleteEffectRequest +{ + public int Id { get; set; } +} +public class DeleteEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Delete("/api/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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint.cs b/PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint.cs new file mode 100644 index 0000000..8896fa1 --- /dev/null +++ b/PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint.cs @@ -0,0 +1,27 @@ +using PyroFetes.DTO.Effect.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Effect; + +public class GetAllEffectsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/effects"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await appDbContext.Effects + .Select(a => new GetEffectDto + { + Id = a.Id, + Label = a.Label, + } + ).ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs new file mode 100644 index 0000000..2465755 --- /dev/null +++ b/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs @@ -0,0 +1,42 @@ +using PyroFetes.DTO.Effect.Response; +using FastEndpoints; +using Microsoft.AspNetCore.Authentication; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Effect; + +public class GetEffectRequest +{ + public int Id { get; set; } +} + +public class GetEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Get("/api/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); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs new file mode 100644 index 0000000..1ff9417 --- /dev/null +++ b/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs @@ -0,0 +1,42 @@ +using PyroFetes.DTO.Effect.Request; +using PyroFetes.DTO.Effect.Response; +using FastEndpoints; +using Microsoft.AspNetCore.Server.Kestrel; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Effect; + +public class UpdateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Put("/api/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); + + } + +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs new file mode 100644 index 0000000..cdb8ab2 --- /dev/null +++ b/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs @@ -0,0 +1,36 @@ +using PyroFetes.DTO.Material.Request; +using PyroFetes.DTO.Material.Response; +using FastEndpoints; +namespace PyroFetes.Endpoints.Material; + +public class CreateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/material/create"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CreateMaterialDto req, CancellationToken ct) + { + Models.Material material = new() + { + Label = req.Label, + Quantity = req.Quantity, + WarehouseId = req.WarehouseId, + }; + + appDbContext.Materials.Add(material); + await appDbContext.SaveChangesAsync(ct); + Console.WriteLine("Material added"); + + GetMaterialDto responseDto = new() + { + Id = material.Id, + WarehouseId = material.WarehouseId, + Label = req.Label, + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs new file mode 100644 index 0000000..6912a26 --- /dev/null +++ b/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs @@ -0,0 +1,35 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Material; +public class DeleteMaterialRequest +{ + public int Id { get; set; } +} +public class DeleteMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Delete("/api/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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs b/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs new file mode 100644 index 0000000..a809711 --- /dev/null +++ b/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs @@ -0,0 +1,28 @@ +using PyroFetes.DTO.Material.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Material; + +public class GetAllMaterialsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/material"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await appDbContext.Materials + .Select(a => new GetMaterialDto + { + Id = a.Id, + Label = a.Label, + Quantity = a.Quantity, + WarehouseId = a.WarehouseId, + } + ).ToListAsync(ct); + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs new file mode 100644 index 0000000..7860ab8 --- /dev/null +++ b/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs @@ -0,0 +1,43 @@ +using PyroFetes.DTO.Material.Response; +using FastEndpoints; +using Microsoft.AspNetCore.Authentication; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Material; + +public class GetMaterialRequest +{ + public int Id { get; set; } +} + +public class GetMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Get("/api/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, + Label = material.Label, + WarehouseId = material.WarehouseId, + }; + await Send.OkAsync(responseDto, ct); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Material/UpdateMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/UpdateMaterialEndpoint.cs new file mode 100644 index 0000000..c22a5b5 --- /dev/null +++ b/PyroFetes/Endpoints/Material/UpdateMaterialEndpoint.cs @@ -0,0 +1,43 @@ +using PyroFetes.DTO.Material.Request; +using PyroFetes.DTO.Material.Response; +using FastEndpoints; +using Microsoft.AspNetCore.Server.Kestrel; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Material; + +public class UpdateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +{ + public override void Configure() + { + Put("/api/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.Label = req.Label; + materialToEdit.WarehouseId = req.WarehouseId; + await appDbContext.SaveChangesAsync(ct); + + GetMaterialDto responseDto = new() + { + Id = req.Id, + Label = req.Label, + WarehouseId = req.WarehouseId, + }; + await Send.OkAsync(responseDto, ct); + } + +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Movement/CreateMovementEndpoint.cs b/PyroFetes/Endpoints/Movement/CreateMovementEndpoint.cs new file mode 100644 index 0000000..d8e838f --- /dev/null +++ b/PyroFetes/Endpoints/Movement/CreateMovementEndpoint.cs @@ -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 +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Movement/DeleteMovementEndpoint.cs b/PyroFetes/Endpoints/Movement/DeleteMovementEndpoint.cs new file mode 100644 index 0000000..c49bd04 --- /dev/null +++ b/PyroFetes/Endpoints/Movement/DeleteMovementEndpoint.cs @@ -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 +{ + 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Movement/GetAllMovementsEndpoint.cs b/PyroFetes/Endpoints/Movement/GetAllMovementsEndpoint.cs new file mode 100644 index 0000000..da0d977 --- /dev/null +++ b/PyroFetes/Endpoints/Movement/GetAllMovementsEndpoint.cs @@ -0,0 +1,31 @@ +using API.DTO.Movement.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Movement; + +public class GetAllMovementsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/movements"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + + List 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); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Movement/GetMovementEndpoint.cs b/PyroFetes/Endpoints/Movement/GetMovementEndpoint.cs new file mode 100644 index 0000000..33e60ec --- /dev/null +++ b/PyroFetes/Endpoints/Movement/GetMovementEndpoint.cs @@ -0,0 +1,45 @@ +using API.DTO.Movement.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Movement; + +public class GetMovementRequest +{ + public int Id { get; set; } +} + +public class GetMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +{ + public override void Configure() + { + Get("/api/movements/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetMovementRequest req, CancellationToken ct) + { + + Models.Movement? movement = await pyrofetesdbcontext + .Movements + .SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct); + + if (movement == null) + { + Console.WriteLine($"Aucun mouvement avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + GetMovementDto responseDto = new() + { + Id = req.Id, + Date = movement.Date, + Start = movement.Start, + Arrival = movement.Arrival, + Quantity = movement.Quantity + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs b/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs new file mode 100644 index 0000000..151ffc9 --- /dev/null +++ b/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs @@ -0,0 +1,40 @@ +using API.DTO.Movement.Request; +using API.DTO.Movement.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Movement; + +public class UpdateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Post("/api/movements"); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateMovementDto req, CancellationToken ct) + { + + Models.Movement movement = new() + { + Date = req.Date, + Start = req.Start, + Arrival = req.Arrival, + Quantity = req.Quantity + }; + pyrofetesdbcontext.Add(movement); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + GetMovementDto response = new() + { + Id = req.Id, + Date = req.Date, + Start = req.Start, + Arrival = req.Arrival, + Quantity = req.Quantity + }; + + await Send.OkAsync(response, ct); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs b/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs new file mode 100644 index 0000000..5a30b83 --- /dev/null +++ b/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs @@ -0,0 +1,57 @@ +using FastEndpoints; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; + +namespace PyroFetes.Endpoints.Product; + +public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Post("/api/products"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CreateProductDto req, CancellationToken ct) + { + Models.Product product = new () + { + References = req.References, + Name = req.Name!, + Duration = req.Duration, + Caliber = req.Caliber, + ApprovalNumber = req.ApprovalNumber, + Weight = req.Weight, + Nec = req.Nec, + SellingPrice = req.SellingPrice, + Image = req.Image!, + Link = req.Link!, + ProductCategoryId = req.ProductCategoryId, + ClassificationId = req.ClassificationId + }; + + pyrofetesdbcontext.Products.Add(product); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + Console.WriteLine("Product créé avec succès !"); + + GetProductDto responseDto = new () + { + Id = product.Id, + Reference = req.References, + Name = req.Name, + Duration = req.Duration, + Caliber = req.Caliber, + ApprovalNumber = req.ApprovalNumber, + Weight = req.Weight, + Nec = req.Nec, + SellingPrice = req.SellingPrice, + Image = req.Image, + Link = req.Link, + ProductCategoryId = req.ProductCategoryId, + ClassificationId = req.ClassificationId + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs b/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs new file mode 100644 index 0000000..cf425ea --- /dev/null +++ b/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Product; + +public class DeleteProductRequest +{ + public int Id { get; set; } +} + +public class DeleteProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Delete("/api/products/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(DeleteProductRequest req, CancellationToken ct) + { + Models.Product? productToDelete = await pyrofetesdbcontext + .Products + .SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct); + + if (productToDelete == null) + { + Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + pyrofetesdbcontext.Products.Remove(productToDelete); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs b/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs new file mode 100644 index 0000000..ee81ef9 --- /dev/null +++ b/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs @@ -0,0 +1,40 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Response; + +namespace PyroFetes.Endpoints.Product; + +public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/products"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await pyrofetesdbcontext.Products + .Select(p => new GetProductDto() + { + Id = p.Id, + Reference = p.References, + Name = p.Name, + Duration = p.Duration, + Caliber = p.Caliber, + ApprovalNumber = p.ApprovalNumber, + Weight = p.Weight, + Nec = p.Nec, + SellingPrice = p.SellingPrice, + Image = p.Image, + Link = p.Link, + ClassificationId = p.ClassificationId, + ClassificationLabel = p.Classification!.Label, + ProductCategoryId = p.ProductCategoryId, + ProductCategoryLabel = p.ProductCategory!.Label, + } + ).ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} diff --git a/PyroFetes/Endpoints/Product/GetProductEndpoint.cs b/PyroFetes/Endpoints/Product/GetProductEndpoint.cs new file mode 100644 index 0000000..df4b64f --- /dev/null +++ b/PyroFetes/Endpoints/Product/GetProductEndpoint.cs @@ -0,0 +1,55 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Response; + +namespace PyroFetes.Endpoints.Product; + +public class GetProductRequest +{ + public int Id { get; set; } +} + + +public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +{ + public override void Configure() + { + Get("/api/product/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetProductRequest req, CancellationToken ct) + { + Models.Product? product = await pyrofetesdbcontext + .Products.Include(product => product.Classification).Include(product => product.ProductCategory) + .SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct); + + if (product == null) + { + Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + GetProductDto responseDto = new() + { + Id = product.Id, + Reference = product.References, + Name = product.Name, + Duration = product.Duration, + Caliber = product.Caliber, + ApprovalNumber = product.ApprovalNumber, + Weight = product.Weight, + Nec = product.Nec, + SellingPrice = product.SellingPrice, + Image = product.Image, + Link = product.Link, + ClassificationId = product.ClassificationId, + ClassificationLabel = product.Classification!.Label, + ProductCategoryId = product.ProductCategoryId, + ProductCategoryLabel = product.ProductCategory!.Label, + }; + + await Send.OkAsync(responseDto, ct); + } +} diff --git a/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs b/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs new file mode 100644 index 0000000..2512e9c --- /dev/null +++ b/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs @@ -0,0 +1,58 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; + +namespace PyroFetes.Endpoints.Product; + +public class UpdateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +{ + public override void Configure() + { + Put("/api/products/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct) + { + Models.Product? productToEdit = await pyrofetesdbcontext + .Products + .SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct); + + if (productToEdit == null) + { + Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + productToEdit.References = req.Reference; + productToEdit.Name = req.Name; + productToEdit.Duration = req.Duration; + productToEdit.Caliber = req.Caliber; + productToEdit.ApprovalNumber = req.ApprovalNumber; + productToEdit.Weight = req.Weight; + productToEdit.Nec = req.Nec; + productToEdit.SellingPrice = req.SellingPrice; + productToEdit.Image = req.Image; + productToEdit.Link = req.Link; + await pyrofetesdbcontext.SaveChangesAsync(ct); + + GetProductDto responseDto = new() + { + Id = req.Id, + Reference = req.Reference, + Name = req.Name, + Duration = req.Duration, + Caliber = req.Caliber, + ApprovalNumber = req.ApprovalNumber, + Weight = req.Weight, + Nec = req.Nec, + SellingPrice = req.SellingPrice, + Image = req.Image, + Link = req.Link + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ProductCategory/CreateProductCategoryEndpoint.cs b/PyroFetes/Endpoints/ProductCategory/CreateProductCategoryEndpoint.cs new file mode 100644 index 0000000..b1009f9 --- /dev/null +++ b/PyroFetes/Endpoints/ProductCategory/CreateProductCategoryEndpoint.cs @@ -0,0 +1,37 @@ +using API.DTO.ProductCategory.Request; +using API.DTO.ProductCategory.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.ProductCategory; + +public class CreateProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Post("/api/productcategories"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CreateProductCategoryDto req, CancellationToken ct) + { + Models.ProductCategory productCategory = new () + { + Label = req.Label, + + }; + + pyrofetesdbcontext.ProductCategories.Add(productCategory); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + Console.WriteLine("Category créé avec succès !"); + + GetProductCategoryDto responseDto = new () + { + Id = productCategory.Id, + Label = productCategory.Label + + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ProductCategory/DeleteProductCategoryEndpoint.cs b/PyroFetes/Endpoints/ProductCategory/DeleteProductCategoryEndpoint.cs new file mode 100644 index 0000000..9b00562 --- /dev/null +++ b/PyroFetes/Endpoints/ProductCategory/DeleteProductCategoryEndpoint.cs @@ -0,0 +1,36 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.ProductCategory; + +public class DeleteProductCategoryRequest +{ + public int Id { get; set; } +} + +public class DeleteProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Delete("/api/productcategories/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(DeleteProductCategoryRequest req, CancellationToken ct) + { + Models.ProductCategory? productCategoryToDelete = await pyrofetesdbcontext + .ProductCategories + .SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct); + + if (productCategoryToDelete == null) + { + await Send.NotFoundAsync(ct); + return; + } + + pyrofetesdbcontext.ProductCategories.Remove(productCategoryToDelete); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ProductCategory/GetAllProductCategoriesEndpoint.cs b/PyroFetes/Endpoints/ProductCategory/GetAllProductCategoriesEndpoint.cs new file mode 100644 index 0000000..d0039c6 --- /dev/null +++ b/PyroFetes/Endpoints/ProductCategory/GetAllProductCategoriesEndpoint.cs @@ -0,0 +1,27 @@ +using API.DTO.ProductCategory.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.ProductCategory; + +public class GetAllProductCategoriesEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/productcategories"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await pyrofetesdbcontext.ProductCategories + .Select(pc => new GetProductCategoryDto() + { + Id = pc.Id, + Label = pc.Label + } + ).ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} diff --git a/PyroFetes/Endpoints/ProductCategory/GetProductCategoryEndpoint.cs b/PyroFetes/Endpoints/ProductCategory/GetProductCategoryEndpoint.cs new file mode 100644 index 0000000..f2d823b --- /dev/null +++ b/PyroFetes/Endpoints/ProductCategory/GetProductCategoryEndpoint.cs @@ -0,0 +1,42 @@ +using API.DTO.ProductCategory.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.ProductCategory; + +public class GetProductCategoryRequest +{ + public int Id { get; set; } +} + + +public class GetProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +{ + public override void Configure() + { + Get("/api/productcategory/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetProductCategoryRequest req, CancellationToken ct) + { + Models.ProductCategory? productCategory = await pyrofetesdbcontext + .ProductCategories + .SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct); + + if (productCategory == null) + { + await Send.NotFoundAsync(ct); + return; + } + + GetProductCategoryDto responseDto = new() + { + Id = productCategory.Id, + Label = productCategory.Label + + }; + + await Send.OkAsync(responseDto, ct); + } +} diff --git a/PyroFetes/Endpoints/ProductCategory/UpdateProductCategoryEndpoint.cs b/PyroFetes/Endpoints/ProductCategory/UpdateProductCategoryEndpoint.cs new file mode 100644 index 0000000..e5d7e21 --- /dev/null +++ b/PyroFetes/Endpoints/ProductCategory/UpdateProductCategoryEndpoint.cs @@ -0,0 +1,39 @@ +using API.DTO.ProductCategory.Request; +using API.DTO.ProductCategory.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.ProductCategory; + +public class UpdateProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +{ + public override void Configure() + { + Put("/api/productcategory/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateProductCategoryDto req, CancellationToken ct) + { + Models.ProductCategory? productCategoryToEdit = await pyrofetesdbcontext + .ProductCategories + .SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct); + + if (productCategoryToEdit == null) + { + await Send.NotFoundAsync(ct); + return; + } + + productCategoryToEdit.Label = req.Label; + await pyrofetesdbcontext.SaveChangesAsync(ct); + + GetProductCategoryDto responseDto = new() + { + Id = req.Id, + Label = req.Label, + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs new file mode 100644 index 0000000..761eb4a --- /dev/null +++ b/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs @@ -0,0 +1,48 @@ +using API.DTO.Supplier.Request; +using API.DTO.Supplier.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Supplier; + +public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Post("/api/suppliers"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct) + { + // Création d'un nouvel objet Supplier + Models.Supplier supplier = new() + { + Name = req.Name, + Email = req.Email, + Phone = req.PhoneNumber, + Address = req.Adress, + ZipCode = req.ZipCode, + City = req.City + }; + + // Ajout à la base et sauvegarde + pyrofetesdbcontext.Suppliers.Add(supplier); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + Console.WriteLine("Fournisseur créé avec succès !"); + + // Préparation de la réponse + GetSupplierDto responseDto = new() + { + Id = supplier.Id, + Name = supplier.Name, + Email = supplier.Email, + PhoneNumber = supplier.Phone, + Adress = supplier.Address, + ZipCode = supplier.ZipCode, + City = supplier.City + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs new file mode 100644 index 0000000..dbeb8db --- /dev/null +++ b/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Supplier; + +public class DeleteSupplierRequest +{ + public int Id { get; set; } +} + +public class DeleteSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Delete("/api/suppliers/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct) + { + Models.Supplier? supplierToDelete = await pyrofetesdbcontext + .Suppliers + .SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct); + + if (supplierToDelete == null) + { + Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + pyrofetesdbcontext.Suppliers.Remove(supplierToDelete); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs new file mode 100644 index 0000000..51df593 --- /dev/null +++ b/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs @@ -0,0 +1,32 @@ +using API.DTO.Supplier.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Supplier; + +public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/suppliers"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await pyrofetesdbcontext.Suppliers + .Select(s => new GetSupplierDto + { + Id = s.Id, + Name = s.Name!, + Email = s.Email!, + PhoneNumber = s.Phone!, + Adress = s.Address!, + ZipCode = s.ZipCode, + City = s.City! + }) + .ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs new file mode 100644 index 0000000..878e8ba --- /dev/null +++ b/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs @@ -0,0 +1,46 @@ +using API.DTO.Supplier.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Supplier; + +public class GetSupplierRequest +{ + public int Id { get; set; } +} + +public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Get("/api/suppliers/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct) + { + Models.Supplier? supplier = await pyrofetesdbcontext + .Suppliers + .SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct); + + if (supplier == null) + { + Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + GetSupplierDto responseDto = new() + { + Id = supplier.Id, + Name = supplier.Name!, + Email = supplier.Email!, + PhoneNumber = supplier.Phone!, + Adress = supplier.Address!, + ZipCode = supplier.ZipCode, + City = supplier.City! + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs new file mode 100644 index 0000000..e835fce --- /dev/null +++ b/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs @@ -0,0 +1,52 @@ +using API.DTO.Supplier.Request; +using API.DTO.Supplier.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Supplier; + +public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Put("/api/suppliers/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct) + { + Models.Supplier? supplierToEdit = await pyrofetesdbcontext + .Suppliers + .SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct); + + if (supplierToEdit == null) + { + Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + // Mise à jour des propriétés + supplierToEdit.Name = req.Name; + supplierToEdit.Email = req.Email; + supplierToEdit.Phone = req.PhoneNumber; + supplierToEdit.Address = req.Adress; + supplierToEdit.ZipCode = req.ZipCode; + supplierToEdit.City = req.City; + + await pyrofetesdbcontext.SaveChangesAsync(ct); + + GetSupplierDto responseDto = new() + { + Id = supplierToEdit.Id, + Name = supplierToEdit.Name, + Email = supplierToEdit.Email, + PhoneNumber = supplierToEdit.Phone, + Adress = supplierToEdit.Address, + ZipCode = supplierToEdit.ZipCode, + City = supplierToEdit.City + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs new file mode 100644 index 0000000..2c46f85 --- /dev/null +++ b/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs @@ -0,0 +1,47 @@ +using API.DTO.Warehouse.Request; +using API.DTO.Warehouse.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.Warehouse; + +public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Post("/api/warehouse"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CreateWarehouseDto req, CancellationToken ct) + { + Models.Warehouse warehouse = new() + { + Name = req.Name, + MaxWeight = req.MaxWeight, + Current = req.Current, + MinWeight = req.MinWeight, + Address = req.Adress, + ZipCode = req.ZipCode, + City = req.City + }; + + pyrofetesdbcontext.Warehouses.Add(warehouse); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + Console.WriteLine("Entrepôt créé avec succès !"); + + GetWarehouseDto responseDto = new() + { + Id = warehouse.Id, + Name = warehouse.Name, + MaxWeight = warehouse.MaxWeight, + Current = warehouse.Current, + MinWeight = warehouse.MinWeight, + Adress = warehouse.Address, + ZipCode = warehouse.ZipCode, + City = warehouse.City + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs new file mode 100644 index 0000000..758096b --- /dev/null +++ b/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Warehouse; + +public class DeleteWarehouseRequest +{ + public int Id { get; set; } +} + +public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Delete("/api/warehouse/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(DeleteWarehouseRequest req, CancellationToken ct) + { + Models.Warehouse? warehouseToDelete = await pyrofetesdbcontext + .Warehouses + .SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct); + + if (warehouseToDelete == null) + { + Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + pyrofetesdbcontext.Warehouses.Remove(warehouseToDelete); + await pyrofetesdbcontext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs new file mode 100644 index 0000000..0d98e6f --- /dev/null +++ b/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs @@ -0,0 +1,33 @@ +using API.DTO.Warehouse.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Warehouse; + +public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/api/warehouses"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await pyrofetesdbcontext.Warehouses + .Select(w => new GetWarehouseDto + { + Id = w.Id, + Name = w.Name, + MaxWeight = w.MaxWeight, + Current = w.Current, + MinWeight = w.MinWeight, + Adress = w.Address, + ZipCode = w.ZipCode, + City = w.City + }) + .ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs new file mode 100644 index 0000000..b24e007 --- /dev/null +++ b/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs @@ -0,0 +1,47 @@ +using API.DTO.Warehouse.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Warehouse; + +public class GetWarehouseRequest +{ + public int Id { get; set; } +} + +public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Get("/api/warehouses/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetWarehouseRequest req, CancellationToken ct) + { + Models.Warehouse? warehouse = await pyrofetesdbcontext + .Warehouses + .SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct); + + if (warehouse == null) + { + Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + GetWarehouseDto responseDto = new() + { + Id = warehouse.Id, + Name = warehouse.Name!, + MaxWeight = warehouse.MaxWeight, + Current = warehouse.Current, + MinWeight = warehouse.MinWeight, + Adress = warehouse.Address!, + ZipCode = warehouse.ZipCode, + City = warehouse.City! + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs new file mode 100644 index 0000000..0864bd6 --- /dev/null +++ b/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs @@ -0,0 +1,54 @@ +using API.DTO.Warehouse.Request; +using API.DTO.Warehouse.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Endpoints.Warehouse; + +public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +{ + public override void Configure() + { + Put("/api/warehouses/{@id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateWarehouseDto req, CancellationToken ct) + { + Models.Warehouse? warehouseToEdit = await pyrofetesdbcontext + .Warehouses + .SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct); + + if (warehouseToEdit == null) + { + Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé."); + await Send.NotFoundAsync(ct); + return; + } + + // Mise à jour des champs + warehouseToEdit.Name = req.Name; + warehouseToEdit.MaxWeight = req.MaxWeight; + warehouseToEdit.Current = req.Current; + warehouseToEdit.MinWeight = req.MinWeight; + warehouseToEdit.Address = req.Adress; + warehouseToEdit.ZipCode = req.ZipCode; + warehouseToEdit.City = req.City; + + await pyrofetesdbcontext.SaveChangesAsync(ct); + + GetWarehouseDto responseDto = new() + { + Id = warehouseToEdit.Id, + Name = warehouseToEdit.Name, + MaxWeight = warehouseToEdit.MaxWeight, + Current = warehouseToEdit.Current, + MinWeight = warehouseToEdit.MinWeight, + Adress = warehouseToEdit.Address, + ZipCode = warehouseToEdit.ZipCode, + City = warehouseToEdit.City + }; + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs b/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs new file mode 100644 index 0000000..1f414fb --- /dev/null +++ b/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs @@ -0,0 +1,1948 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PyroFetes; + +#nullable disable + +namespace PyroFetes.Migrations +{ + [DbContext(typeof(PyroFetesDbContext))] + partial class PyroFetesDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AvailabilityDate") + .HasColumnType("date"); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.Property("RenewallDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("Availabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("Brands"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Classifications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Colors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Calling") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Meeting") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("Communications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Role") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("ContactServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.Property("TermsAndConditions") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ShowId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("Contract"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CustomerTypeId") + .HasColumnType("int"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerTypeId"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("CustomerTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Transporter") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Deliverers"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DelivererId") + .HasColumnType("int"); + + b.Property("EstimateDeliveryDate") + .HasColumnType("date"); + + b.Property("ExpeditionDate") + .HasColumnType("date"); + + b.Property("RealDeliveryDate") + .HasColumnType("date"); + + b.Property("TrackingNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("DelivererId"); + + b.ToTable("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Effects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("ExperienceLevels"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("HistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("WarehouseId"); + + b.ToTable("Materials"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.Property("MaterialId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("MaterialId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("MaterialWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Arrival") + .HasColumnType("datetime2"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DestinationWarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SourceWarehouseId") + .HasColumnType("int"); + + b.Property("Start") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("DestinationWarehouseId"); + + b.HasIndex("SourceWarehouseId"); + + b.ToTable("Movements"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("SupplierId") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "SupplierId"); + + b.HasIndex("SupplierId"); + + b.ToTable("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApprovalNumber") + .HasColumnType("int"); + + b.Property("Caliber") + .HasColumnType("decimal(18,2)"); + + b.Property("ClassificationId") + .HasColumnType("int"); + + b.Property("Duration") + .HasColumnType("decimal(18,2)"); + + b.Property("Image") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Link") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("MinimalQuantity") + .HasColumnType("int"); + + b.Property("MovementId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Nec") + .HasColumnType("decimal(18,2)"); + + b.Property("ProductCategoryId") + .HasColumnType("int"); + + b.Property("References") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("Weight") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("ClassificationId"); + + b.HasIndex("MovementId"); + + b.HasIndex("ProductCategoryId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProductCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ColorId") + .HasColumnType("int"); + + b.HasKey("ProductId", "ColorId"); + + b.HasIndex("ColorId"); + + b.ToTable("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("DeliveryNoteId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "DeliveryNoteId"); + + b.HasIndex("DeliveryNoteId"); + + b.ToTable("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("EffectId") + .HasColumnType("int"); + + b.HasKey("ProductId", "EffectId"); + + b.HasIndex("EffectId"); + + b.ToTable("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ProductTimecode"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ProviderId"); + + b.HasIndex("ProviderId"); + + b.ToTable("ProviderContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProviderTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PurchaseConditions") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.ToTable("PurchaseOrders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("PurchaseOrderId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "PurchaseOrderId"); + + b.HasIndex("PurchaseOrderId"); + + b.ToTable("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConditionsSale") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("QuotationId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "QuotationId"); + + b.HasIndex("QuotationId"); + + b.ToTable("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.ToTable("Providers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ElectronicSignature") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CityId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Place") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("PyrotechnicImplementationPlan") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("MaterialId") + .HasColumnType("int"); + + b.HasKey("ShowId", "MaterialId"); + + b.HasIndex("MaterialId"); + + b.ToTable("ShowMaterial"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.Property("StaffId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.HasKey("StaffId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ShowStaff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("TruckId") + .HasColumnType("int"); + + b.HasKey("ShowId", "TruckId"); + + b.HasIndex("TruckId"); + + b.ToTable("ShowTruck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Artist") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Duration") + .IsRequired() + .HasColumnType("int"); + + b.Property("Format") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("SoundCategoryId") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("Id"); + + b.HasIndex("SoundCategoryId"); + + b.ToTable("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("SoundCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("SoundId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ShowId", "SoundId"); + + b.HasIndex("SoundId"); + + b.ToTable("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("F4T2ExpirationDate") + .HasColumnType("date"); + + b.Property("F4T2NumberApproval") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Profession") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Staffs"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.Property("AvailabilityId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("AvailabilityId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("ContactId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.Property("HistoryOfApprovalId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("HistoryOfApprovalId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DeliveryDelay") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Suppliers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("MaxExplosiveCapacity") + .IsRequired() + .HasColumnType("float"); + + b.Property("Sizes") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("nvarchar(80)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.HasKey("Id"); + + b.ToTable("Trucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Fonction") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Salt") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Current") + .HasColumnType("int"); + + b.Property("MaxWeight") + .HasColumnType("int"); + + b.Property("MinWeight") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Warehouses"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Brands") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("Communications") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("ContactServiceProviders") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("ContactServiceProviders") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("Contracts") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("Contracts") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServiceProvider"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.HasOne("PyroFetes.Models.CustomerType", "CustomerType") + .WithMany("Customers") + .HasForeignKey("CustomerTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerType"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.HasOne("PyroFetes.Models.Deliverer", "Deliverer") + .WithMany("DeliveryNotes") + .HasForeignKey("DelivererId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Deliverer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ExperienceLevels") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany() + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("MaterialWarehouses") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("MaterialWarehouses") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "DestinationWarehouse") + .WithMany("MovementsDestination") + .HasForeignKey("DestinationWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("PyroFetes.Models.Warehouse", "SourceWarehouse") + .WithMany("MovementsSource") + .HasForeignKey("SourceWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("DestinationWarehouse"); + + b.Navigation("SourceWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Prices") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Supplier", "Supplier") + .WithMany("Prices") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.HasOne("PyroFetes.Models.Classification", "Classification") + .WithMany("Products") + .HasForeignKey("ClassificationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Movement", "Movement") + .WithMany("Products") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ProductCategory", "ProductCategory") + .WithMany("Products") + .HasForeignKey("ProductCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Classification"); + + b.Navigation("Movement"); + + b.Navigation("ProductCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.HasOne("PyroFetes.Models.Color", "Color") + .WithMany("ProductColors") + .HasForeignKey("ColorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductColors") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Color"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.HasOne("PyroFetes.Models.DeliveryNote", "DeliveryNote") + .WithMany("ProductDeliveries") + .HasForeignKey("DeliveryNoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductDeliveries") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeliveryNote"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.HasOne("PyroFetes.Models.Effect", "Effect") + .WithMany("ProductEffects") + .HasForeignKey("EffectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductEffects") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Effect"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductTimecodes") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ProductTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "Provider") + .WithMany() + .HasForeignKey("ProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("PurchaseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.PurchaseOrder", "PurchaseOrder") + .WithMany("PurchaseProducts") + .HasForeignKey("PurchaseOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("PurchaseOrder"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Quotations") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("QuotationProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Quotation", "Quotation") + .WithMany("QuotationProducts") + .HasForeignKey("QuotationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Quotation"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") + .WithMany("ServiceProviders") + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.HasOne("PyroFetes.Models.City", "City") + .WithMany("Shows") + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("ShowMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowMaterials") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowStaffs") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ShowStaffs") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowTrucks") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Truck", "Truck") + .WithMany("ShowTrucks") + .HasForeignKey("TruckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Truck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.HasOne("PyroFetes.Models.SoundCategory", "SoundCategory") + .WithMany("Sounds") + .HasForeignKey("SoundCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SoundCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("SoundTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Sound", "Sound") + .WithMany("SoundTimecodes") + .HasForeignKey("SoundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Sound"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.HasOne("PyroFetes.Models.Availability", "Availability") + .WithMany("StaffAvailabilities") + .HasForeignKey("AvailabilityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffAvailabilities") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Availability"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("StaffContacts") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffContacts") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.HasOne("PyroFetes.Models.HistoryOfApproval", "HistoryOfApproval") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("HistoryOfApprovalId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("HistoryOfApproval"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("WarehouseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("WarehouseProducts") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Navigation("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Navigation("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Navigation("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Navigation("Communications"); + + b.Navigation("ContactServiceProviders"); + + b.Navigation("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Navigation("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Navigation("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Navigation("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("ShowMaterials"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Navigation("Brands"); + + b.Navigation("Prices"); + + b.Navigation("ProductColors"); + + b.Navigation("ProductDeliveries"); + + b.Navigation("ProductEffects"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("PurchaseProducts"); + + b.Navigation("QuotationProducts"); + + b.Navigation("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Navigation("ServiceProviders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Navigation("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Navigation("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Navigation("ContactServiceProviders"); + + b.Navigation("Contracts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Navigation("Contracts"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("ShowMaterials"); + + b.Navigation("ShowStaffs"); + + b.Navigation("ShowTrucks"); + + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Navigation("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Navigation("ExperienceLevels"); + + b.Navigation("ShowStaffs"); + + b.Navigation("StaffAvailabilities"); + + b.Navigation("StaffContacts"); + + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Navigation("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Navigation("ShowTrucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("MovementsDestination"); + + b.Navigation("MovementsSource"); + + b.Navigation("WarehouseProducts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PyroFetes/Models/Availability.cs b/PyroFetes/Models/Availability.cs new file mode 100644 index 0000000..fdb5f68 --- /dev/null +++ b/PyroFetes/Models/Availability.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Availability +{ + //Champs + [Key] public int Id { get; set; } + [Required] public DateOnly AvailabilityDate { get; set; } + [Required] public DateOnly DeliveryDate { get; set; } + [Required] public DateOnly ExpirationDate { get; set; } + [Required] public DateOnly RenewallDate { get; set; } + + //Relations + public List? StaffAvailabilities { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Brand.cs b/PyroFetes/Models/Brand.cs new file mode 100644 index 0000000..f1b486f --- /dev/null +++ b/PyroFetes/Models/Brand.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Brand +{ + //Champs + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required] public int ProductId { get; set; } + + //Relations + [Required] public Product? Product { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/City.cs b/PyroFetes/Models/City.cs new file mode 100644 index 0000000..60cd49a --- /dev/null +++ b/PyroFetes/Models/City.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class City +{ + //Champs + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required] public int ZipCode { get; set; } + + //Relations + public List? Shows { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs new file mode 100644 index 0000000..1ac77db --- /dev/null +++ b/PyroFetes/Models/Classification.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Classification +{ + //Champs + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + //Relations + public List? Products { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Color.cs b/PyroFetes/Models/Color.cs new file mode 100644 index 0000000..95cce3d --- /dev/null +++ b/PyroFetes/Models/Color.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Color +{ + //Champs + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + //Relations + public List? ProductColors { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Communication.cs b/PyroFetes/Models/Communication.cs new file mode 100644 index 0000000..1265822 --- /dev/null +++ b/PyroFetes/Models/Communication.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Communication +{ + //Champs + [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; } + + //Relations + [Required] public int ContactId { get; set; } + public Contact? Contact { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Contact.cs b/PyroFetes/Models/Contact.cs new file mode 100644 index 0000000..5473328 --- /dev/null +++ b/PyroFetes/Models/Contact.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Contact +{ + //Champs + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? LastName { get; set; } + [Required, MaxLength(100)] public string? FirstName { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(30)] public string? PhoneNumber { get; set; } + [Required, MaxLength(100)] public string? Address { get; set; } + [Required] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + [Required, MaxLength(100)] public string? Role { get; set; } + + + //Relations + public Customer? Customer { get; set; } + [Required] public int CustomerId { get; set; } + + public List? Communications { get; set; } + public List? StaffContacts { get; set; } + public List? ContactServiceProviders { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ContactServiceProvider.cs b/PyroFetes/Models/ContactServiceProvider.cs new file mode 100644 index 0000000..cc9cd1b --- /dev/null +++ b/PyroFetes/Models/ContactServiceProvider.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ContactId), nameof(ServiceProviderId))] +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Contract.cs b/PyroFetes/Models/Contract.cs new file mode 100644 index 0000000..97cd821 --- /dev/null +++ b/PyroFetes/Models/Contract.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(ServiceProviderId))] +public class Contract +{ + [Required] public int ShowId { get; set; } + [Required] public int ServiceProviderId { get; set; } + [Required] public string? TermsAndConditions { get; set; } + + public Show? Show { get; set; } + public ServiceProvider? ServiceProvider { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Customer.cs b/PyroFetes/Models/Customer.cs new file mode 100644 index 0000000..da6dbba --- /dev/null +++ b/PyroFetes/Models/Customer.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +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? Contacts { get; set; } + public List? Quotations { get; set; } +} diff --git a/PyroFetes/Models/CustomerType.cs b/PyroFetes/Models/CustomerType.cs new file mode 100644 index 0000000..197ad09 --- /dev/null +++ b/PyroFetes/Models/CustomerType.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class CustomerType +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? Customers { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Deliverer.cs b/PyroFetes/Models/Deliverer.cs new file mode 100644 index 0000000..34e708c --- /dev/null +++ b/PyroFetes/Models/Deliverer.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Deliverer +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Transporter { get; set; } + + public List? DeliveryNotes { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/DeliveryNote.cs b/PyroFetes/Models/DeliveryNote.cs new file mode 100644 index 0000000..21e873e --- /dev/null +++ b/PyroFetes/Models/DeliveryNote.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class DeliveryNote +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? TrackingNumber { get; set; } + public int DelivererId { get; set; } + [Required] public DateOnly EstimateDeliveryDate { get; set; } + [Required] public DateOnly ExpeditionDate { get; set; } + [Required] public DateOnly RealDeliveryDate { get; set; } + + public Deliverer? Deliverer { get; set; } + public List? ProductDeliveries { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Effect.cs b/PyroFetes/Models/Effect.cs new file mode 100644 index 0000000..0dcb87c --- /dev/null +++ b/PyroFetes/Models/Effect.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Effect +{ + [Key] public int Id { get; set; } + [Required, MaxLength(200)] public string? Label { get; set; } + + public List? ProductEffects { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ExperienceLevel.cs b/PyroFetes/Models/ExperienceLevel.cs new file mode 100644 index 0000000..923f757 --- /dev/null +++ b/PyroFetes/Models/ExperienceLevel.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/HistoryOfApproval.cs b/PyroFetes/Models/HistoryOfApproval.cs new file mode 100644 index 0000000..c8fd073 --- /dev/null +++ b/PyroFetes/Models/HistoryOfApproval.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class HistoryOfApproval +{ + [Key] public int Id { get; set; } + [Required] public DateOnly DeliveryDate { get; set; } + [Required] public DateOnly ExpirationDate { get; set; } + + public List? StaffHistoryOfApprovals { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Material.cs b/PyroFetes/Models/Material.cs new file mode 100644 index 0000000..61f74c9 --- /dev/null +++ b/PyroFetes/Models/Material.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Material +{ + [Key] public int Id {get; set;} + [Required, MaxLength(100)] public string? Label {get; set;} + [Required] public int Quantity {get; set;} + + [Required] public int WarehouseId {get; set;} + public Warehouse? Warehouse {get; set;} + + public List? ShowMaterials {get; set;} + public List? MaterialWarehouses {get; set;} +} \ No newline at end of file diff --git a/PyroFetes/Models/MaterialWarehouse.cs b/PyroFetes/Models/MaterialWarehouse.cs new file mode 100644 index 0000000..4f49ba9 --- /dev/null +++ b/PyroFetes/Models/MaterialWarehouse.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(MaterialId), nameof(WarehouseId))] +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs new file mode 100644 index 0000000..fe26f18 --- /dev/null +++ b/PyroFetes/Models/Movement.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +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;} + + public List? Products { get; set; } + + public int? SourceWarehouseId {get; set;} + public Warehouse? SourceWarehouse {get; set;} + public int? DestinationWarehouseId {get; set;} + public Warehouse? DestinationWarehouse {get; set;} +} \ No newline at end of file diff --git a/PyroFetes/Models/Price.cs b/PyroFetes/Models/Price.cs new file mode 100644 index 0000000..2ee597e --- /dev/null +++ b/PyroFetes/Models/Price.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(SupplierId))] +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs new file mode 100644 index 0000000..b0f0d7f --- /dev/null +++ b/PyroFetes/Models/Product.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models +{ + public class Product + { + [Key] public int Id { get; set; } + [Required] public int References { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required] public decimal Duration {get; set;} + [Required] public decimal Caliber { get; set; } + [Required] public int ApprovalNumber { get; set; } + [Required] public decimal Weight { get; set; } + [Required] public decimal Nec { get; set; } + [Required] public decimal SellingPrice { get; set; } + [Required] public string? Image { get; set; } + [Required, MaxLength(200)] public string? Link { get; set; } + [Required] public int MinimalQuantity { get; set; } + + // Relations + [Required] public int ClassificationId { get; set; } + public Classification? Classification { get; set; } + + [Required] public int ProductCategoryId { get; set; } + public ProductCategory? ProductCategory { get; set; } + + [Required] public int MovementId {get; set;} + public Movement? Movement {get; set;} + + public List? ProductDeliveries { get; set; } + public List? Brands { get; set; } + public List? ProductEffects { get; set; } + public List? ProductColors { get; set; } + public List? PurchaseProducts { get; set; } + public List? Prices { get; set; } + public List? QuotationProducts { get; set; } + public List? WarehouseProducts { get; set; } + public List? ProductTimecodes { get; set; } + + + } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductCategory.cs b/PyroFetes/Models/ProductCategory.cs new file mode 100644 index 0000000..79bd67f --- /dev/null +++ b/PyroFetes/Models/ProductCategory.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ProductCategory +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? Products { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductColor.cs b/PyroFetes/Models/ProductColor.cs new file mode 100644 index 0000000..f93d964 --- /dev/null +++ b/PyroFetes/Models/ProductColor.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(ColorId))] +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductDelivery.cs b/PyroFetes/Models/ProductDelivery.cs new file mode 100644 index 0000000..bfbae68 --- /dev/null +++ b/PyroFetes/Models/ProductDelivery.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(DeliveryNoteId))] +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductEffect.cs b/PyroFetes/Models/ProductEffect.cs new file mode 100644 index 0000000..3f269d6 --- /dev/null +++ b/PyroFetes/Models/ProductEffect.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(EffectId))] +public class ProductEffect +{ + [Required] public Product? Product { get; set; } + [Required] public int ProductId { get; set; } + + public Effect? Effect { get; set; } + [Required] public int EffectId { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductTimecode.cs b/PyroFetes/Models/ProductTimecode.cs new file mode 100644 index 0000000..a4ad826 --- /dev/null +++ b/PyroFetes/Models/ProductTimecode.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(ShowId))] +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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProviderContact.cs b/PyroFetes/Models/ProviderContact.cs new file mode 100644 index 0000000..8d21d35 --- /dev/null +++ b/PyroFetes/Models/ProviderContact.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ContactId), nameof(ProviderId))] +public class ProviderContact +{ + public int ProviderId { get; set; } + public ServiceProvider? Provider { get; set; } + public int ContactId { get; set; } + public Contact? Contact { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProviderType.cs b/PyroFetes/Models/ProviderType.cs new file mode 100644 index 0000000..0871b8a --- /dev/null +++ b/PyroFetes/Models/ProviderType.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ProviderType +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? ServiceProviders { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/PurchaseOrder.cs b/PyroFetes/Models/PurchaseOrder.cs new file mode 100644 index 0000000..815f5a0 --- /dev/null +++ b/PyroFetes/Models/PurchaseOrder.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class PurchaseOrder +{ + [Key] public int Id { get; set; } + [Required, MaxLength(300)] public string? PurchaseConditions { get; set; } + + public List? PurchaseProducts { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/PurchaseProduct.cs b/PyroFetes/Models/PurchaseProduct.cs new file mode 100644 index 0000000..c335ede --- /dev/null +++ b/PyroFetes/Models/PurchaseProduct.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(PurchaseOrderId))] +public class PurchaseProduct +{ + public Product? Product { get; set; } + [Required] public int ProductId { get; set; } + + public PurchaseOrder? PurchaseOrder { get; set; } + [Required] public int PurchaseOrderId { get; set; } + + [Required] public int Quantity { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Quotation.cs b/PyroFetes/Models/Quotation.cs new file mode 100644 index 0000000..569c271 --- /dev/null +++ b/PyroFetes/Models/Quotation.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +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? QuotationProducts { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/QuotationProduct.cs b/PyroFetes/Models/QuotationProduct.cs new file mode 100644 index 0000000..8e2f3bb --- /dev/null +++ b/PyroFetes/Models/QuotationProduct.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(QuotationId))] +public class QuotationProduct +{ + [Required] public int ProductId { get; set; } + [Required] public int QuotationId { get; set; } + [Required] public int Quantity { get; set; } + + public Product? Product { get; set; } + public Quotation? Quotation { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ServiceProvider.cs b/PyroFetes/Models/ServiceProvider.cs new file mode 100644 index 0000000..b91e0d7 --- /dev/null +++ b/PyroFetes/Models/ServiceProvider.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ServiceProvider +{ + [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? Contracts { get; set; } + public List? ContactServiceProviders { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Setting.cs b/PyroFetes/Models/Setting.cs new file mode 100644 index 0000000..0759032 --- /dev/null +++ b/PyroFetes/Models/Setting.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Setting +{ + [Key] public int Id { get; set; } + [Required] public string? Logo { get; set; } + [Required] public string? ElectronicSignature { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Show.cs b/PyroFetes/Models/Show.cs new file mode 100644 index 0000000..bc425dd --- /dev/null +++ b/PyroFetes/Models/Show.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Show +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [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? ShowStaffs { get; set; } + public List? ShowTrucks { get; set; } + public List? SoundTimecodes { get; set; } + public List? ProductTimecodes { get; set; } + public List? Contracts { get; set; } + public List? ShowMaterials { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ShowMaterial.cs b/PyroFetes/Models/ShowMaterial.cs new file mode 100644 index 0000000..81cc82a --- /dev/null +++ b/PyroFetes/Models/ShowMaterial.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(MaterialId))] +public class ShowMaterial +{ + [Required] public Show? Show { get; set; } + [Required] public int ShowId { get; set; } + + public Material? Material { get; set; } + [Required] public int MaterialId { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/ShowServiceProvider.cs b/PyroFetes/Models/ShowServiceProvider.cs new file mode 100644 index 0000000..351c9fc --- /dev/null +++ b/PyroFetes/Models/ShowServiceProvider.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ShowServiceProvider +{ + [Key] public int Id { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/ShowStaff.cs b/PyroFetes/Models/ShowStaff.cs new file mode 100644 index 0000000..60a7215 --- /dev/null +++ b/PyroFetes/Models/ShowStaff.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(StaffId), nameof(ShowId))] +public class ShowStaff +{ + public Staff? Staff { get; set; } + [Required] public int StaffId { get; set; } + + public Show? Show { get; set; } + [Required] public int ShowId { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ShowTruck.cs b/PyroFetes/Models/ShowTruck.cs new file mode 100644 index 0000000..9f39f8a --- /dev/null +++ b/PyroFetes/Models/ShowTruck.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(TruckId))] +public class ShowTruck +{ + public Show? Show { get; set; } + [Required] public int ShowId { get; set; } + + public Truck? Truck { get; set; } + [Required] public int TruckId { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Sound.cs b/PyroFetes/Models/Sound.cs new file mode 100644 index 0000000..3ddee3e --- /dev/null +++ b/PyroFetes/Models/Sound.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Sound +{ + [Key] public int Id { get; set; } + [Required, MaxLength(120)] public string Name { get; set; } = null!; + [Required, MaxLength(60)] public string? Type { get; set; } + [Required, MaxLength(120)] public string? Artist { get; set; } + [Required, Range(0, int.MaxValue)] public int? Duration { get; set; } + [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? SoundTimecodes { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/SoundCategory.cs b/PyroFetes/Models/SoundCategory.cs new file mode 100644 index 0000000..52caeaf --- /dev/null +++ b/PyroFetes/Models/SoundCategory.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class SoundCategory +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string Name { get; set; } = null!; + + public List? Sounds { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/SoundTimecode.cs b/PyroFetes/Models/SoundTimecode.cs new file mode 100644 index 0000000..3411e0c --- /dev/null +++ b/PyroFetes/Models/SoundTimecode.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(SoundId))] +public class SoundTimecode +{ + [Required] public int ShowId { get; set; } + 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; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Staff.cs b/PyroFetes/Models/Staff.cs new file mode 100644 index 0000000..a95c455 --- /dev/null +++ b/PyroFetes/Models/Staff.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Staff +{ + [Key] public int Id { get; set; } + [Required, MaxLength(60)] public string FirstName { get; set; } = null!; + [Required, MaxLength(60)] public string LastName { get; set; } = null!; + [Required, MaxLength(100)] public string? Profession { get; set; } + [Required, MaxLength(120)] public string? Email { get; set; } + [Required, MaxLength(100)] public string? F4T2NumberApproval { get; set; } + [Required] public DateOnly F4T2ExpirationDate { get; set; } + + public List? ShowStaffs { get; set; } + public List? ExperienceLevels { get; set; } + public List? StaffAvailabilities { get; set; } + public List? StaffHistoryOfApprovals { get; set; } + public List? StaffContacts { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/StaffAvailability.cs b/PyroFetes/Models/StaffAvailability.cs new file mode 100644 index 0000000..3ba0732 --- /dev/null +++ b/PyroFetes/Models/StaffAvailability.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(AvailabilityId), nameof(StaffId))] +public class StaffAvailability +{ + public int StaffId { get; set; } + public Staff? Staff { get; set; } + public int AvailabilityId { get; set; } + public Availability? Availability { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/StaffContact.cs b/PyroFetes/Models/StaffContact.cs new file mode 100644 index 0000000..18ab5a9 --- /dev/null +++ b/PyroFetes/Models/StaffContact.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ContactId), nameof(StaffId))] +public class StaffContact +{ + [Required] public int StaffId { get; set; } + public Staff? Staff { get; set; } + [Required] public int ContactId { get; set; } + public Contact? Contact { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/StaffHistoryOfApproval.cs b/PyroFetes/Models/StaffHistoryOfApproval.cs new file mode 100644 index 0000000..3937064 --- /dev/null +++ b/PyroFetes/Models/StaffHistoryOfApproval.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(HistoryOfApprovalId), nameof(StaffId))] +public class StaffHistoryOfApproval +{ + public int StaffId { get; set; } + public Staff? Staff { get; set; } + public int HistoryOfApprovalId { get; set; } + public HistoryOfApproval? HistoryOfApproval { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Supplier.cs b/PyroFetes/Models/Supplier.cs new file mode 100644 index 0000000..f131804 --- /dev/null +++ b/PyroFetes/Models/Supplier.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Supplier +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [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] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + [Required] public int DeliveryDelay { get; set; } + + public List? Prices { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Truck.cs b/PyroFetes/Models/Truck.cs new file mode 100644 index 0000000..91794a9 --- /dev/null +++ b/PyroFetes/Models/Truck.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Truck +{ + [Key] public int Id { get; set; } + [Required, MaxLength(40)] public string Type { get; set; } = null!; + [Required] public double? MaxExplosiveCapacity { get; set; } + [Required, MaxLength(80)] public string? Sizes { get; set; } + [Required, MaxLength(40)] public string? Status { get; set; } + + public List? ShowTrucks { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/User.cs b/PyroFetes/Models/User.cs new file mode 100644 index 0000000..8baaa1c --- /dev/null +++ b/PyroFetes/Models/User.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class User +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required, MinLength(12), MaxLength(50)] public string? Password { get; set; } + [Required, MaxLength(100)] public string? Salt { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(100)] public string? Fonction { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Warehouse.cs b/PyroFetes/Models/Warehouse.cs new file mode 100644 index 0000000..8d014e7 --- /dev/null +++ b/PyroFetes/Models/Warehouse.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +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;} + [Required, MaxLength(100)] public string? Address { get; set; } + [Required] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + + public List? WarehouseProducts { get; set; } + + public List? MaterialWarehouses {get; set;} + + public List? MovementsSource { get; set; } + public List? MovementsDestination { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/WarehouseProduct.cs b/PyroFetes/Models/WarehouseProduct.cs new file mode 100644 index 0000000..fe89d36 --- /dev/null +++ b/PyroFetes/Models/WarehouseProduct.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(WarehouseId))] +public class WarehouseProduct +{ + [Required] public int ProductId { get; set; } + public Product? Product { get; set; } + [Required] public int WarehouseId { get; set; } + public Warehouse? Warehouse { get; set; } + + [Required] public int Quantity { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Program.cs b/PyroFetes/Program.cs new file mode 100644 index 0000000..e610bf4 --- /dev/null +++ b/PyroFetes/Program.cs @@ -0,0 +1,20 @@ +using API; +using FastEndpoints; +using FastEndpoints.Swagger; +using PyroFetes; + +WebApplicationBuilder builder = WebApplication.CreateBuilder(args); + +// On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet +builder.Services.AddFastEndpoints().SwaggerDocument(); + +// On ajoute ici la configuration de la base de données +builder.Services.AddDbContext(); + +// On construit l'application en lui donnant vie +WebApplication app = builder.Build(); +app.UseFastEndpoints().UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/PyroFetes/PyroFetesDbContext.cs b/PyroFetes/PyroFetesDbContext.cs new file mode 100644 index 0000000..b5ce8c7 --- /dev/null +++ b/PyroFetes/PyroFetesDbContext.cs @@ -0,0 +1,93 @@ +using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; +using ServiceProvider = PyroFetes.Models.ServiceProvider; + +namespace PyroFetes; + +public class PyroFetesDbContext : DbContext +{ + // Entities + public DbSet Availabilities { get; set; } + public DbSet Brands { get; set; } + public DbSet Classifications { get; set; } + public DbSet Colors { get; set; } + public DbSet Communications { get; set; } + public DbSet Contacts { get; set; } + public DbSet Customers { get; set; } + public DbSet CustomerTypes { get; set; } + public DbSet Deliverers { get; set; } + public DbSet DeliveryNotes { get; set; } + public DbSet Effects { get; set; } + public DbSet ExperienceLevels { get; set; } + public DbSet HistoryOfApprovals { get; set; } + public DbSet Materials { get; set; } + public DbSet Movements { get; set; } + public DbSet Prices { get; set; } + public DbSet Products { get; set; } + public DbSet ProductCategories { get; set; } + public DbSet ProductColors { get; set; } + public DbSet ProductDeliveries { get; set; } + public DbSet ProductEffects { get; set; } + public DbSet Providers { get; set; } + public DbSet ProviderContacts { get; set; } + public DbSet ProviderTypes { get; set; } + public DbSet PurchaseOrders { get; set; } + public DbSet PurchaseProducts { get; set; } + public DbSet Quotations { get; set; } + public DbSet QuotationProducts { get; set; } + public DbSet Settings { get; set; } + public DbSet Shows { get; set; } + public DbSet Sounds { get; set; } + public DbSet SoundCategories { get; set; } + public DbSet SoundTimecodes { get; set; } + public DbSet Staffs { get; set; } + public DbSet StaffAvailabilities { get; set; } + public DbSet StaffContacts { get; set; } + public DbSet StaffHistoryOfApprovals { get; set; } + public DbSet Suppliers { get; set; } + public DbSet Trucks { get; set; } + public DbSet Users { get; set; } + public DbSet Warehouses { get; set; } + public DbSet WarehouseProducts { get; set; } + + // Database configuration + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + string connectionString = + "Server=romaric-thibault.fr;" + + "Database=PyroFetes;" + + "User Id=pyrofetes;" + + "Password=Crablike8-Fringe-Swimmable;" + + "TrustServerCertificate=true;"; + + optionsBuilder.UseSqlServer(connectionString); + } + + // Models customization + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity() + .HasOne(m => m.SourceWarehouse) + .WithMany(w => w.MovementsSource) + .HasForeignKey(m => m.SourceWarehouseId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(m => m.DestinationWarehouse) + .WithMany(w => w.MovementsDestination) + .HasForeignKey(m => m.DestinationWarehouseId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(mw => mw.Material) + .WithMany(m => m.MaterialWarehouses) + .HasForeignKey(mw => mw.MaterialId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(mw => mw.Warehouse) + .WithMany(w => w.MaterialWarehouses) + .HasForeignKey(mw => mw.WarehouseId) + .OnDelete(DeleteBehavior.Restrict); + } +} \ No newline at end of file From 7a8daa6ab8edf041870dbc4a5ef1fdf98f109cfd Mon Sep 17 00:00:00 2001 From: oistig Date: Thu, 9 Oct 2025 17:01:54 +0200 Subject: [PATCH 3/7] le sln --- PyroFetes.sln | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 PyroFetes.sln diff --git a/PyroFetes.sln b/PyroFetes.sln new file mode 100644 index 0000000..2918820 --- /dev/null +++ b/PyroFetes.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PyroFetes", "PyroFetes\PyroFetes.csproj", "{23E11090-EC39-414E-B2A7-FEF96FE729E3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {23E11090-EC39-414E-B2A7-FEF96FE729E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23E11090-EC39-414E-B2A7-FEF96FE729E3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23E11090-EC39-414E-B2A7-FEF96FE729E3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23E11090-EC39-414E-B2A7-FEF96FE729E3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal From 1734ec0219d8cf3356bdf58f49714fcf1c82e75b Mon Sep 17 00:00:00 2001 From: oistig Date: Thu, 9 Oct 2025 17:03:05 +0200 Subject: [PATCH 4/7] le reste --- .gitignore | 810 +++++++ ...20251008103414_InitialDatabase.Designer.cs | 1951 +++++++++++++++++ .../20251008103414_InitialDatabase.cs | 1392 ++++++++++++ PyroFetes/Models/.idea/.gitignore | 13 + PyroFetes/Models/.idea/encodings.xml | 4 + PyroFetes/Models/.idea/indexLayout.xml | 8 + PyroFetes/Properties/launchSettings.json | 41 + PyroFetes/PyroFetes.csproj | 22 + PyroFetes/appsettings.Development.json | 8 + PyroFetes/appsettings.json | 9 + README.md | 50 + 11 files changed, 4308 insertions(+) create mode 100644 .gitignore create mode 100644 PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs create mode 100644 PyroFetes/Migrations/20251008103414_InitialDatabase.cs create mode 100644 PyroFetes/Models/.idea/.gitignore create mode 100644 PyroFetes/Models/.idea/encodings.xml create mode 100644 PyroFetes/Models/.idea/indexLayout.xml create mode 100644 PyroFetes/Properties/launchSettings.json create mode 100644 PyroFetes/PyroFetes.csproj create mode 100644 PyroFetes/appsettings.Development.json create mode 100644 PyroFetes/appsettings.json create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d19034c --- /dev/null +++ b/.gitignore @@ -0,0 +1,810 @@ +# Created by https://www.toptal.com/developers/gitignore/api/dotnetcore,csharp,visualstudio,rider,jetbrains+all,windows,macos,linux,sonarqube +# Edit at https://www.toptal.com/developers/gitignore?templates=dotnetcore,csharp,visualstudio,rider,jetbrains+all,windows,macos,linux,sonarqube + +### Csharp ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### DotnetCore ### +# .NET Core build folders +bin/ +obj/ + +# Common node modules locations +/node_modules +/wwwroot/node_modules + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### JetBrains+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Linux ### + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Rider ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### SonarQube ### +# SonarQube ignore files. +# +# https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner +# Sonar Scanner working directories +.sonar/ +.sonarqube/ +.scannerwork/ + +# http://www.sonarlint.org/commandline/ +# SonarLint working directories, configuration files (including credentials) +.sonarlint/ + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files + +# Windows shortcuts +*.lnk + +### VisualStudio ### + +# User-specific files + +# User-specific files (MonoDevelop/Xamarin Studio) + +# Mono auto generated files + +# Build results + +# Visual Studio 2015/2017 cache/options directory +# Uncomment if you have tasks that create the project's static files in wwwroot + +# Visual Studio 2017 auto generated files + +# MSTest test Results + +# NUnit + +# Build Results of an ATL Project + +# Benchmark Results + +# .NET Core + +# ASP.NET Scaffolding + +# StyleCop + +# Files built by Visual Studio + +# Chutzpah Test files + +# Visual C++ cache files + +# Visual Studio profiler + +# Visual Studio Trace Files + +# TFS 2012 Local Workspace + +# Guidance Automation Toolkit + +# ReSharper is a .NET coding add-in + +# TeamCity is a build add-in + +# DotCover is a Code Coverage Tool + +# AxoCover is a Code Coverage Tool + +# Coverlet is a free, cross platform Code Coverage Tool + +# Visual Studio code coverage results + +# NCrunch + +# MightyMoose + +# Web workbench (sass) + +# Installshield output folder + +# DocProject is a documentation generator add-in + +# Click-Once directory + +# Publish Web Output +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted + +# NuGet Packages +# NuGet Symbol Packages +# The packages folder can be ignored because of Package Restore +# except build/, which is used as an MSBuild target. +# Uncomment if necessary however generally it will be regenerated when needed +# NuGet v3's project.json files produces more ignorable files + +# Microsoft Azure Build Output + +# Microsoft Azure Emulator + +# Windows Store app package directories and files + +# Visual Studio cache files +# files ending in .cache can be ignored +# but keep track of directories ending in .cache + +# Others + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) + +# RIA/Silverlight projects + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) + +# SQL Server files + +# Business Intelligence projects + +# Microsoft Fakes + +# GhostDoc plugin setting file + +# Node.js Tools for Visual Studio + +# Visual Studio 6 build log + +# Visual Studio 6 workspace options file + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output + +# Paket dependency manager + +# FAKE - F# Make + +# CodeRush personal settings + +# Python Tools for Visual Studio (PTVS) + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio + +# Telerik's JustMock configuration file + +# BizTalk build output + +# OpenCover UI analysis results + +# Azure Stream Analytics local run output + +# MSBuild Binary and Structured Log + +# NVidia Nsight GPU debugger configuration file + +# MFractors (Xamarin productivity tool) working folder + +# Local History for Visual Studio + +# Visual Studio History (VSHistory) files + +# BeatPulse healthcheck temp database + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 + +# Ionide (cross platform F# VS Code tools) working folder + +# Fody - auto-generated XML schema + +# VS Code files for those working on multiple tools + +# Local History for Visual Studio Code + +# Windows Installer files from build outputs + +# JetBrains Rider + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,csharp,visualstudio,rider,jetbrains+all,windows,macos,linux,sonarqube diff --git a/PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs b/PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs new file mode 100644 index 0000000..8e971b2 --- /dev/null +++ b/PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs @@ -0,0 +1,1951 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PyroFetes; + +#nullable disable + +namespace PyroFetes.Migrations +{ + [DbContext(typeof(PyroFetesDbContext))] + [Migration("20251008103414_InitialDatabase")] + partial class InitialDatabase + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AvailabilityDate") + .HasColumnType("date"); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.Property("RenewallDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("Availabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("Brands"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Classifications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Colors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Calling") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Meeting") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("Communications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Role") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("ContactServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.Property("TermsAndConditions") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ShowId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("Contract"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CustomerTypeId") + .HasColumnType("int"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerTypeId"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("CustomerTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Transporter") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Deliverers"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DelivererId") + .HasColumnType("int"); + + b.Property("EstimateDeliveryDate") + .HasColumnType("date"); + + b.Property("ExpeditionDate") + .HasColumnType("date"); + + b.Property("RealDeliveryDate") + .HasColumnType("date"); + + b.Property("TrackingNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("DelivererId"); + + b.ToTable("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Effects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("ExperienceLevels"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("HistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("WarehouseId"); + + b.ToTable("Materials"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.Property("MaterialId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("MaterialId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("MaterialWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Arrival") + .HasColumnType("datetime2"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DestinationWarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SourceWarehouseId") + .HasColumnType("int"); + + b.Property("Start") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("DestinationWarehouseId"); + + b.HasIndex("SourceWarehouseId"); + + b.ToTable("Movements"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("SupplierId") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "SupplierId"); + + b.HasIndex("SupplierId"); + + b.ToTable("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApprovalNumber") + .HasColumnType("int"); + + b.Property("Caliber") + .HasColumnType("decimal(18,2)"); + + b.Property("ClassificationId") + .HasColumnType("int"); + + b.Property("Duration") + .HasColumnType("decimal(18,2)"); + + b.Property("Image") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Link") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("MinimalQuantity") + .HasColumnType("int"); + + b.Property("MovementId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Nec") + .HasColumnType("decimal(18,2)"); + + b.Property("ProductCategoryId") + .HasColumnType("int"); + + b.Property("References") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("Weight") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("ClassificationId"); + + b.HasIndex("MovementId"); + + b.HasIndex("ProductCategoryId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProductCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ColorId") + .HasColumnType("int"); + + b.HasKey("ProductId", "ColorId"); + + b.HasIndex("ColorId"); + + b.ToTable("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("DeliveryNoteId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "DeliveryNoteId"); + + b.HasIndex("DeliveryNoteId"); + + b.ToTable("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("EffectId") + .HasColumnType("int"); + + b.HasKey("ProductId", "EffectId"); + + b.HasIndex("EffectId"); + + b.ToTable("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ProductTimecode"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ProviderId"); + + b.HasIndex("ProviderId"); + + b.ToTable("ProviderContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProviderTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PurchaseConditions") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.ToTable("PurchaseOrders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("PurchaseOrderId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "PurchaseOrderId"); + + b.HasIndex("PurchaseOrderId"); + + b.ToTable("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConditionsSale") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("QuotationId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "QuotationId"); + + b.HasIndex("QuotationId"); + + b.ToTable("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.ToTable("Providers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ElectronicSignature") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CityId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Place") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("PyrotechnicImplementationPlan") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("MaterialId") + .HasColumnType("int"); + + b.HasKey("ShowId", "MaterialId"); + + b.HasIndex("MaterialId"); + + b.ToTable("ShowMaterial"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.Property("StaffId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.HasKey("StaffId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ShowStaff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("TruckId") + .HasColumnType("int"); + + b.HasKey("ShowId", "TruckId"); + + b.HasIndex("TruckId"); + + b.ToTable("ShowTruck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Artist") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Duration") + .IsRequired() + .HasColumnType("int"); + + b.Property("Format") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("SoundCategoryId") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("Id"); + + b.HasIndex("SoundCategoryId"); + + b.ToTable("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("SoundCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("SoundId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ShowId", "SoundId"); + + b.HasIndex("SoundId"); + + b.ToTable("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("F4T2ExpirationDate") + .HasColumnType("date"); + + b.Property("F4T2NumberApproval") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Profession") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Staffs"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.Property("AvailabilityId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("AvailabilityId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("ContactId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.Property("HistoryOfApprovalId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("HistoryOfApprovalId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DeliveryDelay") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Suppliers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("MaxExplosiveCapacity") + .IsRequired() + .HasColumnType("float"); + + b.Property("Sizes") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("nvarchar(80)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.HasKey("Id"); + + b.ToTable("Trucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Fonction") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Salt") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Current") + .HasColumnType("int"); + + b.Property("MaxWeight") + .HasColumnType("int"); + + b.Property("MinWeight") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Warehouses"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Brands") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("Communications") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("ContactServiceProviders") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("ContactServiceProviders") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("Contracts") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("Contracts") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServiceProvider"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.HasOne("PyroFetes.Models.CustomerType", "CustomerType") + .WithMany("Customers") + .HasForeignKey("CustomerTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerType"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.HasOne("PyroFetes.Models.Deliverer", "Deliverer") + .WithMany("DeliveryNotes") + .HasForeignKey("DelivererId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Deliverer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ExperienceLevels") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany() + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("MaterialWarehouses") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("MaterialWarehouses") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "DestinationWarehouse") + .WithMany("MovementsDestination") + .HasForeignKey("DestinationWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("PyroFetes.Models.Warehouse", "SourceWarehouse") + .WithMany("MovementsSource") + .HasForeignKey("SourceWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("DestinationWarehouse"); + + b.Navigation("SourceWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Prices") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Supplier", "Supplier") + .WithMany("Prices") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.HasOne("PyroFetes.Models.Classification", "Classification") + .WithMany("Products") + .HasForeignKey("ClassificationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Movement", "Movement") + .WithMany("Products") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ProductCategory", "ProductCategory") + .WithMany("Products") + .HasForeignKey("ProductCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Classification"); + + b.Navigation("Movement"); + + b.Navigation("ProductCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.HasOne("PyroFetes.Models.Color", "Color") + .WithMany("ProductColors") + .HasForeignKey("ColorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductColors") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Color"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.HasOne("PyroFetes.Models.DeliveryNote", "DeliveryNote") + .WithMany("ProductDeliveries") + .HasForeignKey("DeliveryNoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductDeliveries") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeliveryNote"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.HasOne("PyroFetes.Models.Effect", "Effect") + .WithMany("ProductEffects") + .HasForeignKey("EffectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductEffects") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Effect"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductTimecodes") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ProductTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "Provider") + .WithMany() + .HasForeignKey("ProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("PurchaseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.PurchaseOrder", "PurchaseOrder") + .WithMany("PurchaseProducts") + .HasForeignKey("PurchaseOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("PurchaseOrder"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Quotations") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("QuotationProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Quotation", "Quotation") + .WithMany("QuotationProducts") + .HasForeignKey("QuotationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Quotation"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") + .WithMany("ServiceProviders") + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.HasOne("PyroFetes.Models.City", "City") + .WithMany("Shows") + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("ShowMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowMaterials") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowStaffs") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ShowStaffs") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowTrucks") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Truck", "Truck") + .WithMany("ShowTrucks") + .HasForeignKey("TruckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Truck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.HasOne("PyroFetes.Models.SoundCategory", "SoundCategory") + .WithMany("Sounds") + .HasForeignKey("SoundCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SoundCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("SoundTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Sound", "Sound") + .WithMany("SoundTimecodes") + .HasForeignKey("SoundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Sound"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.HasOne("PyroFetes.Models.Availability", "Availability") + .WithMany("StaffAvailabilities") + .HasForeignKey("AvailabilityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffAvailabilities") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Availability"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("StaffContacts") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffContacts") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.HasOne("PyroFetes.Models.HistoryOfApproval", "HistoryOfApproval") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("HistoryOfApprovalId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("HistoryOfApproval"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("WarehouseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("WarehouseProducts") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Navigation("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Navigation("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Navigation("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Navigation("Communications"); + + b.Navigation("ContactServiceProviders"); + + b.Navigation("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Navigation("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Navigation("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Navigation("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("ShowMaterials"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Navigation("Brands"); + + b.Navigation("Prices"); + + b.Navigation("ProductColors"); + + b.Navigation("ProductDeliveries"); + + b.Navigation("ProductEffects"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("PurchaseProducts"); + + b.Navigation("QuotationProducts"); + + b.Navigation("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Navigation("ServiceProviders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Navigation("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Navigation("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Navigation("ContactServiceProviders"); + + b.Navigation("Contracts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Navigation("Contracts"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("ShowMaterials"); + + b.Navigation("ShowStaffs"); + + b.Navigation("ShowTrucks"); + + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Navigation("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Navigation("ExperienceLevels"); + + b.Navigation("ShowStaffs"); + + b.Navigation("StaffAvailabilities"); + + b.Navigation("StaffContacts"); + + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Navigation("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Navigation("ShowTrucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("MovementsDestination"); + + b.Navigation("MovementsSource"); + + b.Navigation("WarehouseProducts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PyroFetes/Migrations/20251008103414_InitialDatabase.cs b/PyroFetes/Migrations/20251008103414_InitialDatabase.cs new file mode 100644 index 0000000..5c5dbc7 --- /dev/null +++ b/PyroFetes/Migrations/20251008103414_InitialDatabase.cs @@ -0,0 +1,1392 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PyroFetes.Migrations +{ + /// + public partial class InitialDatabase : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Availabilities", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + AvailabilityDate = table.Column(type: "date", nullable: false), + DeliveryDate = table.Column(type: "date", nullable: false), + ExpirationDate = table.Column(type: "date", nullable: false), + RenewallDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Availabilities", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "City", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_City", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Classifications", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Classifications", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Colors", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Colors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CustomerTypes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CustomerTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Deliverers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Transporter = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Deliverers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Effects", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Effects", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "HistoryOfApprovals", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + DeliveryDate = table.Column(type: "date", nullable: false), + ExpirationDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_HistoryOfApprovals", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ProductCategories", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductCategories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ProviderTypes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProviderTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PurchaseOrders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PurchaseConditions = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PurchaseOrders", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Settings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Logo = table.Column(type: "nvarchar(max)", nullable: false), + ElectronicSignature = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Settings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "SoundCategories", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SoundCategories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Staffs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FirstName = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), + LastName = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), + Profession = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + F4T2NumberApproval = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + F4T2ExpirationDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Staffs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Suppliers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Phone = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + DeliveryDelay = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Suppliers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Trucks", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Type = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + MaxExplosiveCapacity = table.Column(type: "float", nullable: false), + Sizes = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), + Status = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Trucks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Password = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Salt = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Fonction = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Warehouses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + MaxWeight = table.Column(type: "int", nullable: false), + Current = table.Column(type: "int", nullable: false), + MinWeight = table.Column(type: "int", nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Warehouses", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Shows", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Place = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Date = table.Column(type: "date", nullable: true), + PyrotechnicImplementationPlan = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), + CityId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shows", x => x.Id); + table.ForeignKey( + name: "FK_Shows_City_CityId", + column: x => x.CityId, + principalTable: "City", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Customers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Note = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + CustomerTypeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Customers", x => x.Id); + table.ForeignKey( + name: "FK_Customers_CustomerTypes_CustomerTypeId", + column: x => x.CustomerTypeId, + principalTable: "CustomerTypes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DeliveryNotes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TrackingNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + DelivererId = table.Column(type: "int", nullable: false), + EstimateDeliveryDate = table.Column(type: "date", nullable: false), + ExpeditionDate = table.Column(type: "date", nullable: false), + RealDeliveryDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DeliveryNotes", x => x.Id); + table.ForeignKey( + name: "FK_DeliveryNotes_Deliverers_DelivererId", + column: x => x.DelivererId, + principalTable: "Deliverers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Providers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Price = table.Column(type: "decimal(18,2)", nullable: false), + ProviderTypeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Providers", x => x.Id); + table.ForeignKey( + name: "FK_Providers_ProviderTypes_ProviderTypeId", + column: x => x.ProviderTypeId, + principalTable: "ProviderTypes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Sounds", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Type = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), + Artist = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Duration = table.Column(type: "int", nullable: false), + Kind = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + Format = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: true), + SoundCategoryId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sounds", x => x.Id); + table.ForeignKey( + name: "FK_Sounds_SoundCategories_SoundCategoryId", + column: x => x.SoundCategoryId, + principalTable: "SoundCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ExperienceLevels", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + StaffId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ExperienceLevels", x => x.Id); + table.ForeignKey( + name: "FK_ExperienceLevels_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StaffAvailabilities", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + AvailabilityId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StaffAvailabilities", x => new { x.AvailabilityId, x.StaffId }); + table.ForeignKey( + name: "FK_StaffAvailabilities_Availabilities_AvailabilityId", + column: x => x.AvailabilityId, + principalTable: "Availabilities", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StaffAvailabilities_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StaffHistoryOfApprovals", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + HistoryOfApprovalId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StaffHistoryOfApprovals", x => new { x.HistoryOfApprovalId, x.StaffId }); + table.ForeignKey( + name: "FK_StaffHistoryOfApprovals_HistoryOfApprovals_HistoryOfApprovalId", + column: x => x.HistoryOfApprovalId, + principalTable: "HistoryOfApprovals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StaffHistoryOfApprovals_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Materials", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Quantity = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Materials", x => x.Id); + table.ForeignKey( + name: "FK_Materials_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Movements", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Date = table.Column(type: "datetime2", nullable: false), + Start = table.Column(type: "datetime2", nullable: false), + Arrival = table.Column(type: "datetime2", nullable: false), + Quantity = table.Column(type: "int", nullable: false), + SourceWarehouseId = table.Column(type: "int", nullable: true), + DestinationWarehouseId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Movements", x => x.Id); + table.ForeignKey( + name: "FK_Movements_Warehouses_DestinationWarehouseId", + column: x => x.DestinationWarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Movements_Warehouses_SourceWarehouseId", + column: x => x.SourceWarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShowStaff", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + ShowId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowStaff", x => new { x.StaffId, x.ShowId }); + table.ForeignKey( + name: "FK_ShowStaff_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowStaff_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ShowTruck", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + TruckId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowTruck", x => new { x.ShowId, x.TruckId }); + table.ForeignKey( + name: "FK_ShowTruck_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowTruck_Trucks_TruckId", + column: x => x.TruckId, + principalTable: "Trucks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + PhoneNumber = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Role = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + CustomerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_Customers_CustomerId", + column: x => x.CustomerId, + principalTable: "Customers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Quotations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Message = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ConditionsSale = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), + CustomerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Quotations", x => x.Id); + table.ForeignKey( + name: "FK_Quotations_Customers_CustomerId", + column: x => x.CustomerId, + principalTable: "Customers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Contract", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + ServiceProviderId = table.Column(type: "int", nullable: false), + TermsAndConditions = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contract", x => new { x.ShowId, x.ServiceProviderId }); + table.ForeignKey( + name: "FK_Contract_Providers_ServiceProviderId", + column: x => x.ServiceProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contract_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SoundTimecodes", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + SoundId = table.Column(type: "int", nullable: false), + Start = table.Column(type: "decimal(18,2)", nullable: false), + End = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SoundTimecodes", x => new { x.ShowId, x.SoundId }); + table.ForeignKey( + name: "FK_SoundTimecodes_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SoundTimecodes_Sounds_SoundId", + column: x => x.SoundId, + principalTable: "Sounds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "MaterialWarehouse", + columns: table => new + { + MaterialId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MaterialWarehouse", x => new { x.MaterialId, x.WarehouseId }); + table.ForeignKey( + name: "FK_MaterialWarehouse_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_MaterialWarehouse_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShowMaterial", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + MaterialId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowMaterial", x => new { x.ShowId, x.MaterialId }); + table.ForeignKey( + name: "FK_ShowMaterial_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowMaterial_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + References = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Duration = table.Column(type: "decimal(18,2)", nullable: false), + Caliber = table.Column(type: "decimal(18,2)", nullable: false), + ApprovalNumber = table.Column(type: "int", nullable: false), + Weight = table.Column(type: "decimal(18,2)", nullable: false), + Nec = table.Column(type: "decimal(18,2)", nullable: false), + SellingPrice = table.Column(type: "decimal(18,2)", nullable: false), + Image = table.Column(type: "nvarchar(max)", nullable: false), + Link = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + MinimalQuantity = table.Column(type: "int", nullable: false), + ClassificationId = table.Column(type: "int", nullable: false), + ProductCategoryId = table.Column(type: "int", nullable: false), + MovementId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.Id); + table.ForeignKey( + name: "FK_Products_Classifications_ClassificationId", + column: x => x.ClassificationId, + principalTable: "Classifications", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Products_Movements_MovementId", + column: x => x.MovementId, + principalTable: "Movements", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Products_ProductCategories_ProductCategoryId", + column: x => x.ProductCategoryId, + principalTable: "ProductCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Communications", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Calling = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Meeting = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Communications", x => x.Id); + table.ForeignKey( + name: "FK_Communications_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ContactServiceProvider", + columns: table => new + { + ContactId = table.Column(type: "int", nullable: false), + ServiceProviderId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ContactServiceProvider", x => new { x.ContactId, x.ServiceProviderId }); + table.ForeignKey( + name: "FK_ContactServiceProvider_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactServiceProvider_Providers_ServiceProviderId", + column: x => x.ServiceProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProviderContacts", + columns: table => new + { + ProviderId = table.Column(type: "int", nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProviderContacts", x => new { x.ContactId, x.ProviderId }); + table.ForeignKey( + name: "FK_ProviderContacts_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProviderContacts_Providers_ProviderId", + column: x => x.ProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StaffContacts", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StaffContacts", x => new { x.ContactId, x.StaffId }); + table.ForeignKey( + name: "FK_StaffContacts_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StaffContacts_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Brands", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ProductId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Brands", x => x.Id); + table.ForeignKey( + name: "FK_Brands_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Prices", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + SupplierId = table.Column(type: "int", nullable: false), + SellingPrice = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Prices", x => new { x.ProductId, x.SupplierId }); + table.ForeignKey( + name: "FK_Prices_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Prices_Suppliers_SupplierId", + column: x => x.SupplierId, + principalTable: "Suppliers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductColors", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + ColorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductColors", x => new { x.ProductId, x.ColorId }); + table.ForeignKey( + name: "FK_ProductColors_Colors_ColorId", + column: x => x.ColorId, + principalTable: "Colors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductColors_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductDeliveries", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + DeliveryNoteId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductDeliveries", x => new { x.ProductId, x.DeliveryNoteId }); + table.ForeignKey( + name: "FK_ProductDeliveries_DeliveryNotes_DeliveryNoteId", + column: x => x.DeliveryNoteId, + principalTable: "DeliveryNotes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductDeliveries_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductEffects", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + EffectId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductEffects", x => new { x.ProductId, x.EffectId }); + table.ForeignKey( + name: "FK_ProductEffects_Effects_EffectId", + column: x => x.EffectId, + principalTable: "Effects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductEffects_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductTimecode", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + ShowId = table.Column(type: "int", nullable: false), + Start = table.Column(type: "decimal(18,2)", nullable: false), + End = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductTimecode", x => new { x.ProductId, x.ShowId }); + table.ForeignKey( + name: "FK_ProductTimecode_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductTimecode_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PurchaseProducts", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + PurchaseOrderId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PurchaseProducts", x => new { x.ProductId, x.PurchaseOrderId }); + table.ForeignKey( + name: "FK_PurchaseProducts_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PurchaseProducts_PurchaseOrders_PurchaseOrderId", + column: x => x.PurchaseOrderId, + principalTable: "PurchaseOrders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "QuotationProducts", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + QuotationId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_QuotationProducts", x => new { x.ProductId, x.QuotationId }); + table.ForeignKey( + name: "FK_QuotationProducts_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_QuotationProducts_Quotations_QuotationId", + column: x => x.QuotationId, + principalTable: "Quotations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "WarehouseProducts", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WarehouseProducts", x => new { x.ProductId, x.WarehouseId }); + table.ForeignKey( + name: "FK_WarehouseProducts_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WarehouseProducts_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Brands_ProductId", + table: "Brands", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Communications_ContactId", + table: "Communications", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CustomerId", + table: "Contacts", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactServiceProvider_ServiceProviderId", + table: "ContactServiceProvider", + column: "ServiceProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Contract_ServiceProviderId", + table: "Contract", + column: "ServiceProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Customers_CustomerTypeId", + table: "Customers", + column: "CustomerTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_DeliveryNotes_DelivererId", + table: "DeliveryNotes", + column: "DelivererId"); + + migrationBuilder.CreateIndex( + name: "IX_ExperienceLevels_StaffId", + table: "ExperienceLevels", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_Materials_WarehouseId", + table: "Materials", + column: "WarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_MaterialWarehouse_WarehouseId", + table: "MaterialWarehouse", + column: "WarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Movements_DestinationWarehouseId", + table: "Movements", + column: "DestinationWarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Movements_SourceWarehouseId", + table: "Movements", + column: "SourceWarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Prices_SupplierId", + table: "Prices", + column: "SupplierId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductColors_ColorId", + table: "ProductColors", + column: "ColorId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductDeliveries_DeliveryNoteId", + table: "ProductDeliveries", + column: "DeliveryNoteId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductEffects_EffectId", + table: "ProductEffects", + column: "EffectId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_ClassificationId", + table: "Products", + column: "ClassificationId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_MovementId", + table: "Products", + column: "MovementId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_ProductCategoryId", + table: "Products", + column: "ProductCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductTimecode_ShowId", + table: "ProductTimecode", + column: "ShowId"); + + migrationBuilder.CreateIndex( + name: "IX_ProviderContacts_ProviderId", + table: "ProviderContacts", + column: "ProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Providers_ProviderTypeId", + table: "Providers", + column: "ProviderTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseProducts_PurchaseOrderId", + table: "PurchaseProducts", + column: "PurchaseOrderId"); + + migrationBuilder.CreateIndex( + name: "IX_QuotationProducts_QuotationId", + table: "QuotationProducts", + column: "QuotationId"); + + migrationBuilder.CreateIndex( + name: "IX_Quotations_CustomerId", + table: "Quotations", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowMaterial_MaterialId", + table: "ShowMaterial", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Shows_CityId", + table: "Shows", + column: "CityId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowStaff_ShowId", + table: "ShowStaff", + column: "ShowId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowTruck_TruckId", + table: "ShowTruck", + column: "TruckId"); + + migrationBuilder.CreateIndex( + name: "IX_Sounds_SoundCategoryId", + table: "Sounds", + column: "SoundCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_SoundTimecodes_SoundId", + table: "SoundTimecodes", + column: "SoundId"); + + migrationBuilder.CreateIndex( + name: "IX_StaffAvailabilities_StaffId", + table: "StaffAvailabilities", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_StaffContacts_StaffId", + table: "StaffContacts", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_StaffHistoryOfApprovals_StaffId", + table: "StaffHistoryOfApprovals", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_WarehouseProducts_WarehouseId", + table: "WarehouseProducts", + column: "WarehouseId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Brands"); + + migrationBuilder.DropTable( + name: "Communications"); + + migrationBuilder.DropTable( + name: "ContactServiceProvider"); + + migrationBuilder.DropTable( + name: "Contract"); + + migrationBuilder.DropTable( + name: "ExperienceLevels"); + + migrationBuilder.DropTable( + name: "MaterialWarehouse"); + + migrationBuilder.DropTable( + name: "Prices"); + + migrationBuilder.DropTable( + name: "ProductColors"); + + migrationBuilder.DropTable( + name: "ProductDeliveries"); + + migrationBuilder.DropTable( + name: "ProductEffects"); + + migrationBuilder.DropTable( + name: "ProductTimecode"); + + migrationBuilder.DropTable( + name: "ProviderContacts"); + + migrationBuilder.DropTable( + name: "PurchaseProducts"); + + migrationBuilder.DropTable( + name: "QuotationProducts"); + + migrationBuilder.DropTable( + name: "Settings"); + + migrationBuilder.DropTable( + name: "ShowMaterial"); + + migrationBuilder.DropTable( + name: "ShowStaff"); + + migrationBuilder.DropTable( + name: "ShowTruck"); + + migrationBuilder.DropTable( + name: "SoundTimecodes"); + + migrationBuilder.DropTable( + name: "StaffAvailabilities"); + + migrationBuilder.DropTable( + name: "StaffContacts"); + + migrationBuilder.DropTable( + name: "StaffHistoryOfApprovals"); + + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DropTable( + name: "WarehouseProducts"); + + migrationBuilder.DropTable( + name: "Suppliers"); + + migrationBuilder.DropTable( + name: "Colors"); + + migrationBuilder.DropTable( + name: "DeliveryNotes"); + + migrationBuilder.DropTable( + name: "Effects"); + + migrationBuilder.DropTable( + name: "Providers"); + + migrationBuilder.DropTable( + name: "PurchaseOrders"); + + migrationBuilder.DropTable( + name: "Quotations"); + + migrationBuilder.DropTable( + name: "Materials"); + + migrationBuilder.DropTable( + name: "Trucks"); + + migrationBuilder.DropTable( + name: "Shows"); + + migrationBuilder.DropTable( + name: "Sounds"); + + migrationBuilder.DropTable( + name: "Availabilities"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "HistoryOfApprovals"); + + migrationBuilder.DropTable( + name: "Staffs"); + + migrationBuilder.DropTable( + name: "Products"); + + migrationBuilder.DropTable( + name: "Deliverers"); + + migrationBuilder.DropTable( + name: "ProviderTypes"); + + migrationBuilder.DropTable( + name: "City"); + + migrationBuilder.DropTable( + name: "SoundCategories"); + + migrationBuilder.DropTable( + name: "Customers"); + + migrationBuilder.DropTable( + name: "Classifications"); + + migrationBuilder.DropTable( + name: "Movements"); + + migrationBuilder.DropTable( + name: "ProductCategories"); + + migrationBuilder.DropTable( + name: "CustomerTypes"); + + migrationBuilder.DropTable( + name: "Warehouses"); + } + } +} diff --git a/PyroFetes/Models/.idea/.gitignore b/PyroFetes/Models/.idea/.gitignore new file mode 100644 index 0000000..516c578 --- /dev/null +++ b/PyroFetes/Models/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.Models.iml +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/PyroFetes/Models/.idea/encodings.xml b/PyroFetes/Models/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/PyroFetes/Models/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PyroFetes/Models/.idea/indexLayout.xml b/PyroFetes/Models/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/PyroFetes/Models/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PyroFetes/Properties/launchSettings.json b/PyroFetes/Properties/launchSettings.json new file mode 100644 index 0000000..6c4b984 --- /dev/null +++ b/PyroFetes/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:60777", + "sslPort": 44379 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5298", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7219;http://localhost:5298", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/PyroFetes/PyroFetes.csproj b/PyroFetes/PyroFetes.csproj new file mode 100644 index 0000000..c662ac6 --- /dev/null +++ b/PyroFetes/PyroFetes.csproj @@ -0,0 +1,22 @@ + + + + net8.0 + enable + enable + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + diff --git a/PyroFetes/appsettings.Development.json b/PyroFetes/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/PyroFetes/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/PyroFetes/appsettings.json b/PyroFetes/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/PyroFetes/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..445adac --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# Gestionnaire de Stocks et Commandes + +Cette application web permet de **suivre les stocks**, **automatiser les commandes fournisseurs** et **gérer le cycle complet d’approvisionnement**. +Elle est conçue pour simplifier le travail des entreprises en offrant une vue en temps réel sur les produits, leurs fournisseurs et l’état des livraisons. + +--- + +## ✨ Fonctionnalités principales + +### 1️⃣ Suivi et réapprovisionnement des stocks +- Définissez un **niveau minimal de stock** pour chaque produit. +- Surveillez les **niveaux en temps réel** grâce à une interface claire. +- Lorsqu’un produit atteint ou descend sous son seuil minimal, le système **génère automatiquement un bon de commande** pour le réapprovisionner. + +### 2️⃣ Gestion des fournisseurs +- Enregistrez les informations complètes des fournisseurs : nom, adresse, coordonnées, produits fournis, délais de livraison. +- **Associez un ou plusieurs fournisseurs** à chaque produit. +- Lorsqu’un bon de commande est créé, le système **propose automatiquement les fournisseurs appropriés**. + +### 3️⃣ Devis et bons de commande +- Créez des **devis personnalisés** : sélection des produits, quantités, prix, ajout d’un logo, message ou conditions de vente. +- **Imprimez ou exportez** vos devis au format PDF. +- Générez des **bons de commande** en quelques clics, avec personnalisation (logo, conditions d’achat) et exportation en PDF. + +### 4️⃣ Suivi des livraisons +- **Transformez un bon de commande en bon de livraison** dès l’expédition des produits par le fournisseur. +- Enregistrez toutes les informations importantes : date d’expédition, transporteur, numéro de suivi, date prévue et date effective de livraison. +- Recevez des **alertes en cas de retard**. +- Gérez la **réception des produits** et vérifiez leur conformité. + +--- + +## 🗂️ Livrables prévus +- **Modèle de données** : diagramme de classes commun à tous les groupes. +- **Interface utilisateur** : maquettes ou prototypes interactifs. +- **Code source commenté** pour une meilleure compréhension. +- **Documentation technique** : description des fonctionnalités, architecture de l’application et API. + +--- + +## 👥 Équipe +- **Mathys** +- **Enzo** +- **Cristiano** +- **Arsène** + +--- + +## 🚀 Objectif +Fournir un outil complet pour automatiser la gestion des stocks et des commandes, réduisant les erreurs humaines, améliorant le suivi des livraisons et facilitant la communication avec les fournisseurs. \ No newline at end of file From 91b4aca2fa6f444cf607d7483a098893443a6245 Mon Sep 17 00:00:00 2001 From: oistig Date: Thu, 9 Oct 2025 17:17:42 +0200 Subject: [PATCH 5/7] 17:17 09/10 --- PyroFetes/DTO/Brand/Request/CreateBrandDto.cs | 2 +- PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs | 2 +- PyroFetes/DTO/Brand/Response/GetBrandDto.cs | 2 +- .../Request/CreateClassificationDto.cs | 2 +- .../Request/UpdateClassificationDto.cs | 2 +- .../Response/GetClassificationDto.cs | 2 +- PyroFetes/DTO/Color/Request/CreateColorDto.cs | 2 +- PyroFetes/DTO/Color/Request/UpdateColorDto.cs | 2 +- PyroFetes/DTO/Color/Response/GetColorDto.cs | 2 +- .../DTO/Effect/Request/CreateEffectDto.cs | 2 +- .../DTO/Effect/Request/UpdateEffectDto.cs | 2 +- PyroFetes/DTO/Effect/Response/GetEffectDto.cs | 2 +- .../DTO/Material/Request/CreateMaterialDto.cs | 2 +- .../DTO/Material/Request/UpdateMaterialDto.cs | 2 +- .../DTO/Material/Response/GetMaterialDto.cs | 2 +- .../DTO/Product/Request/CreateProductDto.cs | 41 ++++--- .../DTO/Product/Request/UpdateProductDto.cs | 41 ++++--- .../DTO/Product/Response/GetProductDto.cs | 46 ++++---- .../Request/ProductSupplierPriceDto.cs | 10 ++ .../Response/GetProductSupplierDto.cs | 11 ++ .../Request/ProductWarehouseDto.cs | 17 +++ .../Response/GetProductWarehouseDto.cs | 11 ++ .../DTO/Supplier/Request/CreateSupplierDto.cs | 11 +- .../DTO/Supplier/Request/UpdateSupplierDto.cs | 4 +- .../DTO/Supplier/Response/GetSupplierDto.cs | 14 ++- .../Warehouse/Request/CreateWarehouseDto.cs | 17 ++- .../Warehouse/Request/UpdateWarehouseDto.cs | 20 +++- .../DTO/Warehouse/Response/GetWarehouseDto.cs | 21 +++- .../Endpoints/Brand/CreateBrandEndpoint.cs | 4 +- .../Endpoints/Brand/GetAllBrandsEndpoint.cs | 2 +- PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs | 2 +- .../Endpoints/Brand/UpdateBrandEndpoint.cs | 6 +- .../CreateClassificationEndpoint.cs | 4 +- .../GetAllClassificationsEndpoint.cs | 2 +- .../GetClassificationEndpoint.cs | 2 +- .../UpdateClassificationEndpoint.cs | 6 +- .../Endpoints/Color/CreateColorEndpoint.cs | 12 +- .../Endpoints/Color/DeleteColorEndpoint.cs | 10 +- .../Endpoints/Color/GetAllColorsEndpoint.cs | 8 +- PyroFetes/Endpoints/Color/GetColorEndpoint.cs | 11 +- .../Endpoints/Color/UpdateColorEndpoint.cs | 15 ++- .../Endpoints/Effect/CreateEffectEndpoint.cs | 14 +-- .../Endpoints/Effect/DeleteEffectEndpoint.cs | 10 +- .../Endpoints/Effect/GetAllEffectsEndpoint.cs | 8 +- .../Endpoints/Effect/GetEffectEndpoint.cs | 11 +- .../Endpoints/Effect/UpdateEffectEndpoint.cs | 15 ++- .../Material/CreateMaterialEndpoint.cs | 21 ++-- .../Material/DeleteMaterialEndpoint.cs | 10 +- .../Material/GetAllMaterialsEndpoint.cs | 10 +- .../Endpoints/Material/GetMaterialEndpoint.cs | 11 +- .../Material/UpdateMaterialEndpoint.cs | 17 ++- .../Movement/UpdateMovementEndpoint.cs | 2 +- .../Product/CreateProductEndpoint.cs | 75 ++++++++++-- .../Product/DeleteProductEndpoint.cs | 38 ++++-- .../Product/GetAllProductsEndpoint.cs | 71 ++++++++---- .../Endpoints/Product/GetProductEndpoint.cs | 46 +++++--- .../Product/UpdateProductEndpoint.cs | 109 ++++++++++++++---- .../Supplier/CreateSupplierEndpoint.cs | 38 ++++-- .../Supplier/DeleteSupplierEndpoint.cs | 20 +++- .../Supplier/GetAllSupplierEndpoint.cs | 38 +++--- .../Endpoints/Supplier/GetSupplierEndpoint.cs | 23 ++-- .../Supplier/UpdateSupplierEndpoint.cs | 40 +++++-- .../Warehouse/CreateWarehouseEndpoint.cs | 34 ++++-- .../Warehouse/DeleteWarehouseEndpoint.cs | 27 ++++- .../Warehouse/GetAllWarehouseEndpoint.cs | 41 ++++--- .../Warehouse/GetWarehouseEndpoint.cs | 25 ++-- .../Warehouse/UpdateWarehouseEndpoint.cs | 50 ++++++-- PyroFetes/Models/Availability.cs | 2 - PyroFetes/Models/Brand.cs | 4 +- PyroFetes/Models/City.cs | 2 - PyroFetes/Models/Classification.cs | 2 - PyroFetes/Models/Color.cs | 2 - PyroFetes/Models/Communication.cs | 2 - PyroFetes/Models/Contact.cs | 3 - PyroFetes/Models/Material.cs | 2 +- PyroFetes/PyroFetes.csproj | 2 +- 76 files changed, 815 insertions(+), 388 deletions(-) create mode 100644 PyroFetes/DTO/ProductSupplierPrice/Request/ProductSupplierPriceDto.cs create mode 100644 PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs create mode 100644 PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs create mode 100644 PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs diff --git a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs index 4d5e3f0..bf455c5 100644 --- a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs +++ b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Brand.Request; +namespace API.DTO.Brand.Request; public class CreateBrandDto { diff --git a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs index c111b09..4773281 100644 --- a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs +++ b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Brand.Request; +namespace API.DTO.Brand.Request; public class UpdateBrandDto { diff --git a/PyroFetes/DTO/Brand/Response/GetBrandDto.cs b/PyroFetes/DTO/Brand/Response/GetBrandDto.cs index e57228f..4e12c35 100644 --- a/PyroFetes/DTO/Brand/Response/GetBrandDto.cs +++ b/PyroFetes/DTO/Brand/Response/GetBrandDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Brand.Response; +namespace API.DTO.Brand.Response; public class GetBrandDto { diff --git a/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs b/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs index dfa6238..a351241 100644 --- a/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs +++ b/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Classification.Request; +namespace API.DTO.Classification.Request; public class CreateClassificationDto { diff --git a/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs b/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs index 2cc2b8d..2ecc0a6 100644 --- a/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs +++ b/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Classification.Request; +namespace API.DTO.Classification.Request; public class UpdateClassificationDto { diff --git a/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs b/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs index e7a1cae..f86f615 100644 --- a/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs +++ b/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Classification.Response; +namespace API.DTO.Classification.Response; public class GetClassificationDto { diff --git a/PyroFetes/DTO/Color/Request/CreateColorDto.cs b/PyroFetes/DTO/Color/Request/CreateColorDto.cs index 43b1851..943d708 100644 --- a/PyroFetes/DTO/Color/Request/CreateColorDto.cs +++ b/PyroFetes/DTO/Color/Request/CreateColorDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Color.Request; +namespace API.DTO.Color.Request; public class CreateColorDto { diff --git a/PyroFetes/DTO/Color/Request/UpdateColorDto.cs b/PyroFetes/DTO/Color/Request/UpdateColorDto.cs index 3838a49..3a3b3c5 100644 --- a/PyroFetes/DTO/Color/Request/UpdateColorDto.cs +++ b/PyroFetes/DTO/Color/Request/UpdateColorDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Color.Request; +namespace API.DTO.Color.Request; public class UpdateColorDto { diff --git a/PyroFetes/DTO/Color/Response/GetColorDto.cs b/PyroFetes/DTO/Color/Response/GetColorDto.cs index d53c0fc..61b49ac 100644 --- a/PyroFetes/DTO/Color/Response/GetColorDto.cs +++ b/PyroFetes/DTO/Color/Response/GetColorDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Color.Response; +namespace API.DTO.Color.Response; public class GetColorDto { diff --git a/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs b/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs index cb6f630..43621e6 100644 --- a/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs +++ b/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Effect.Request; +namespace API.DTO.Effect.Request; public class CreateEffectDto { diff --git a/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs b/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs index 004a0c5..40a2957 100644 --- a/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs +++ b/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Effect.Request; +namespace API.DTO.Effect.Request; public class UpdateEffectDto { diff --git a/PyroFetes/DTO/Effect/Response/GetEffectDto.cs b/PyroFetes/DTO/Effect/Response/GetEffectDto.cs index 1708fc6..d37051d 100644 --- a/PyroFetes/DTO/Effect/Response/GetEffectDto.cs +++ b/PyroFetes/DTO/Effect/Response/GetEffectDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Effect.Response; +namespace API.DTO.Effect.Response; public class GetEffectDto { diff --git a/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs b/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs index 54fecd5..4806b90 100644 --- a/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs +++ b/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Material.Request; +namespace API.DTO.Material.Request; public class CreateMaterialDto { diff --git a/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs b/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs index e462751..73b9ffd 100644 --- a/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs +++ b/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Material.Request; +namespace API.DTO.Material.Request; public class UpdateMaterialDto { diff --git a/PyroFetes/DTO/Material/Response/GetMaterialDto.cs b/PyroFetes/DTO/Material/Response/GetMaterialDto.cs index bad4c77..a74e2b6 100644 --- a/PyroFetes/DTO/Material/Response/GetMaterialDto.cs +++ b/PyroFetes/DTO/Material/Response/GetMaterialDto.cs @@ -1,4 +1,4 @@ -namespace PyroFetes.DTO.Material.Response; +namespace API.DTO.Material.Response; public class GetMaterialDto { diff --git a/PyroFetes/DTO/Product/Request/CreateProductDto.cs b/PyroFetes/DTO/Product/Request/CreateProductDto.cs index a704c38..542ac42 100644 --- a/PyroFetes/DTO/Product/Request/CreateProductDto.cs +++ b/PyroFetes/DTO/Product/Request/CreateProductDto.cs @@ -1,21 +1,26 @@ -using PyroFetes.Models; +using PyroFetes.DTO.Product.Request; -namespace PyroFetes.DTO.Product.Request; - -public class CreateProductDto +namespace PyroFetes.DTO.Product.Request { - public int References { get; set; } - public string? Name { 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 ClassificationId { get; set;} - public int ProductCategoryId { get; set; } - + public class CreateProductDto + { + public int References { get; set; } + public string? Name { 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 ClassificationId { get; set;} + public int ProductCategoryId { get; set; } + + // Liste des fournisseurs liés au produit + public List? Suppliers { get; set; } + + // Liste des entrepôts liés au produit + public List? Warehouses { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Request/UpdateProductDto.cs b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs index 1bc96a4..59ab8e5 100644 --- a/PyroFetes/DTO/Product/Request/UpdateProductDto.cs +++ b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs @@ -1,20 +1,27 @@ -using PyroFetes.Models; +using PyroFetes.DTO.Product.Request; -namespace PyroFetes.DTO.Product.Request; - -public class UpdateProductDto +namespace PyroFetes.DTO.Product.Request { - public int Id { get; set; } - public int Reference { get; set; } - public string? Name { 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 ClassificationId { get; set;} - public int ProductCategoryId { get; set; } + public class UpdateProductDto + { + public int Id { get; set; } + public int References { get; set; } + public string? Name { 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 ClassificationId { get; set; } + public int ProductCategoryId { get; set; } + + // Liste des fournisseurs associés + public List Suppliers { get; set; } = new(); + + // Liste des entrepôts associés + public List Warehouses { get; set; } = new(); + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Response/GetProductDto.cs b/PyroFetes/DTO/Product/Response/GetProductDto.cs index dbfed6a..48763bf 100644 --- a/PyroFetes/DTO/Product/Response/GetProductDto.cs +++ b/PyroFetes/DTO/Product/Response/GetProductDto.cs @@ -1,23 +1,29 @@ -using PyroFetes.Models; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; -namespace PyroFetes.DTO.Product.Response; - -public class GetProductDto +namespace PyroFetes.DTO.Product.Response { - public int Id { get; set; } - public int Reference { get; set; } - public string? Name { 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 ClassificationId { get; set;} - public string? ClassificationLabel { get; set; } - public int ProductCategoryId { get; set; } - public string? ProductCategoryLabel { get; set; } - + public class GetProductDto + { + public int Id { get; set; } + public int Reference { get; set; } + public string? Name { 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 ClassificationId { get; set; } + public int ProductCategoryId { get; set; } + + // Fournisseurs liés + public List Suppliers { get; set; } = new(); + + // Entrepôts liés + public List Warehouses { get; set; } = new(); + } } \ No newline at end of file diff --git a/PyroFetes/DTO/ProductSupplierPrice/Request/ProductSupplierPriceDto.cs b/PyroFetes/DTO/ProductSupplierPrice/Request/ProductSupplierPriceDto.cs new file mode 100644 index 0000000..f48ba0a --- /dev/null +++ b/PyroFetes/DTO/ProductSupplierPrice/Request/ProductSupplierPriceDto.cs @@ -0,0 +1,10 @@ +namespace PyroFetes.DTO.Product.Request +{ + // DTO utilisé pour créer ou mettre à jour la relation Product <-> Supplier + public class ProductSupplierPriceDto + { + public int ProductId { get; set; } // Id du produit (pour update) + public int SupplierId { get; set; } // Id du fournisseur + public decimal SellingPrice { get; set; } // Prix de vente + } +} diff --git a/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs b/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs new file mode 100644 index 0000000..a423279 --- /dev/null +++ b/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs @@ -0,0 +1,11 @@ +namespace PyroFetes.DTO.Product.Response +{ +// DTO pour la lecture des fournisseurs liés à un produit +public class GetProductSupplierDto +{ + public int ProductId { get; set; } + public int SupplierId { get; set; } + public string SupplierName { get; set; } = string.Empty; + public decimal SellingPrice { get; set; } +} +} diff --git a/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs b/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs new file mode 100644 index 0000000..a74cab2 --- /dev/null +++ b/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs @@ -0,0 +1,17 @@ +namespace PyroFetes.DTO.Product.Request +{ + // DTO utilisé pour créer ou mettre à jour la relation Product <-> Warehouse + public class CreateProductWarehouseDto + { + public int WarehouseId { get; set; } + public int ProductId { get; set; } + public int Quantity { get; set; } + } + + public class UpdateProductWarehouseDto + { + public int WarehouseId { get; set; } + public int ProductId { get; set; } + public int Quantity { get; set; } + } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs b/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs new file mode 100644 index 0000000..40a28fb --- /dev/null +++ b/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs @@ -0,0 +1,11 @@ +namespace PyroFetes.DTO.Product.Response +{ + // DTO pour la lecture des entrepôts liés à un produit + public class GetProductWarehouseDto + { + public int WarehouseId { get; set; } + public int ProductId { get; set; } + public string WarehouseName { get; set; } = string.Empty; + public int Quantity { get; set; } + } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs b/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs index 25a94a4..9395f20 100644 --- a/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs +++ b/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs @@ -1,4 +1,4 @@ -namespace API.DTO.Supplier.Request; +namespace PyroFetes.DTO.Supplier.Request; public class CreateSupplierDto { @@ -8,4 +8,13 @@ public class CreateSupplierDto public string Adress { get; set; } public int ZipCode { get; set; } public string City { get; set; } + + // Produits que ce fournisseur fournit + public List? Products { get; set; } +} + +public class SupplierProductPriceDto +{ + public int ProductId { get; set; } + public decimal SellingPrice { get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs b/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs index 20ae5f0..f71d406 100644 --- a/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs +++ b/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs @@ -1,4 +1,4 @@ -namespace API.DTO.Supplier.Request; +namespace PyroFetes.DTO.Supplier.Request; public class UpdateSupplierDto { @@ -9,4 +9,6 @@ public class UpdateSupplierDto public string Adress { get; set; } public int ZipCode { get; set; } public string City { get; set; } + + public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs b/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs index ddc2365..ba2237c 100644 --- a/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs +++ b/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs @@ -1,4 +1,6 @@ -namespace API.DTO.Supplier.Response; +using PyroFetes.DTO.Supplier.Request; + +namespace PyroFetes.DTO.Supplier.Response; public class GetSupplierDto { @@ -9,4 +11,14 @@ public class GetSupplierDto public string Adress { get; set; } public int ZipCode { get; set; } public string City { get; set; } + + // Liste des produits liés avec leur prix fournisseur + public List Products { get; set; } +} + +public class GetSupplierProductDto +{ + public int ProductId { get; set; } + public string ProductName { get; set; } = string.Empty; + public decimal SellingPrice { get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs index 9f2e7cb..36563c2 100644 --- a/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs +++ b/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs @@ -2,11 +2,20 @@ 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 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; } + + // Liste des produits à stocker dans cet entrepôt + public List? Products { get; set; } } + +public class CreateWarehouseProductDto +{ + public int ProductId { get; set; } + public int Quantity { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs index a154737..3e843d5 100644 --- a/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs +++ b/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs @@ -1,13 +1,21 @@ -namespace API.DTO.Warehouse.Request; +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 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; } + + public List? Products { get; set; } +} + +public class UpdateWarehouseProductDto +{ + public int ProductId { get; set; } + public int Quantity { get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs index 77df53c..3af0328 100644 --- a/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs +++ b/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs @@ -1,13 +1,22 @@ -namespace API.DTO.Warehouse.Response; +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 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; } + + public List? Products { get; set; } +} + +public class WarehouseProductDto +{ + public int ProductId { get; set; } + public string? ProductName { get; set; } + public int Quantity { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs index 265abc6..19756c9 100644 --- a/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs +++ b/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs @@ -1,5 +1,5 @@ -using PyroFetes.DTO.Brand.Request; -using PyroFetes.DTO.Brand.Response; +using API.DTO.Brand.Request; +using API.DTO.Brand.Response; using FastEndpoints; namespace PyroFetes.Endpoints.Brand; diff --git a/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs b/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs index c4995ae..2f7be29 100644 --- a/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs +++ b/PyroFetes/Endpoints/Brand/GetAllBrandsEndpoint.cs @@ -1,4 +1,4 @@ -using PyroFetes.DTO.Brand.Response; +using API.DTO.Brand.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; diff --git a/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs index 86d7da9..0e8dc22 100644 --- a/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs +++ b/PyroFetes/Endpoints/Brand/GetBrandEndpoint.cs @@ -1,4 +1,4 @@ -using PyroFetes.DTO.Brand.Response; +using API.DTO.Brand.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; diff --git a/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs index 652291c..2db66ce 100644 --- a/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs +++ b/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs @@ -1,5 +1,5 @@ -using PyroFetes.DTO.Brand.Request; -using PyroFetes.DTO.Brand.Response; +using API.DTO.Brand.Request; +using API.DTO.Brand.Response; using FastEndpoints; namespace PyroFetes.Endpoints.Brand; @@ -8,7 +8,7 @@ public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi { public override void Configure() { - Post("/api/brands"); + Put("/api/brands"); AllowAnonymous(); } diff --git a/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs index bc7ed9e..34184dc 100644 --- a/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs +++ b/PyroFetes/Endpoints/Classification/CreateClassificationEndpoint.cs @@ -1,5 +1,5 @@ -using PyroFetes.DTO.Classification.Request; -using PyroFetes.DTO.Classification.Response; +using API.DTO.Classification.Request; +using API.DTO.Classification.Response; using FastEndpoints; namespace PyroFetes.Endpoints.Classification; diff --git a/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs b/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs index 7513e7e..b96ab3a 100644 --- a/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs +++ b/PyroFetes/Endpoints/Classification/GetAllClassificationsEndpoint.cs @@ -1,4 +1,4 @@ -using PyroFetes.DTO.Classification.Response; +using API.DTO.Classification.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; diff --git a/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs index a972863..fd7dafd 100644 --- a/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs +++ b/PyroFetes/Endpoints/Classification/GetClassificationEndpoint.cs @@ -1,4 +1,4 @@ -using PyroFetes.DTO.Classification.Response; +using API.DTO.Classification.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; diff --git a/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs b/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs index cee10d3..8569cc7 100644 --- a/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs +++ b/PyroFetes/Endpoints/Classification/UpdateClassificationEndpoint.cs @@ -1,5 +1,5 @@ -using PyroFetes.DTO.Classification.Request; -using PyroFetes.DTO.Classification.Response; +using API.DTO.Classification.Request; +using API.DTO.Classification.Response; using FastEndpoints; namespace PyroFetes.Endpoints.Classification; @@ -8,7 +8,7 @@ public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) { public override void Configure() { - Post("/api/classifications"); + Put("/api/classifications"); AllowAnonymous(); } diff --git a/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs b/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs index e926e52..4573468 100644 --- a/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs +++ b/PyroFetes/Endpoints/Color/CreateColorEndpoint.cs @@ -1,14 +1,14 @@ -using PyroFetes.DTO.Color.Request; -using PyroFetes.DTO.Color.Response; +using API.DTO.Color.Request; +using API.DTO.Color.Response; using FastEndpoints; namespace PyroFetes.Endpoints.Color; -public class CreateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class CreateColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Post("/api/color/create"); + Post("/color/create"); AllowAnonymous(); } @@ -19,8 +19,8 @@ public class CreateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class DeleteColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Delete("/api/colors/{@id}", x => new { x.Id }); + Delete("/colors/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(DeleteColorRequest req, CancellationToken ct) { - Models.Color? colorToDelete = await appDbContext + Models.Color? colorToDelete = await pyrofetesdbcontext .Colors .SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct); @@ -29,8 +29,8 @@ public class DeleteColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint> +public class GetAllColorsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> { public override void Configure() { - Get("/api/colors"); + Get("/colors"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { - List responseDto = await appDbContext.Colors + List responseDto = await pyrofetesdbcontext.Colors .Select(a => new GetColorDto { Id = a.Id, diff --git a/PyroFetes/Endpoints/Color/GetColorEndpoint.cs b/PyroFetes/Endpoints/Color/GetColorEndpoint.cs index ad29958..dcacb8a 100644 --- a/PyroFetes/Endpoints/Color/GetColorEndpoint.cs +++ b/PyroFetes/Endpoints/Color/GetColorEndpoint.cs @@ -1,6 +1,5 @@ -using PyroFetes.DTO.Color.Response; +using API.DTO.Color.Response; using FastEndpoints; -using Microsoft.AspNetCore.Authentication; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Color; @@ -10,23 +9,23 @@ public class GetColorRequest public int Id { get; set; } } -public class GetColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class GetColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Get("/api/colors/{@id}", x => new { x.Id}); + Get("/colors/{@id}", x => new { x.Id}); AllowAnonymous(); } public override async Task HandleAsync(GetColorRequest req, CancellationToken ct) { - Models.Color? color = await appDbContext + Models.Color? color = await pyrofetesdbcontext .Colors .SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); if (color == null) { - Console.WriteLine($"Aucune couleur avec l'ID {req.Id} trouvé."); + Console.WriteLine("Aucune couleur avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } diff --git a/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs b/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs index 43c9ee9..b05c896 100644 --- a/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs +++ b/PyroFetes/Endpoints/Color/UpdateColorEndpoint.cs @@ -1,34 +1,33 @@ -using PyroFetes.DTO.Color.Request; -using PyroFetes.DTO.Color.Response; +using API.DTO.Color.Request; +using API.DTO.Color.Response; using FastEndpoints; -using Microsoft.AspNetCore.Server.Kestrel; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Color; -public class UpdateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class UpdateColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Put("/api/colors/{@id}", x => new { x.Id }); + Put("/colors/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(UpdateColorDto req, CancellationToken ct) { - Models.Color? colorToEdit = await appDbContext + Models.Color? colorToEdit = await pyrofetesdbcontext .Colors .SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); if (colorToEdit == null) { - Console.WriteLine($"Aucune couleur avec l'id {req.Id} trouvé."); + Console.WriteLine("Aucune couleur avec l'id {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } colorToEdit.Label = req.Label; - await appDbContext.SaveChangesAsync(ct); + await pyrofetesdbcontext.SaveChangesAsync(ct); GetColorDto responseDto = new() { diff --git a/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs index 1e6aafa..1663ef3 100644 --- a/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs +++ b/PyroFetes/Endpoints/Effect/CreateEffectEndpoint.cs @@ -1,14 +1,14 @@ -using PyroFetes.DTO.Effect.Request; -using PyroFetes.DTO.Effect.Response; - +using API.DTO.Effect.Request; +using API.DTO.Effect.Response; using FastEndpoints; + namespace PyroFetes.Endpoints.Effect; -public class CreateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class CreateEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Post("/api/effect/create"); + Post("/effect/create"); AllowAnonymous(); } @@ -19,8 +19,8 @@ public class CreateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class DeleteEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Delete("/api/effects/{@id}", x => new { x.Id }); + Delete("/effects/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(DeleteEffectRequest req, CancellationToken ct) { - Models.Effect? effectToDelete = await appDbContext + Models.Effect? effectToDelete = await pyrofetesdbcontext .Effects .SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct); @@ -28,8 +28,8 @@ public class DeleteEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint> +public class GetAllEffectsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> { public override void Configure() { - Get("/api/effects"); + Get("/effects"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { - List responseDto = await appDbContext.Effects + List responseDto = await pyrofetesdbcontext.Effects .Select(a => new GetEffectDto { Id = a.Id, diff --git a/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs index 2465755..cd2a91d 100644 --- a/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs +++ b/PyroFetes/Endpoints/Effect/GetEffectEndpoint.cs @@ -1,6 +1,5 @@ -using PyroFetes.DTO.Effect.Response; +using API.DTO.Effect.Response; using FastEndpoints; -using Microsoft.AspNetCore.Authentication; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Effect; @@ -10,23 +9,23 @@ public class GetEffectRequest public int Id { get; set; } } -public class GetEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class GetEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Get("/api/effect/{@id}", x => new { x.Id }); + Get("/effect/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(GetEffectRequest req, CancellationToken ct) { - Models.Effect? effect = await appDbContext + Models.Effect? effect = await pyrofetesdbcontext .Effects .SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); if (effect == null) { - Console.WriteLine($"Aucun effet avec l'ID {req.Id} trouvé."); + Console.WriteLine("Aucun effet avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } diff --git a/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs b/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs index 1ff9417..ac5bffe 100644 --- a/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs +++ b/PyroFetes/Endpoints/Effect/UpdateEffectEndpoint.cs @@ -1,34 +1,33 @@ -using PyroFetes.DTO.Effect.Request; -using PyroFetes.DTO.Effect.Response; +using API.DTO.Effect.Request; +using API.DTO.Effect.Response; using FastEndpoints; -using Microsoft.AspNetCore.Server.Kestrel; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Effect; -public class UpdateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class UpdateEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Put("/api/effect/{@id}", x => new { x.Id }); + Put("/effect/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(UpdateEffectDto req, CancellationToken ct) { - Models.Effect? effectToEdit = await appDbContext + Models.Effect? effectToEdit = await pyrofetesdbcontext .Effects .SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); if (effectToEdit == null) { - Console.WriteLine($"Aucun effet avec l'id {req.Id} trouvé."); + Console.WriteLine("Aucun effet avec l'id {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } effectToEdit.Label = req.Label; - await appDbContext.SaveChangesAsync(ct); + await pyrofetesdbcontext.SaveChangesAsync(ct); GetEffectDto responseDto = new() { diff --git a/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs index cdb8ab2..545b96d 100644 --- a/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs +++ b/PyroFetes/Endpoints/Material/CreateMaterialEndpoint.cs @@ -1,33 +1,34 @@ -using PyroFetes.DTO.Material.Request; -using PyroFetes.DTO.Material.Response; +using API.DTO.Material.Request; +using API.DTO.Material.Response; using FastEndpoints; + namespace PyroFetes.Endpoints.Material; -public class CreateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class CreateMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Post("/api/material/create"); + Post("/material/create"); AllowAnonymous(); } public override async Task HandleAsync(CreateMaterialDto req, CancellationToken ct) { - Models.Material material = new() + Models.Material quantity = new() { - Label = req.Label, + Name = req.Label, Quantity = req.Quantity, WarehouseId = req.WarehouseId, }; - appDbContext.Materials.Add(material); - await appDbContext.SaveChangesAsync(ct); + pyrofetesdbcontext.Materials.Add(quantity); + await pyrofetesdbcontext.SaveChangesAsync(ct); Console.WriteLine("Material added"); GetMaterialDto responseDto = new() { - Id = material.Id, - WarehouseId = material.WarehouseId, + Id = quantity.Id, + WarehouseId = quantity.WarehouseId, Label = req.Label, }; diff --git a/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs index 6912a26..6fbdd46 100644 --- a/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs +++ b/PyroFetes/Endpoints/Material/DeleteMaterialEndpoint.cs @@ -6,17 +6,17 @@ public class DeleteMaterialRequest { public int Id { get; set; } } -public class DeleteMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class DeleteMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Delete("/api/materials/{@id}", x => new { x.Id }); + Delete("/materials/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(DeleteMaterialRequest req, CancellationToken ct) { - Models.Material? materialToDelete = await appDbContext + Models.Material? materialToDelete = await pyrofetesdbcontext .Materials .SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct); @@ -27,8 +27,8 @@ public class DeleteMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint< return; } - appDbContext.Materials.Remove(materialToDelete); - await appDbContext.SaveChangesAsync(ct); + pyrofetesdbcontext.Materials.Remove(materialToDelete); + await pyrofetesdbcontext.SaveChangesAsync(ct); await Send.NoContentAsync(ct); } diff --git a/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs b/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs index a809711..9f6416b 100644 --- a/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs +++ b/PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint.cs @@ -1,24 +1,24 @@ -using PyroFetes.DTO.Material.Response; +using API.DTO.Material.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Material; -public class GetAllMaterialsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest> +public class GetAllMaterialsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> { public override void Configure() { - Get("/api/material"); + Get("/material"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { - List responseDto = await appDbContext.Materials + List responseDto = await pyrofetesdbcontext.Materials .Select(a => new GetMaterialDto { Id = a.Id, - Label = a.Label, + Label = a.Name, Quantity = a.Quantity, WarehouseId = a.WarehouseId, } diff --git a/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs b/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs index 7860ab8..2f60a18 100644 --- a/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs +++ b/PyroFetes/Endpoints/Material/GetMaterialEndpoint.cs @@ -1,6 +1,5 @@ -using PyroFetes.DTO.Material.Response; +using API.DTO.Material.Response; using FastEndpoints; -using Microsoft.AspNetCore.Authentication; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Material; @@ -10,17 +9,17 @@ public class GetMaterialRequest public int Id { get; set; } } -public class GetMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class GetMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Get("/api/material/{@id}", x => new { x.Id }); + Get("/material/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(GetMaterialRequest req, CancellationToken ct) { - Models.Material? material = await appDbContext + Models.Material? material = await pyrofetesdbcontext .Materials .SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); @@ -34,7 +33,7 @@ public class GetMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint +public class UpdateMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint { public override void Configure() { - Put("/api/material/{@id}", x => new { x.Id }); + Put("/material/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(UpdateMaterialDto req, CancellationToken ct) { - Models.Material? materialToEdit = await appDbContext + Models.Material? materialToEdit = await pyrofetesdbcontext .Materials .SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); if (materialToEdit == null) { - Console.WriteLine($"Aucun matériel avec l'id {req.Id} trouvé."); + Console.WriteLine("Aucun matériel avec l'id {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } - materialToEdit.Label = req.Label; + materialToEdit.Name = req.Label; materialToEdit.WarehouseId = req.WarehouseId; - await appDbContext.SaveChangesAsync(ct); + await pyrofetesdbcontext.SaveChangesAsync(ct); GetMaterialDto responseDto = new() { diff --git a/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs b/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs index 151ffc9..9e69545 100644 --- a/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs +++ b/PyroFetes/Endpoints/Movement/UpdateMovementEndpoint.cs @@ -8,7 +8,7 @@ public class UpdateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End { public override void Configure() { - Post("/api/movements"); + Put("/api/movements"); AllowAnonymous(); } diff --git a/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs b/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs index 5a30b83..5deb4fe 100644 --- a/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs @@ -1,10 +1,15 @@ -using FastEndpoints; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.Product.Request; using PyroFetes.DTO.Product.Response; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Product; -public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class CreateProductEndpoint(PyroFetesDbContext db) + : Endpoint { public override void Configure() { @@ -14,7 +19,7 @@ public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endp public override async Task HandleAsync(CreateProductDto req, CancellationToken ct) { - Models.Product product = new () + var product = new Models.Product { References = req.References, Name = req.Name!, @@ -29,13 +34,48 @@ public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endp ProductCategoryId = req.ProductCategoryId, ClassificationId = req.ClassificationId }; - - pyrofetesdbcontext.Products.Add(product); - await pyrofetesdbcontext.SaveChangesAsync(ct); - - Console.WriteLine("Product créé avec succès !"); - GetProductDto responseDto = new () + db.Products.Add(product); + await db.SaveChangesAsync(ct); + + // Ajout des fournisseurs liés + if (req.Suppliers is not null && req.Suppliers.Any()) + { + foreach (var s in req.Suppliers) + { + var price = new Price + { + ProductId = product.Id, + SupplierId = s.SupplierId, + SellingPrice = s.SellingPrice + }; + db.Prices.Add(price); + } + await db.SaveChangesAsync(ct); + } + + // Ajout des entrepôts liés + if (req.Warehouses is not null && req.Warehouses.Any()) + { + foreach (var w in req.Warehouses) + { + var exists = await db.Warehouses.AnyAsync(x => x.Id == w.WarehouseId, ct); + if (!exists) + continue; // sécurité : on ignore les warehouses inexistants + + var warehouseProduct = new WarehouseProduct + { + ProductId = product.Id, + WarehouseId = w.WarehouseId, + Quantity = w.Quantity + }; + db.WarehouseProducts.Add(warehouseProduct); + } + await db.SaveChangesAsync(ct); + } + + // Construction de la réponse + var response = new GetProductDto { Id = product.Id, Reference = req.References, @@ -49,9 +89,20 @@ public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endp Image = req.Image, Link = req.Link, ProductCategoryId = req.ProductCategoryId, - ClassificationId = req.ClassificationId + ClassificationId = req.ClassificationId, + Suppliers = req.Suppliers?.Select(s => new ProductSupplierPriceDto + { + SupplierId = s.SupplierId, + SellingPrice = s.SellingPrice + }).ToList() ?? new(), + Warehouses = req.Warehouses?.Select(w => new GetProductWarehouseDto + { + WarehouseId = w.WarehouseId, + Quantity = w.Quantity, + WarehouseName = db.Warehouses.FirstOrDefault(x => x.Id == w.WarehouseId)?.Name ?? string.Empty + }).ToList() ?? new() }; - await Send.OkAsync(responseDto, ct); + await Send.OkAsync(response, ct); } -} \ No newline at end of file +} diff --git a/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs b/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs index cf425ea..f400abe 100644 --- a/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/DeleteProductEndpoint.cs @@ -1,5 +1,6 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Product; @@ -8,29 +9,50 @@ public class DeleteProductRequest public int Id { get; set; } } -public class DeleteProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class DeleteProductEndpoint(PyroFetesDbContext db) : Endpoint { public override void Configure() { Delete("/api/products/{@id}", x => new { x.Id }); AllowAnonymous(); } - + public override async Task HandleAsync(DeleteProductRequest req, CancellationToken ct) { - Models.Product? productToDelete = await pyrofetesdbcontext - .Products - .SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct); + // Récupérer le produit + var productToDelete = await db.Products + .SingleOrDefaultAsync(p => p.Id == req.Id, ct); - if (productToDelete == null) + if (productToDelete is null) { Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } - pyrofetesdbcontext.Products.Remove(productToDelete); - await pyrofetesdbcontext.SaveChangesAsync(ct); + // Supprimer les liaisons Price + var relatedPrices = await db.Prices + .Where(p => p.ProductId == req.Id) + .ToListAsync(ct); + if (relatedPrices.Any()) + { + db.Prices.RemoveRange(relatedPrices); + } + + // Supprimer les liaisons WarehouseProduct + var relatedWarehouseProducts = await db.WarehouseProducts + .Where(wp => wp.ProductId == req.Id) + .ToListAsync(ct); + if (relatedWarehouseProducts.Any()) + { + db.WarehouseProducts.RemoveRange(relatedWarehouseProducts); + } + + // Supprimer le produit + db.Products.Remove(productToDelete); + + await db.SaveChangesAsync(ct); + Console.WriteLine($"Produit {req.Id}, ses prix et ses entrepôts liés ont été supprimés avec succès."); await Send.NoContentAsync(ct); } diff --git a/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs b/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs index ee81ef9..ee5bb08 100644 --- a/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs +++ b/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs @@ -1,10 +1,15 @@ -using FastEndpoints; -using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Request; using PyroFetes.DTO.Product.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Product; -public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +public class GetAllProductsEndpoint(PyroFetesDbContext db) + : EndpointWithoutRequest> { public override void Configure() { @@ -14,27 +19,45 @@ public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End public override async Task HandleAsync(CancellationToken ct) { - List responseDto = await pyrofetesdbcontext.Products - .Select(p => new GetProductDto() - { - Id = p.Id, - Reference = p.References, - Name = p.Name, - Duration = p.Duration, - Caliber = p.Caliber, - ApprovalNumber = p.ApprovalNumber, - Weight = p.Weight, - Nec = p.Nec, - SellingPrice = p.SellingPrice, - Image = p.Image, - Link = p.Link, - ClassificationId = p.ClassificationId, - ClassificationLabel = p.Classification!.Label, - ProductCategoryId = p.ProductCategoryId, - ProductCategoryLabel = p.ProductCategory!.Label, - } - ).ToListAsync(ct); + // Inclure toutes les relations nécessaires : Prices + WarehouseProducts + Warehouse + var products = await db.Products + .Include(p => p.Prices) + .Include(p => p.WarehouseProducts) + .ThenInclude(wp => wp.Warehouse) + .ToListAsync(ct); + + var responseDto = products.Select(p => new GetProductDto + { + Id = p.Id, + Reference = p.References, + Name = p.Name, + Duration = p.Duration, + Caliber = p.Caliber, + ApprovalNumber = p.ApprovalNumber, + Weight = p.Weight, + Nec = p.Nec, + SellingPrice = p.SellingPrice, + Image = p.Image, + Link = p.Link, + ClassificationId = p.ClassificationId, + ProductCategoryId = p.ProductCategoryId, + + // Liste des fournisseurs liés via Price + Suppliers = p.Prices.Select(pr => new ProductSupplierPriceDto + { + SupplierId = pr.SupplierId, + SellingPrice = pr.SellingPrice + }).ToList(), + + // Liste des entrepôts via WarehouseProduct + Warehouses = p.WarehouseProducts.Select(wp => new GetProductWarehouseDto + { + WarehouseId = wp.WarehouseId, + WarehouseName = wp.Warehouse?.Name ?? string.Empty, + Quantity = wp.Quantity + }).ToList() + }).ToList(); await Send.OkAsync(responseDto, ct); } -} +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Product/GetProductEndpoint.cs b/PyroFetes/Endpoints/Product/GetProductEndpoint.cs index df4b64f..695ac8e 100644 --- a/PyroFetes/Endpoints/Product/GetProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/GetProductEndpoint.cs @@ -1,6 +1,10 @@ -using FastEndpoints; -using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Request; using PyroFetes.DTO.Product.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Product; @@ -9,20 +13,23 @@ public class GetProductRequest public int Id { get; set; } } - -public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +public class GetProductEndpoint(PyroFetesDbContext db) + : Endpoint { public override void Configure() { - Get("/api/product/{@id}", x => new { x.Id }); + Get("/api/products/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(GetProductRequest req, CancellationToken ct) { - Models.Product? product = await pyrofetesdbcontext - .Products.Include(product => product.Classification).Include(product => product.ProductCategory) - .SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct); + // Inclure toutes les relations : Prices + WarehouseProducts + Warehouse + var product = await db.Products + .Include(p => p.Prices) + .Include(p => p.WarehouseProducts) + .ThenInclude(wp => wp.Warehouse) + .SingleOrDefaultAsync(p => p.Id == req.Id, ct); if (product == null) { @@ -31,7 +38,7 @@ public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint return; } - GetProductDto responseDto = new() + var responseDto = new GetProductDto { Id = product.Id, Reference = product.References, @@ -45,11 +52,24 @@ public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint Image = product.Image, Link = product.Link, ClassificationId = product.ClassificationId, - ClassificationLabel = product.Classification!.Label, - ProductCategoryId = product.ProductCategoryId, - ProductCategoryLabel = product.ProductCategory!.Label, + ProductCategoryId = product.ProductCategoryId, + + // Fournisseurs liés via Price + Suppliers = product.Prices.Select(pr => new ProductSupplierPriceDto + { + SupplierId = pr.SupplierId, + SellingPrice = pr.SellingPrice + }).ToList(), + + // Entrepôts liés via WarehouseProduct + Warehouses = product.WarehouseProducts.Select(wp => new GetProductWarehouseDto + { + WarehouseId = wp.WarehouseId, + WarehouseName = wp.Warehouse?.Name ?? string.Empty, + Quantity = wp.Quantity + }).ToList() }; await Send.OkAsync(responseDto, ct); } -} +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs b/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs index 2512e9c..2640ec9 100644 --- a/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs @@ -1,47 +1,90 @@ -using FastEndpoints; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; +using FastEndpoints; using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.Product.Request; using PyroFetes.DTO.Product.Response; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Product; -public class UpdateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint +// Endpoint permettant de mettre à jour un produit existant +public class UpdateProductEndpoint(PyroFetesDbContext db) + : Endpoint { public override void Configure() { + // Route HTTP PUT avec un paramètre d'identifiant dans l'URL Put("/api/products/{@id}", x => new { x.Id }); + + // Autorise les requêtes anonymes (sans authentification) AllowAnonymous(); } public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct) { - Models.Product? productToEdit = await pyrofetesdbcontext - .Products - .SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct); + // Recherche du produit à mettre à jour, en incluant les relations Prices et WarehouseProducts + var product = await db.Products + .Include(p => p.Prices) + .Include(p => p.WarehouseProducts) + .SingleOrDefaultAsync(p => p.Id == req.Id, ct); - if (productToEdit == null) + // Si le produit n'existe pas, on retourne une réponse 404 + if (product is null) { - Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } - productToEdit.References = req.Reference; - productToEdit.Name = req.Name; - productToEdit.Duration = req.Duration; - productToEdit.Caliber = req.Caliber; - productToEdit.ApprovalNumber = req.ApprovalNumber; - productToEdit.Weight = req.Weight; - productToEdit.Nec = req.Nec; - productToEdit.SellingPrice = req.SellingPrice; - productToEdit.Image = req.Image; - productToEdit.Link = req.Link; - await pyrofetesdbcontext.SaveChangesAsync(ct); + // Mise à jour des propriétés principales du produit + product.References = req.References; + product.Name = req.Name; + product.Duration = req.Duration; + product.Caliber = req.Caliber; + product.ApprovalNumber = req.ApprovalNumber; + product.Weight = req.Weight; + product.Nec = req.Nec; + product.SellingPrice = req.SellingPrice; + product.Image = req.Image; + product.Link = req.Link; + product.ClassificationId = req.ClassificationId; + product.ProductCategoryId = req.ProductCategoryId; - GetProductDto responseDto = new() + // Mise à jour des prix fournisseurs associés + // On supprime les anciens enregistrements pour les remplacer + db.Prices.RemoveRange(product.Prices); + foreach (var s in req.Suppliers) { - Id = req.Id, - Reference = req.Reference, + db.Prices.Add(new Price + { + ProductId = product.Id, + SupplierId = s.SupplierId, + SellingPrice = s.SellingPrice + }); + } + + // Mise à jour des entrepôts associés + // On supprime les anciens liens avant d'ajouter les nouveaux + db.WarehouseProducts.RemoveRange(product.WarehouseProducts); + foreach (var w in req.Warehouses) + { + db.WarehouseProducts.Add(new WarehouseProduct + { + ProductId = product.Id, + WarehouseId = w.WarehouseId, + Quantity = w.Quantity + }); + } + + // Sauvegarde des modifications dans la base de données + await db.SaveChangesAsync(ct); + + // Construction de la réponse renvoyée au client + // On reconstruit les listes Suppliers et Warehouses au bon format de DTO + var response = new GetProductDto + { + Id = product.Id, + Reference = req.References, Name = req.Name, Duration = req.Duration, Caliber = req.Caliber, @@ -50,9 +93,27 @@ public class UpdateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpo Nec = req.Nec, SellingPrice = req.SellingPrice, Image = req.Image, - Link = req.Link + Link = req.Link, + ClassificationId = req.ClassificationId, + ProductCategoryId = req.ProductCategoryId, + + // Mapping des fournisseurs pour la réponse + Suppliers = req.Suppliers.Select(s => new ProductSupplierPriceDto + { + SupplierId = s.SupplierId, + SellingPrice = s.SellingPrice + }).ToList(), + + // Mapping des entrepôts pour la réponse + Warehouses = req.Warehouses.Select(w => new GetProductWarehouseDto + { + WarehouseId = w.WarehouseId, + Quantity = w.Quantity, + WarehouseName = db.Warehouses.FirstOrDefault(x => x.Id == w.WarehouseId)?.Name ?? string.Empty + }).ToList() }; - await Send.OkAsync(responseDto, ct); + // Envoi de la réponse HTTP 200 avec les données du produit mis à jour + await Send.OkAsync(response, ct); } -} \ No newline at end of file +} diff --git a/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs index 761eb4a..530e1af 100644 --- a/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs +++ b/PyroFetes/Endpoints/Supplier/CreateSupplierEndpoint.cs @@ -1,10 +1,13 @@ -using API.DTO.Supplier.Request; -using API.DTO.Supplier.Response; +using PyroFetes.DTO.Supplier.Request; +using PyroFetes.DTO.Supplier.Response; using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Supplier; -public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) + : Endpoint { public override void Configure() { @@ -14,8 +17,7 @@ public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct) { - // Création d'un nouvel objet Supplier - Models.Supplier supplier = new() + var supplier = new Models.Supplier { Name = req.Name, Email = req.Email, @@ -24,15 +26,27 @@ public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End ZipCode = req.ZipCode, City = req.City }; - - // Ajout à la base et sauvegarde + pyrofetesdbcontext.Suppliers.Add(supplier); await pyrofetesdbcontext.SaveChangesAsync(ct); - - Console.WriteLine("Fournisseur créé avec succès !"); - // Préparation de la réponse - GetSupplierDto responseDto = new() + // Ajout des liaisons Price si produits renseignés + if (req.Products is not null && req.Products.Any()) + { + foreach (var p in req.Products) + { + var price = new Price + { + SupplierId = supplier.Id, + ProductId = p.ProductId, + SellingPrice = p.SellingPrice + }; + pyrofetesdbcontext.Prices.Add(price); + } + await pyrofetesdbcontext.SaveChangesAsync(ct); + } + + var response = new GetSupplierDto { Id = supplier.Id, Name = supplier.Name, @@ -43,6 +57,6 @@ public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End City = supplier.City }; - await Send.OkAsync(responseDto, ct); + await Send.OkAsync(response, ct); } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs index dbeb8db..e9735dc 100644 --- a/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs +++ b/PyroFetes/Endpoints/Supplier/DeleteSupplierEndpoint.cs @@ -1,5 +1,6 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Supplier; @@ -18,19 +19,32 @@ public class DeleteSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct) { - Models.Supplier? supplierToDelete = await pyrofetesdbcontext + var supplierToDelete = await pyrofetesdbcontext .Suppliers - .SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct); + .SingleOrDefaultAsync(s => s.Id == req.Id, ct); - if (supplierToDelete == null) + if (supplierToDelete is null) { Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } + // Supprimer les liaisons Price avant le fournisseur + var relatedPrices = await pyrofetesdbcontext.Prices + .Where(p => p.SupplierId == req.Id) + .ToListAsync(ct); + + if (relatedPrices.Any()) + { + pyrofetesdbcontext.Prices.RemoveRange(relatedPrices); + } + + // Supprimer le fournisseur pyrofetesdbcontext.Suppliers.Remove(supplierToDelete); + await pyrofetesdbcontext.SaveChangesAsync(ct); + Console.WriteLine($"Fournisseur {req.Id} et ses prix liés supprimés avec succès."); await Send.NoContentAsync(ct); } diff --git a/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs index 51df593..28517a3 100644 --- a/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs +++ b/PyroFetes/Endpoints/Supplier/GetAllSupplierEndpoint.cs @@ -1,10 +1,13 @@ -using API.DTO.Supplier.Response; +using PyroFetes.DTO.Supplier.Response; +using PyroFetes.DTO.Supplier.Request; using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Supplier; -public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) + : EndpointWithoutRequest> { public override void Configure() { @@ -14,19 +17,28 @@ public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En public override async Task HandleAsync(CancellationToken ct) { - List responseDto = await pyrofetesdbcontext.Suppliers - .Select(s => new GetSupplierDto - { - Id = s.Id, - Name = s.Name!, - Email = s.Email!, - PhoneNumber = s.Phone!, - Adress = s.Address!, - ZipCode = s.ZipCode, - City = s.City! - }) + var suppliers = await pyrofetesdbcontext.Suppliers + .Include(s => s.Prices) .ToListAsync(ct); + var responseDto = suppliers.Select(s => new GetSupplierDto + { + Id = s.Id, + Name = s.Name!, + Email = s.Email!, + PhoneNumber = s.Phone!, + Adress = s.Address!, + ZipCode = s.ZipCode, + City = s.City!, + + // 🔹 Liste des produits liés via Price + Products = s.Prices.Select(pr => new SupplierProductPriceDto + { + ProductId = pr.ProductId, + SellingPrice = pr.SellingPrice + }).ToList() + }).ToList(); + await Send.OkAsync(responseDto, ct); } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs index 878e8ba..a66bfad 100644 --- a/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs +++ b/PyroFetes/Endpoints/Supplier/GetSupplierEndpoint.cs @@ -1,4 +1,5 @@ -using API.DTO.Supplier.Response; +using PyroFetes.DTO.Supplier.Request; +using PyroFetes.DTO.Supplier.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; @@ -9,7 +10,8 @@ public class GetSupplierRequest public int Id { get; set; } } -public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) + : Endpoint { public override void Configure() { @@ -19,9 +21,9 @@ public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct) { - Models.Supplier? supplier = await pyrofetesdbcontext - .Suppliers - .SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct); + var supplier = await pyrofetesdbcontext.Suppliers + .Include(s => s.Prices) + .SingleOrDefaultAsync(s => s.Id == req.Id, ct); if (supplier == null) { @@ -30,7 +32,7 @@ public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi return; } - GetSupplierDto responseDto = new() + var responseDto = new GetSupplierDto { Id = supplier.Id, Name = supplier.Name!, @@ -38,7 +40,14 @@ public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi PhoneNumber = supplier.Phone!, Adress = supplier.Address!, ZipCode = supplier.ZipCode, - City = supplier.City! + City = supplier.City!, + + // Produits liés + Products = supplier.Prices.Select(p => new SupplierProductPriceDto + { + ProductId = p.ProductId, + SellingPrice = p.SellingPrice + }).ToList() }; await Send.OkAsync(responseDto, ct); diff --git a/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs b/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs index e835fce..fde3c2e 100644 --- a/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs +++ b/PyroFetes/Endpoints/Supplier/UpdateSupplierEndpoint.cs @@ -1,7 +1,8 @@ -using API.DTO.Supplier.Request; -using API.DTO.Supplier.Response; +using PyroFetes.DTO.Supplier.Request; +using PyroFetes.DTO.Supplier.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Supplier; @@ -15,18 +16,16 @@ public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct) { - Models.Supplier? supplierToEdit = await pyrofetesdbcontext + var supplierToEdit = await pyrofetesdbcontext .Suppliers - .SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct); + .Include(s => s.Prices) + .SingleOrDefaultAsync(s => s.Id == req.Id, ct); - if (supplierToEdit == null) + if (supplierToEdit is null) { - Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } - - // Mise à jour des propriétés supplierToEdit.Name = req.Name; supplierToEdit.Email = req.Email; supplierToEdit.Phone = req.PhoneNumber; @@ -34,9 +33,28 @@ public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End supplierToEdit.ZipCode = req.ZipCode; supplierToEdit.City = req.City; + if (req.Products is not null) + { + // Supprimer les anciennes liaisons + var existingPrices = pyrofetesdbcontext.Prices + .Where(p => p.SupplierId == supplierToEdit.Id); + pyrofetesdbcontext.Prices.RemoveRange(existingPrices); + + // Ajouter les nouvelles liaisons + foreach (var p in req.Products) + { + pyrofetesdbcontext.Prices.Add(new Price + { + SupplierId = supplierToEdit.Id, + ProductId = p.ProductId, + SellingPrice = p.SellingPrice + }); + } + } + await pyrofetesdbcontext.SaveChangesAsync(ct); - GetSupplierDto responseDto = new() + var response = new GetSupplierDto { Id = supplierToEdit.Id, Name = supplierToEdit.Name, @@ -47,6 +65,6 @@ public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End City = supplierToEdit.City }; - await Send.OkAsync(responseDto, ct); + await Send.OkAsync(response, ct); } -} \ No newline at end of file +} diff --git a/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs index 2c46f85..e6ff638 100644 --- a/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs +++ b/PyroFetes/Endpoints/Warehouse/CreateWarehouseEndpoint.cs @@ -1,10 +1,12 @@ using API.DTO.Warehouse.Request; using API.DTO.Warehouse.Response; using FastEndpoints; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Warehouse; -public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class CreateWarehouseEndpoint(PyroFetesDbContext db) + : Endpoint { public override void Configure() { @@ -14,7 +16,7 @@ public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En public override async Task HandleAsync(CreateWarehouseDto req, CancellationToken ct) { - Models.Warehouse warehouse = new() + var warehouse = new Models.Warehouse { Name = req.Name, MaxWeight = req.MaxWeight, @@ -24,13 +26,27 @@ public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En ZipCode = req.ZipCode, City = req.City }; - - pyrofetesdbcontext.Warehouses.Add(warehouse); - await pyrofetesdbcontext.SaveChangesAsync(ct); - - Console.WriteLine("Entrepôt créé avec succès !"); - GetWarehouseDto responseDto = new() + db.Warehouses.Add(warehouse); + await db.SaveChangesAsync(ct); + + // 🔹 Ajout des produits liés à cet entrepôt + if (req.Products is not null && req.Products.Any()) + { + foreach (var p in req.Products) + { + var warehouseProduct = new WarehouseProduct + { + WarehouseId = warehouse.Id, + ProductId = p.ProductId, + Quantity = p.Quantity + }; + db.WarehouseProducts.Add(warehouseProduct); + } + await db.SaveChangesAsync(ct); + } + + var response = new GetWarehouseDto { Id = warehouse.Id, Name = warehouse.Name, @@ -42,6 +58,6 @@ public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En City = warehouse.City }; - await Send.OkAsync(responseDto, ct); + await Send.OkAsync(response, ct); } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs index 758096b..2e533bc 100644 --- a/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs +++ b/PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs @@ -1,5 +1,6 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Warehouse; @@ -8,18 +9,20 @@ public class DeleteWarehouseRequest public int Id { get; set; } } -public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class DeleteWarehouseEndpoint(PyroFetesDbContext db) : Endpoint { public override void Configure() { + // L’annotation correcte du paramètre est {id}, pas {@id} Delete("/api/warehouse/{@id}", x => new { x.Id }); AllowAnonymous(); } - + public override async Task HandleAsync(DeleteWarehouseRequest req, CancellationToken ct) { - Models.Warehouse? warehouseToDelete = await pyrofetesdbcontext - .Warehouses + // On charge aussi les WarehouseProducts liés pour les supprimer proprement + var warehouseToDelete = await db.Warehouses + .Include(w => w.WarehouseProducts) .SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct); if (warehouseToDelete == null) @@ -29,9 +32,21 @@ public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En return; } - pyrofetesdbcontext.Warehouses.Remove(warehouseToDelete); - await pyrofetesdbcontext.SaveChangesAsync(ct); + // 🔹 Suppression des relations WarehouseProduct avant l'entrepôt + var relatedWarehouseProducts = await db.WarehouseProducts + .Where(wp => wp.WarehouseId == req.Id) + .ToListAsync(ct); + if (relatedWarehouseProducts.Any()) + { + db.WarehouseProducts.RemoveRange(relatedWarehouseProducts); + } + + // 🔹 Suppression de l’entrepôt + db.Warehouses.Remove(warehouseToDelete); + await db.SaveChangesAsync(ct); + + Console.WriteLine($"Entrepôt {warehouseToDelete.Name} (ID {req.Id}) supprimé avec succès."); await Send.NoContentAsync(ct); } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs index 0d98e6f..2c7cdb8 100644 --- a/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs +++ b/PyroFetes/Endpoints/Warehouse/GetAllWarehouseEndpoint.cs @@ -1,10 +1,13 @@ using API.DTO.Warehouse.Response; +using API.DTO.Warehouse.Request; using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Warehouse; -public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> +public class GetAllWarehouseEndpoint(PyroFetesDbContext db) + : EndpointWithoutRequest> { public override void Configure() { @@ -14,20 +17,30 @@ public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En public override async Task HandleAsync(CancellationToken ct) { - List responseDto = await pyrofetesdbcontext.Warehouses - .Select(w => new GetWarehouseDto - { - Id = w.Id, - Name = w.Name, - MaxWeight = w.MaxWeight, - Current = w.Current, - MinWeight = w.MinWeight, - Adress = w.Address, - ZipCode = w.ZipCode, - City = w.City - }) + // 🔹 On inclut les relations avec WarehouseProducts et Product + var warehouses = await db.Warehouses + .Include(w => w.WarehouseProducts) + .ThenInclude(wp => wp.Product) .ToListAsync(ct); - await Send.OkAsync(responseDto, ct); + var response = warehouses.Select(w => new GetWarehouseDto + { + Id = w.Id, + Name = w.Name, + MaxWeight = w.MaxWeight, + Current = w.Current, + MinWeight = w.MinWeight, + Adress = w.Address, + ZipCode = w.ZipCode, + City = w.City, + Products = w.WarehouseProducts.Select(wp => new WarehouseProductDto + { + ProductId = wp.ProductId, + ProductName = wp.Product?.Name, + Quantity = wp.Quantity + }).ToList() + }).ToList(); + + await Send.OkAsync(response, ct); } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs index b24e007..386048d 100644 --- a/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs +++ b/PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs @@ -1,6 +1,7 @@ using API.DTO.Warehouse.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Warehouse; @@ -9,28 +10,32 @@ public class GetWarehouseRequest public int Id { get; set; } } -public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class GetWarehouseEndpoint(PyroFetesDbContext db) + : Endpoint { public override void Configure() { + // Pas de "@id" ici, juste {id} Get("/api/warehouses/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(GetWarehouseRequest req, CancellationToken ct) { - Models.Warehouse? warehouse = await pyrofetesdbcontext - .Warehouses + // 🔹 Inclut les produits associés à cet entrepôt + var warehouse = await db.Warehouses + .Include(w => w.WarehouseProducts) + .ThenInclude(wp => wp.Product) .SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct); if (warehouse == null) { - Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé."); + Console.WriteLine($" Aucun entrepôt avec l'ID {req.Id} trouvé."); await Send.NotFoundAsync(ct); return; } - GetWarehouseDto responseDto = new() + var response = new GetWarehouseDto { Id = warehouse.Id, Name = warehouse.Name!, @@ -39,9 +44,15 @@ public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpo MinWeight = warehouse.MinWeight, Adress = warehouse.Address!, ZipCode = warehouse.ZipCode, - City = warehouse.City! + City = warehouse.City!, + Products = warehouse.WarehouseProducts.Select(wp => new WarehouseProductDto + { + ProductId = wp.ProductId, + ProductName = wp.Product?.Name, + Quantity = wp.Quantity + }).ToList() }; - await Send.OkAsync(responseDto, ct); + await Send.OkAsync(response, ct); } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs b/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs index 0864bd6..0a31c70 100644 --- a/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs +++ b/PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs @@ -2,21 +2,25 @@ using API.DTO.Warehouse.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; namespace PyroFetes.Endpoints.Warehouse; -public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint +public class UpdateWarehouseEndpoint(PyroFetesDbContext db) + : Endpoint { public override void Configure() { + // Utilise {id} plutôt que {@id} Put("/api/warehouses/{@id}", x => new { x.Id }); AllowAnonymous(); } public override async Task HandleAsync(UpdateWarehouseDto req, CancellationToken ct) { - Models.Warehouse? warehouseToEdit = await pyrofetesdbcontext - .Warehouses + // 🔹 On inclut les produits existants pour pouvoir les modifier + var warehouseToEdit = await db.Warehouses + .Include(w => w.WarehouseProducts) .SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct); if (warehouseToEdit == null) @@ -26,7 +30,7 @@ public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En return; } - // Mise à jour des champs + // 🔹 Mise à jour des champs de base warehouseToEdit.Name = req.Name; warehouseToEdit.MaxWeight = req.MaxWeight; warehouseToEdit.Current = req.Current; @@ -35,9 +39,30 @@ public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En warehouseToEdit.ZipCode = req.ZipCode; warehouseToEdit.City = req.City; - await pyrofetesdbcontext.SaveChangesAsync(ct); + // 🔹 Gestion des produits associés + if (req.Products is not null) + { + // On supprime les anciens liens pour recréer proprement + var existingLinks = warehouseToEdit.WarehouseProducts.ToList(); + if (existingLinks.Any()) + db.WarehouseProducts.RemoveRange(existingLinks); - GetWarehouseDto responseDto = new() + foreach (var p in req.Products) + { + var newLink = new WarehouseProduct + { + WarehouseId = warehouseToEdit.Id, + ProductId = p.ProductId, + Quantity = p.Quantity + }; + db.WarehouseProducts.Add(newLink); + } + } + + await db.SaveChangesAsync(ct); + + // 🔹 On renvoie la version mise à jour + var response = new GetWarehouseDto { Id = warehouseToEdit.Id, Name = warehouseToEdit.Name, @@ -46,9 +71,16 @@ public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En MinWeight = warehouseToEdit.MinWeight, Adress = warehouseToEdit.Address, ZipCode = warehouseToEdit.ZipCode, - City = warehouseToEdit.City + City = warehouseToEdit.City, + Products = warehouseToEdit.WarehouseProducts.Select(wp => new WarehouseProductDto + { + ProductId = wp.ProductId, + ProductName = wp.Product?.Name, + Quantity = wp.Quantity + }).ToList() }; - await Send.OkAsync(responseDto, ct); + Console.WriteLine($"Entrepôt {warehouseToEdit.Name} mis à jour avec succès."); + await Send.OkAsync(response, ct); } -} \ No newline at end of file +} diff --git a/PyroFetes/Models/Availability.cs b/PyroFetes/Models/Availability.cs index fdb5f68..47b0f1c 100644 --- a/PyroFetes/Models/Availability.cs +++ b/PyroFetes/Models/Availability.cs @@ -4,13 +4,11 @@ namespace PyroFetes.Models; public class Availability { - //Champs [Key] public int Id { get; set; } [Required] public DateOnly AvailabilityDate { get; set; } [Required] public DateOnly DeliveryDate { get; set; } [Required] public DateOnly ExpirationDate { get; set; } [Required] public DateOnly RenewallDate { get; set; } - //Relations public List? StaffAvailabilities { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Brand.cs b/PyroFetes/Models/Brand.cs index f1b486f..49016ca 100644 --- a/PyroFetes/Models/Brand.cs +++ b/PyroFetes/Models/Brand.cs @@ -4,11 +4,9 @@ namespace PyroFetes.Models; public class Brand { - //Champs [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? Name { get; set; } - [Required] public int ProductId { get; set; } - //Relations + [Required] public int ProductId { get; set; } [Required] public Product? Product { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/City.cs b/PyroFetes/Models/City.cs index 60cd49a..04dc24e 100644 --- a/PyroFetes/Models/City.cs +++ b/PyroFetes/Models/City.cs @@ -4,11 +4,9 @@ namespace PyroFetes.Models; public class City { - //Champs [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? Name { get; set; } [Required] public int ZipCode { get; set; } - //Relations public List? Shows { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs index 1ac77db..bd3685b 100644 --- a/PyroFetes/Models/Classification.cs +++ b/PyroFetes/Models/Classification.cs @@ -4,10 +4,8 @@ namespace PyroFetes.Models; public class Classification { - //Champs [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? Label { get; set; } - //Relations public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Color.cs b/PyroFetes/Models/Color.cs index 95cce3d..acfe830 100644 --- a/PyroFetes/Models/Color.cs +++ b/PyroFetes/Models/Color.cs @@ -4,10 +4,8 @@ namespace PyroFetes.Models; public class Color { - //Champs [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? Label { get; set; } - //Relations public List? ProductColors { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Communication.cs b/PyroFetes/Models/Communication.cs index 1265822..a3dd0d2 100644 --- a/PyroFetes/Models/Communication.cs +++ b/PyroFetes/Models/Communication.cs @@ -4,13 +4,11 @@ namespace PyroFetes.Models; public class Communication { - //Champs [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; } - //Relations [Required] public int ContactId { get; set; } public Contact? Contact { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Contact.cs b/PyroFetes/Models/Contact.cs index 5473328..e1573ad 100644 --- a/PyroFetes/Models/Contact.cs +++ b/PyroFetes/Models/Contact.cs @@ -4,7 +4,6 @@ namespace PyroFetes.Models; public class Contact { - //Champs [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? LastName { get; set; } [Required, MaxLength(100)] public string? FirstName { get; set; } @@ -15,8 +14,6 @@ public class Contact [Required, MaxLength(100)] public string? City { get; set; } [Required, MaxLength(100)] public string? Role { get; set; } - - //Relations public Customer? Customer { get; set; } [Required] public int CustomerId { get; set; } diff --git a/PyroFetes/Models/Material.cs b/PyroFetes/Models/Material.cs index 61f74c9..224e5d5 100644 --- a/PyroFetes/Models/Material.cs +++ b/PyroFetes/Models/Material.cs @@ -5,7 +5,7 @@ namespace PyroFetes.Models; public class Material { [Key] public int Id {get; set;} - [Required, MaxLength(100)] public string? Label {get; set;} + [Required, MaxLength(100)] public string? Name {get; set;} [Required] public int Quantity {get; set;} [Required] public int WarehouseId {get; set;} diff --git a/PyroFetes/PyroFetes.csproj b/PyroFetes/PyroFetes.csproj index c662ac6..b301a92 100644 --- a/PyroFetes/PyroFetes.csproj +++ b/PyroFetes/PyroFetes.csproj @@ -9,7 +9,7 @@ - + all From b3347fe1638d7968c2bf13942ba63e47e9af00ef Mon Sep 17 00:00:00 2001 From: reignem Date: Fri, 10 Oct 2025 11:21:57 +0200 Subject: [PATCH 6/7] Commentaire des DTO --- PyroFetes/DTO/Brand/Request/CreateBrandDto.cs | 12 ++-- PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs | 16 +++-- PyroFetes/DTO/Brand/Response/GetBrandDto.cs | 16 +++-- .../Request/CreateClassificationDto.cs | 14 +++-- .../Request/UpdateClassificationDto.cs | 19 ++++-- .../Response/GetClassificationDto.cs | 18 ++++-- PyroFetes/DTO/Color/Request/CreateColorDto.cs | 13 ++-- PyroFetes/DTO/Color/Request/UpdateColorDto.cs | 17 ++++-- PyroFetes/DTO/Color/Response/GetColorDto.cs | 17 ++++-- .../DTO/Effect/Request/CreateEffectDto.cs | 13 ++-- .../DTO/Effect/Request/UpdateEffectDto.cs | 17 ++++-- PyroFetes/DTO/Effect/Response/GetEffectDto.cs | 17 ++++-- .../DTO/Material/Request/CreateMaterialDto.cs | 20 +++++-- .../DTO/Material/Request/UpdateMaterialDto.cs | 24 +++++--- .../DTO/Material/Response/GetMaterialDto.cs | 24 +++++--- .../DTO/Movement/Request/CreateMovementDto.cs | 25 +++++--- .../DTO/Movement/Request/UpdateMovementDto.cs | 29 ++++++--- .../DTO/Movement/Response/GetMovementDto.cs | 29 ++++++--- .../DTO/Product/Request/CreateProductDto.cs | 30 +++++++++- .../DTO/Product/Request/UpdateProductDto.cs | 30 +++++++++- .../DTO/Product/Response/GetProductDto.cs | 31 +++++++++- .../Request/CreateProductCategoryDto.cs | 11 ++-- .../Request/UpdateProductCategoryDto.cs | 15 +++-- .../Response/GetProductCategoryDto.cs | 16 +++-- .../Response/GetProductSupplierDto.cs | 25 +++++--- .../Request/ProductWarehouseDto.cs | 13 +++- .../Response/GetProductWarehouseDto.cs | 9 ++- .../DTO/Supplier/Request/CreateSupplierDto.cs | 49 ++++++++++----- .../DTO/Supplier/Request/UpdateSupplierDto.cs | 38 ++++++++---- .../DTO/Supplier/Response/GetSupplierDto.cs | 57 ++++++++++++------ .../Warehouse/Request/CreateWarehouseDto.cs | 53 ++++++++++------ .../Warehouse/Request/UpdateWarehouseDto.cs | 58 ++++++++++++------ .../DTO/Warehouse/Response/GetWarehouseDto.cs | 60 +++++++++++++------ 33 files changed, 595 insertions(+), 240 deletions(-) diff --git a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs index bf455c5..a33d5e5 100644 --- a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs +++ b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs @@ -1,7 +1,9 @@ -namespace API.DTO.Brand.Request; - -public class CreateBrandDto +namespace API.DTO.Brand.Request { - public string? Name { get; set; } - + // DTO pour créer une nouvelle marque + public class CreateBrandDto + { + // Nom de la marque + public string? Name { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs index 4773281..7ecf5f8 100644 --- a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs +++ b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs @@ -1,8 +1,12 @@ -namespace API.DTO.Brand.Request; - -public class UpdateBrandDto +namespace API.DTO.Brand.Request { - public int Id { get; set; } - public string? Name { get; set; } - + // DTO pour mettre à jour une marque existante + public class UpdateBrandDto + { + // Identifiant de la marque à mettre à jour + public int Id { get; set; } + + // Nouveau nom de la marque + public string? Name { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Brand/Response/GetBrandDto.cs b/PyroFetes/DTO/Brand/Response/GetBrandDto.cs index 4e12c35..d6db5cb 100644 --- a/PyroFetes/DTO/Brand/Response/GetBrandDto.cs +++ b/PyroFetes/DTO/Brand/Response/GetBrandDto.cs @@ -1,8 +1,12 @@ -namespace API.DTO.Brand.Response; - -public class GetBrandDto +namespace API.DTO.Brand.Response { - public int Id { get; set; } - public string? Name { get; set; } - + // DTO pour récupérer les informations d'une marque + public class GetBrandDto + { + // Identifiant de la marque + public int Id { get; set; } + + // Nom de la marque + public string? Name { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs b/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs index a351241..c72928b 100644 --- a/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs +++ b/PyroFetes/DTO/Classification/Request/CreateClassificationDto.cs @@ -1,7 +1,11 @@ -namespace API.DTO.Classification.Request; - -public class CreateClassificationDto +// Définition de l'espace de noms pour les DTO liés à la création de classifications +namespace API.DTO.Classification.Request { - public string? Label { get; set; } - + // DTO (Data Transfer Object) utilisé pour créer une nouvelle classification + public class CreateClassificationDto + { + // Propriété représentant le nom ou le label de la classification + // Le type "string?" signifie que cette valeur peut être null + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs b/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs index 2ecc0a6..6d183bd 100644 --- a/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs +++ b/PyroFetes/DTO/Classification/Request/UpdateClassificationDto.cs @@ -1,8 +1,15 @@ -namespace API.DTO.Classification.Request; - -public class UpdateClassificationDto +// Définition de l'espace de noms pour les DTO liés à la mise à jour de classifications +namespace API.DTO.Classification.Request { - public int Id { get; set; } - public string? Label { get; set; } - + // DTO (Data Transfer Object) utilisé pour mettre à jour une classification existante + public class UpdateClassificationDto + { + // Propriété représentant l'ID unique de la classification à mettre à jour + public int Id { get; set; } + + // Propriété représentant le nouveau nom ou label de la classification + // Le type "string?" signifie que cette valeur peut être null + // Si null, le label ne sera pas modifié + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs b/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs index f86f615..18a9501 100644 --- a/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs +++ b/PyroFetes/DTO/Classification/Response/GetClassificationDto.cs @@ -1,8 +1,14 @@ -namespace API.DTO.Classification.Response; - -public class GetClassificationDto +// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux classifications +namespace API.DTO.Classification.Response { - public int Id { get; set; } - public string? Label { get; set; } - + // DTO (Data Transfer Object) utilisé pour renvoyer les informations d'une classification + public class GetClassificationDto + { + // Propriété représentant l'ID unique de la classification + public int Id { get; set; } + + // Propriété représentant le nom ou label de la classification + // Le type "string?" signifie que cette valeur peut être null si la classification n'a pas de label + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Color/Request/CreateColorDto.cs b/PyroFetes/DTO/Color/Request/CreateColorDto.cs index 943d708..65bd1f2 100644 --- a/PyroFetes/DTO/Color/Request/CreateColorDto.cs +++ b/PyroFetes/DTO/Color/Request/CreateColorDto.cs @@ -1,6 +1,11 @@ -namespace API.DTO.Color.Request; - -public class CreateColorDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux couleurs +namespace API.DTO.Color.Request { - public string? Label { get; set; } + // DTO utilisé pour créer une nouvelle couleur + public class CreateColorDto + { + // Propriété représentant le nom ou label de la couleur à créer + // Le type "string?" signifie que cette valeur peut être null si le label n'est pas fourni + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Color/Request/UpdateColorDto.cs b/PyroFetes/DTO/Color/Request/UpdateColorDto.cs index 3a3b3c5..1c24d85 100644 --- a/PyroFetes/DTO/Color/Request/UpdateColorDto.cs +++ b/PyroFetes/DTO/Color/Request/UpdateColorDto.cs @@ -1,7 +1,14 @@ -namespace API.DTO.Color.Request; - -public class UpdateColorDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux couleurs +namespace API.DTO.Color.Request { - public int Id { get; set; } - public string? Label { get; set; } + // DTO utilisé pour mettre à jour une couleur existante + public class UpdateColorDto + { + // Identifiant unique de la couleur à mettre à jour + public int Id { get; set; } + + // Nouveau nom ou label de la couleur + // Le type "string?" signifie que cette valeur peut être null si aucun changement n'est fourni + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Color/Response/GetColorDto.cs b/PyroFetes/DTO/Color/Response/GetColorDto.cs index 61b49ac..bc56b8f 100644 --- a/PyroFetes/DTO/Color/Response/GetColorDto.cs +++ b/PyroFetes/DTO/Color/Response/GetColorDto.cs @@ -1,7 +1,14 @@ -namespace API.DTO.Color.Response; - -public class GetColorDto +// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux couleurs +namespace API.DTO.Color.Response { - public int Id { get; set; } - public string? Label { get; set; } + // DTO utilisé pour renvoyer les informations d'une couleur + public class GetColorDto + { + // Identifiant unique de la couleur + public int Id { get; set; } + + // Nom ou label de la couleur + // Le type "string?" signifie que cette valeur peut être null si le label n'est pas défini + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs b/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs index 43621e6..93dfac3 100644 --- a/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs +++ b/PyroFetes/DTO/Effect/Request/CreateEffectDto.cs @@ -1,6 +1,11 @@ -namespace API.DTO.Effect.Request; - -public class CreateEffectDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux effets +namespace API.DTO.Effect.Request { - public string? Label { get; set; } + // DTO utilisé pour créer un nouvel effet + public class CreateEffectDto + { + // Nom ou label de l'effet + // Le type "string?" signifie que cette valeur peut être null si aucun label n'est fourni + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs b/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs index 40a2957..ce5a284 100644 --- a/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs +++ b/PyroFetes/DTO/Effect/Request/UpdateEffectDto.cs @@ -1,7 +1,14 @@ -namespace API.DTO.Effect.Request; - -public class UpdateEffectDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux effets +namespace API.DTO.Effect.Request { - public int Id { get; set; } - public string? Label { get; set; } + // DTO utilisé pour mettre à jour un effet existant + public class UpdateEffectDto + { + // Identifiant unique de l'effet à mettre à jour + public int Id { get; set; } + + // Nouveau nom ou label de l'effet + // Le type "string?" signifie que cette valeur peut être null si aucun label n'est fourni + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Effect/Response/GetEffectDto.cs b/PyroFetes/DTO/Effect/Response/GetEffectDto.cs index d37051d..401f1ca 100644 --- a/PyroFetes/DTO/Effect/Response/GetEffectDto.cs +++ b/PyroFetes/DTO/Effect/Response/GetEffectDto.cs @@ -1,7 +1,14 @@ -namespace API.DTO.Effect.Response; - -public class GetEffectDto +// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux effets +namespace API.DTO.Effect.Response { - public int Id { get; set; } - public string? Label { get; set; } + // DTO utilisé pour renvoyer les informations d'un effet + public class GetEffectDto + { + // Identifiant unique de l'effet + public int Id { get; set; } + + // Nom ou label de l'effet + // Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est disponible + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs b/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs index 4806b90..d1482ad 100644 --- a/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs +++ b/PyroFetes/DTO/Material/Request/CreateMaterialDto.cs @@ -1,9 +1,17 @@ -namespace API.DTO.Material.Request; - -public class CreateMaterialDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux matériaux +namespace API.DTO.Material.Request { - public string? Label { get; set; } - public int Quantity { get; set; } - public int WarehouseId {get; set;} + // DTO utilisé pour créer un nouveau matériau + public class CreateMaterialDto + { + // Nom ou label du matériau + // Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est fournie + public string? Label { get; set; } + // Quantité du matériau à créer + public int Quantity { get; set; } + + // Identifiant de l'entrepôt dans lequel le matériau sera stocké + public int WarehouseId { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs b/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs index 73b9ffd..3e522c0 100644 --- a/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs +++ b/PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs @@ -1,10 +1,20 @@ -namespace API.DTO.Material.Request; - -public class UpdateMaterialDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux matériaux +namespace API.DTO.Material.Request { - public int Id { get; set; } - public string? Label { get; set; } - public int Quantity { get; set; } - public int WarehouseId {get; set;} + // DTO utilisé pour mettre à jour un matériau existant + public class UpdateMaterialDto + { + // Identifiant unique du matériau à mettre à jour + public int Id { get; set; } + // Nom ou label du matériau + // Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est fournie + public string? Label { get; set; } + + // Quantité mise à jour du matériau + public int Quantity { get; set; } + + // Identifiant de l'entrepôt associé au matériau + public int WarehouseId { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Material/Response/GetMaterialDto.cs b/PyroFetes/DTO/Material/Response/GetMaterialDto.cs index a74e2b6..3d1309f 100644 --- a/PyroFetes/DTO/Material/Response/GetMaterialDto.cs +++ b/PyroFetes/DTO/Material/Response/GetMaterialDto.cs @@ -1,10 +1,20 @@ -namespace API.DTO.Material.Response; - -public class GetMaterialDto +// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux matériaux +namespace API.DTO.Material.Response { - public int Id { get; set; } - public string? Label { get; set; } - public int Quantity { get; set; } - public int WarehouseId {get; set;} + // DTO utilisé pour renvoyer les informations d'un matériau + public class GetMaterialDto + { + // Identifiant unique du matériau + public int Id { get; set; } + // Nom ou label du matériau + // Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est définie + public string? Label { get; set; } + + // Quantité disponible du matériau + public int Quantity { get; set; } + + // Identifiant de l'entrepôt auquel le matériau est associé + public int WarehouseId { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs b/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs index 043b1e0..90afc74 100644 --- a/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs +++ b/PyroFetes/DTO/Movement/Request/CreateMovementDto.cs @@ -1,10 +1,19 @@ -namespace API.DTO.Movement.Request; - -public class CreateMovementDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux mouvements +namespace API.DTO.Movement.Request { - public DateTime Date { get; set; } - public DateTime Start {get; set;} - public DateTime Arrival {get; set;} - public int Quantity {get; set;} - + // DTO utilisé pour créer un nouveau mouvement + public class CreateMovementDto + { + // Date à laquelle le mouvement est enregistré + public DateTime Date { get; set; } + + // Date et heure de début du mouvement + public DateTime Start { get; set; } + + // Date et heure d'arrivée prévue du mouvement + public DateTime Arrival { get; set; } + + // Quantité de matériaux ou objets impliqués dans le mouvement + public int Quantity { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs b/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs index f932ec9..8f6f99f 100644 --- a/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs +++ b/PyroFetes/DTO/Movement/Request/UpdateMovementDto.cs @@ -1,11 +1,22 @@ -namespace API.DTO.Movement.Request; - -public class UpdateMovementDto +// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux mouvements +namespace API.DTO.Movement.Request { - 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;} - + // DTO utilisé pour mettre à jour un mouvement existant + public class UpdateMovementDto + { + // ID unique du mouvement à mettre à jour + public int Id { get; set; } + + // Date à laquelle le mouvement est enregistré + public DateTime Date { get; set; } + + // Date et heure de début du mouvement + public DateTime Start { get; set; } + + // Date et heure d'arrivée prévue du mouvement + public DateTime Arrival { get; set; } + + // Quantité de matériaux ou objets impliqués dans le mouvement + public int Quantity { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Movement/Response/GetMovementDto.cs b/PyroFetes/DTO/Movement/Response/GetMovementDto.cs index 3d8f452..ed6509f 100644 --- a/PyroFetes/DTO/Movement/Response/GetMovementDto.cs +++ b/PyroFetes/DTO/Movement/Response/GetMovementDto.cs @@ -1,11 +1,22 @@ -namespace API.DTO.Movement.Response; - -public class GetMovementDto +// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux mouvements +namespace API.DTO.Movement.Response { - 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;} - + // DTO utilisé pour renvoyer les informations d'un mouvement + public class GetMovementDto + { + // ID unique du mouvement + public int Id { get; set; } + + // Date à laquelle le mouvement est enregistré + public DateTime Date { get; set; } + + // Date et heure de début du mouvement + public DateTime Start { get; set; } + + // Date et heure d'arrivée prévue du mouvement + public DateTime Arrival { get; set; } + + // Quantité de matériaux ou objets impliqués dans le mouvement + public int Quantity { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Request/CreateProductDto.cs b/PyroFetes/DTO/Product/Request/CreateProductDto.cs index 542ac42..73e6d3e 100644 --- a/PyroFetes/DTO/Product/Request/CreateProductDto.cs +++ b/PyroFetes/DTO/Product/Request/CreateProductDto.cs @@ -2,25 +2,49 @@ namespace PyroFetes.DTO.Product.Request { + // DTO utilisé lors de la création d’un produit public class CreateProductDto { + // Référence interne du produit public int References { get; set; } + + // Nom du produit public string? Name { get; set; } + + // Durée de l’effet du produit public decimal Duration { get; set; } + + // Calibre du produit public decimal Caliber { get; set; } + + // Numéro d’homologation public int ApprovalNumber { get; set; } + + // Poids du produit public decimal Weight { get; set; } + + // Matière active (NEC) public decimal Nec { get; set; } + + // Prix de vente du produit public decimal SellingPrice { get; set; } + + // Image associée au produit (URL ou chemin) public string? Image { get; set; } + + // Lien vers une ressource externe (vidéo, fiche, etc.) public string? Link { get; set; } - public int ClassificationId { get; set;} + + // Identifiant de la classification du produit + public int ClassificationId { get; set; } + + // Identifiant de la catégorie du produit public int ProductCategoryId { get; set; } - // Liste des fournisseurs liés au produit + // Liste des fournisseurs liés au produit venant du DTO ProductSupplierPriceDto public List? Suppliers { get; set; } - // Liste des entrepôts liés au produit + // Liste des entrepôts liés au produit venant du DTO CreateProductWarehouseDto public List? Warehouses { get; set; } } } \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Request/UpdateProductDto.cs b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs index 59ab8e5..c499c75 100644 --- a/PyroFetes/DTO/Product/Request/UpdateProductDto.cs +++ b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs @@ -2,26 +2,52 @@ namespace PyroFetes.DTO.Product.Request { + // DTO utilisé pour la mise à jour d’un produit existant public class UpdateProductDto { + // Identifiant unique du produit à modifier public int Id { get; set; } + + // Référence interne du produit public int References { get; set; } + + // Nom du produit public string? Name { get; set; } + + // Durée de l’effet du produit public decimal Duration { get; set; } + + // Calibre du produit public decimal Caliber { get; set; } + + // Numéro d’homologation public int ApprovalNumber { get; set; } + + // Poids du produit public decimal Weight { get; set; } + + // Matière active (NEC) public decimal Nec { get; set; } + + // Prix de vente du produit public decimal SellingPrice { get; set; } + + // Image associée au produit (URL ou chemin) public string? Image { get; set; } + + // Lien vers une ressource externe (fiche, vidéo, etc.) public string? Link { get; set; } + + // Identifiant de la classification du produit public int ClassificationId { get; set; } + + // Identifiant de la catégorie du produit public int ProductCategoryId { get; set; } - // Liste des fournisseurs associés + // Liste des fournisseurs associés venant du DTO ProductSupplierPriceDto public List Suppliers { get; set; } = new(); - // Liste des entrepôts associés + // Liste des entrepôts associés venant du DTO UpdateProductWarehouseDto public List Warehouses { get; set; } = new(); } } \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Response/GetProductDto.cs b/PyroFetes/DTO/Product/Response/GetProductDto.cs index 48763bf..6d19b43 100644 --- a/PyroFetes/DTO/Product/Response/GetProductDto.cs +++ b/PyroFetes/DTO/Product/Response/GetProductDto.cs @@ -1,29 +1,54 @@ using PyroFetes.DTO.Product.Request; -using PyroFetes.DTO.Product.Request; using PyroFetes.DTO.Product.Response; namespace PyroFetes.DTO.Product.Response { + // DTO utilisé pour renvoyer les informations complètes d’un produit public class GetProductDto { + // Identifiant unique du produit public int Id { get; set; } + + // Référence interne du produit public int Reference { get; set; } + + // Nom du produit public string? Name { get; set; } + + // Durée de l’effet du produit public decimal Duration { get; set; } + + // Calibre du produit public decimal Caliber { get; set; } + + // Numéro d’homologation public int ApprovalNumber { get; set; } + + // Poids du produit public decimal Weight { get; set; } + + // Matière active (NEC) public decimal Nec { get; set; } + + // Prix de vente du produit public decimal SellingPrice { get; set; } + + // Image du produit (URL ou chemin) public string? Image { get; set; } + + // Lien externe vers plus d’informations (fiche, vidéo, etc.) public string? Link { get; set; } + + // Identifiant de la classification du produit public int ClassificationId { get; set; } + + // Identifiant de la catégorie du produit public int ProductCategoryId { get; set; } - // Fournisseurs liés + // Fournisseurs liés venant du DTO ProductSupplierPriceDto public List Suppliers { get; set; } = new(); - // Entrepôts liés + // Entrepôts liés venant du DTO ProductWarehouseDto public List Warehouses { get; set; } = new(); } } \ No newline at end of file diff --git a/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs b/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs index cf5ebe9..d88d526 100644 --- a/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs +++ b/PyroFetes/DTO/ProductCategory/Request/CreateProductCategoryDto.cs @@ -1,6 +1,9 @@ -namespace API.DTO.ProductCategory.Request; - -public class CreateProductCategoryDto +namespace API.DTO.ProductCategory.Request { - public string? Label { get; set; } + // DTO pour créer une catégorie de produit + public class CreateProductCategoryDto + { + // Nom de la catégorie + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs b/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs index 2856e23..f305387 100644 --- a/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs +++ b/PyroFetes/DTO/ProductCategory/Request/UpdateProductCategoryDto.cs @@ -1,7 +1,12 @@ -namespace API.DTO.ProductCategory.Request; - -public class UpdateProductCategoryDto +namespace API.DTO.ProductCategory.Request { - public int Id { get; set; } - public string? Label { get; set; } + // DTO pour mettre à jour une catégorie de produit + public class UpdateProductCategoryDto + { + // Identifiant de la catégorie + public int Id { get; set; } + + // Nom de la catégorie + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs b/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs index ee64f0a..2481853 100644 --- a/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs +++ b/PyroFetes/DTO/ProductCategory/Response/GetProductCategoryDto.cs @@ -1,8 +1,12 @@ -namespace API.DTO.ProductCategory.Response; - -public class GetProductCategoryDto +namespace API.DTO.ProductCategory.Response { - public int Id { get; set; } - public string? Label { get; set; } - + // DTO pour récupérer une catégorie de produit + public class GetProductCategoryDto + { + // Identifiant de la catégorie + public int Id { get; set; } + + // Nom de la catégorie + public string? Label { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs b/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs index a423279..9f1ffad 100644 --- a/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs +++ b/PyroFetes/DTO/ProductSupplierPrice/Response/GetProductSupplierDto.cs @@ -1,11 +1,18 @@ namespace PyroFetes.DTO.Product.Response { -// DTO pour la lecture des fournisseurs liés à un produit -public class GetProductSupplierDto -{ - public int ProductId { get; set; } - public int SupplierId { get; set; } - public string SupplierName { get; set; } = string.Empty; - public decimal SellingPrice { get; set; } -} -} + // DTO utilisé pour renvoyer les informations d’un fournisseur lié à un produit + public class GetProductSupplierDto + { + // Identifiant du produit concerné + public int ProductId { get; set; } + + // Identifiant du fournisseur + public int SupplierId { get; set; } + + // Nom du fournisseur + public string SupplierName { get; set; } = string.Empty; + + // Prix de vente du produit fourni par ce fournisseur + public decimal SellingPrice { get; set; } + } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs b/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs index a74cab2..243fe22 100644 --- a/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs +++ b/PyroFetes/DTO/ProductWarehouse/Request/ProductWarehouseDto.cs @@ -1,17 +1,28 @@ namespace PyroFetes.DTO.Product.Request { - // DTO utilisé pour créer ou mettre à jour la relation Product <-> Warehouse + // DTO utilisé lors de la création d’une relation entre un produit et un entrepôt public class CreateProductWarehouseDto { + // Identifiant de l'entrepôt concerné public int WarehouseId { get; set; } + + // Identifiant du produit associé à cet entrepôt public int ProductId { get; set; } + + // Quantité du produit disponible dans cet entrepôt public int Quantity { get; set; } } + // DTO utilisé lors de la mise à jour d’une relation entre un produit et un entrepôt public class UpdateProductWarehouseDto { + // Identifiant de l'entrepôt concerné public int WarehouseId { get; set; } + + // Identifiant du produit associé à cet entrepôt public int ProductId { get; set; } + + // Nouvelle quantité du produit dans cet entrepôt public int Quantity { get; set; } } } \ No newline at end of file diff --git a/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs b/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs index 40a28fb..38192a8 100644 --- a/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs +++ b/PyroFetes/DTO/ProductWarehouse/Response/GetProductWarehouseDto.cs @@ -1,11 +1,18 @@ namespace PyroFetes.DTO.Product.Response { - // DTO pour la lecture des entrepôts liés à un produit + // DTO utilisé pour renvoyer les informations d’un entrepôt lié à un produit public class GetProductWarehouseDto { + // Identifiant de l'entrepôt public int WarehouseId { get; set; } + + // Identifiant du produit associé à cet entrepôt public int ProductId { get; set; } + + // Nom de l'entrepôt (utile pour l’affichage) public string WarehouseName { get; set; } = string.Empty; + + // Quantité du produit stockée dans cet entrepôt public int Quantity { get; set; } } } \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs b/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs index 9395f20..b89b715 100644 --- a/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs +++ b/PyroFetes/DTO/Supplier/Request/CreateSupplierDto.cs @@ -1,20 +1,37 @@ -namespace PyroFetes.DTO.Supplier.Request; - -public class CreateSupplierDto +namespace PyroFetes.DTO.Supplier.Request { - 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; } + // DTO pour créer un nouveau fournisseur + public class CreateSupplierDto + { + // Nom du fournisseur + public string Name { get; set; } - // Produits que ce fournisseur fournit - public List? Products { get; set; } -} + // Email du fournisseur + public string Email { get; set; } -public class SupplierProductPriceDto -{ - public int ProductId { get; set; } - public decimal SellingPrice { get; set; } + // Numéro de téléphone du fournisseur + public string PhoneNumber { get; set; } + + // Adresse du fournisseur + public string Adress { get; set; } + + // Code postal de l'adresse + public int ZipCode { get; set; } + + // Ville de l'adresse + public string City { get; set; } + + // Liste des produits fournis par ce fournisseur dans la classe SupplierProductPriceDto + public List? Products { get; set; } + } + + // DTO pour relier un produit et son prix à un fournisseur + public class SupplierProductPriceDto + { + // Identifiant du produit fourni + public int ProductId { get; set; } + + // Prix de vente du produit par ce fournisseur + public decimal SellingPrice { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs b/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs index f71d406..6f4ad46 100644 --- a/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs +++ b/PyroFetes/DTO/Supplier/Request/UpdateSupplierDto.cs @@ -1,14 +1,30 @@ -namespace PyroFetes.DTO.Supplier.Request; - -public class UpdateSupplierDto +namespace PyroFetes.DTO.Supplier.Request { - public int Id { 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; } + // DTO pour mettre à jour un fournisseur existant + public class UpdateSupplierDto + { + // Identifiant du fournisseur à mettre à jour + public int Id { get; set; } - public List? Products { get; set; } + // Nom du fournisseur + public string Name { get; set; } + + // Email du fournisseur + public string Email { get; set; } + + // Numéro de téléphone du fournisseur + public string PhoneNumber { get; set; } + + // Adresse du fournisseur + public string Adress { get; set; } + + // Code postal de l'adresse + public int ZipCode { get; set; } + + // Ville de l'adresse + public string City { get; set; } + + // Liste des produits fournis par ce fournisseur relié à la classe SupplierProductPriceDto + public List? Products { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs b/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs index ba2237c..01ce76c 100644 --- a/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs +++ b/PyroFetes/DTO/Supplier/Response/GetSupplierDto.cs @@ -1,24 +1,45 @@ using PyroFetes.DTO.Supplier.Request; -namespace PyroFetes.DTO.Supplier.Response; - -public class GetSupplierDto +namespace PyroFetes.DTO.Supplier.Response { - public int Id { 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; } + // DTO pour récupérer les informations d'un fournisseur + public class GetSupplierDto + { + // Identifiant du fournisseur + public int Id { get; set; } - // Liste des produits liés avec leur prix fournisseur - public List Products { get; set; } -} + // Nom du fournisseur + public string Name { get; set; } -public class GetSupplierProductDto -{ - public int ProductId { get; set; } - public string ProductName { get; set; } = string.Empty; - public decimal SellingPrice { get; set; } + // Email du fournisseur + public string Email { get; set; } + + // Numéro de téléphone + public string PhoneNumber { get; set; } + + // Adresse du fournisseur + public string Adress { get; set; } + + // Code postal + public int ZipCode { get; set; } + + // Ville + public string City { get; set; } + + // Liste des produits fournis par la classe SupplierProductPriceDto + public List Products { get; set; } = new(); + } + + // DTO pour les détails d'un produit lié à un fournisseur + public class GetSupplierProductDto + { + // Identifiant du produit + public int ProductId { get; set; } + + // Nom du produit + public string ProductName { get; set; } = string.Empty; + + // Prix de vente fourni par le fournisseur + public decimal SellingPrice { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs index 36563c2..5864955 100644 --- a/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs +++ b/PyroFetes/DTO/Warehouse/Request/CreateWarehouseDto.cs @@ -1,21 +1,40 @@ -namespace API.DTO.Warehouse.Request; - -public class CreateWarehouseDto +namespace API.DTO.Warehouse.Request { - 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; } + // DTO pour créer un entrepôt + public class CreateWarehouseDto + { + // Nom de l'entrepôt + public string Name { get; set; } - // Liste des produits à stocker dans cet entrepôt - public List? Products { get; set; } -} + // Poids maximal que l'entrepôt peut contenir + public int MaxWeight { get; set; } -public class CreateWarehouseProductDto -{ - public int ProductId { get; set; } - public int Quantity { get; set; } + // Poids actuel stocké + public int Current { get; set; } + + // Poids minimal souhaité + public int MinWeight { get; set; } + + // Adresse de l'entrepôt + public string Adress { get; set; } + + // Code postal + public int ZipCode { get; set; } + + // Ville + public string City { get; set; } + + // Liste des produits à stocker dans cet entrepôt venant de la classe en dessous + public List? Products { get; set; } + } + + // DTO pour associer un produit à un entrepôt + public class CreateWarehouseProductDto + { + // Identifiant du produit + public int ProductId { get; set; } + + // Quantité du produit dans l'entrepôt + public int Quantity { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs index 3e843d5..673b0de 100644 --- a/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs +++ b/PyroFetes/DTO/Warehouse/Request/UpdateWarehouseDto.cs @@ -1,21 +1,43 @@ -namespace API.DTO.Warehouse.Request; - -public class UpdateWarehouseDto +namespace API.DTO.Warehouse.Request { - 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; } - - public List? Products { get; set; } -} + // DTO pour mettre à jour un entrepôt + public class UpdateWarehouseDto + { + // Identifiant de l'entrepôt à mettre à jour + public int Id { get; set; } -public class UpdateWarehouseProductDto -{ - public int ProductId { get; set; } - public int Quantity { get; set; } + // Nom de l'entrepôt + public string Name { get; set; } + + // Poids maximal que l'entrepôt peut contenir + public int MaxWeight { get; set; } + + // Poids actuel stocké + public int Current { get; set; } + + // Poids minimal souhaité + public int MinWeight { get; set; } + + // Adresse de l'entrepôt + public string Adress { get; set; } + + // Code postal + public int ZipCode { get; set; } + + // Ville + public string City { get; set; } + + // Liste des produits à mettre à jour dans cet entrepôt + public List? Products { get; set; } + } + + // DTO pour mettre à jour la quantité d'un produit dans un entrepôt + public class UpdateWarehouseProductDto + { + // Identifiant du produit + public int ProductId { get; set; } + + // Nouvelle quantité du produit dans l'entrepôt + public int Quantity { get; set; } + } } \ No newline at end of file diff --git a/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs b/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs index 3af0328..e324f15 100644 --- a/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs +++ b/PyroFetes/DTO/Warehouse/Response/GetWarehouseDto.cs @@ -1,22 +1,46 @@ -namespace API.DTO.Warehouse.Response; - -public class GetWarehouseDto +namespace API.DTO.Warehouse.Response { - 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; } + // DTO pour la lecture d'un entrepôt + public class GetWarehouseDto + { + // Identifiant de l'entrepôt + public int Id { get; set; } - public List? Products { get; set; } -} + // Nom de l'entrepôt + public string Name { get; set; } -public class WarehouseProductDto -{ - public int ProductId { get; set; } - public string? ProductName { get; set; } - public int Quantity { get; set; } + // Poids maximal que l'entrepôt peut contenir + public int MaxWeight { get; set; } + + // Poids actuellement stocké + public int Current { get; set; } + + // Poids minimal souhaité + public int MinWeight { get; set; } + + // Adresse de l'entrepôt + public string Adress { get; set; } + + // Code postal + public int ZipCode { get; set; } + + // Ville + public string City { get; set; } + + // Liste des produits stockés dans l'entrepôt + public List? Products { get; set; } + } + + // DTO pour la lecture d'un produit dans un entrepôt + public class WarehouseProductDto + { + // Identifiant du produit + public int ProductId { get; set; } + + // Nom du produit + public string? ProductName { get; set; } + + // Quantité du produit dans l'entrepôt + public int Quantity { get; set; } + } } \ No newline at end of file From bad259e9f50f89d7bd1bc35aa9740aaba2bd09d0 Mon Sep 17 00:00:00 2001 From: colesm Date: Fri, 10 Oct 2025 11:39:36 +0200 Subject: [PATCH 7/7] MAJ --- PyroFetes/DTO/Brand/Request/CreateBrandDto.cs | 2 +- PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs | 2 +- PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs | 2 +- PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs index a33d5e5..3a6eee7 100644 --- a/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs +++ b/PyroFetes/DTO/Brand/Request/CreateBrandDto.cs @@ -1,4 +1,4 @@ -namespace API.DTO.Brand.Request +namespace PyroFetes.DTO.Brand.Request { // DTO pour créer une nouvelle marque public class CreateBrandDto diff --git a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs index 7ecf5f8..3af9735 100644 --- a/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs +++ b/PyroFetes/DTO/Brand/Request/UpdateBrandDto.cs @@ -1,4 +1,4 @@ -namespace API.DTO.Brand.Request +namespace PyroFetes.DTO.Brand.Request { // DTO pour mettre à jour une marque existante public class UpdateBrandDto diff --git a/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs index 19756c9..4ff5724 100644 --- a/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs +++ b/PyroFetes/Endpoints/Brand/CreateBrandEndpoint.cs @@ -1,6 +1,6 @@ -using API.DTO.Brand.Request; using API.DTO.Brand.Response; using FastEndpoints; +using PyroFetes.DTO.Brand.Request; namespace PyroFetes.Endpoints.Brand; diff --git a/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs b/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs index 2db66ce..1ab0b04 100644 --- a/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs +++ b/PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs @@ -1,6 +1,6 @@ -using API.DTO.Brand.Request; using API.DTO.Brand.Response; using FastEndpoints; +using PyroFetes.DTO.Brand.Request; namespace PyroFetes.Endpoints.Brand;