46 Commits

Author SHA1 Message Date
5506eab8ff Merge branch 'feature/mathy' into develop
# Conflicts:
#	PyroFetes/Endpoints/Brand/UpdateBrandEndpoint.cs
#	PyroFetes/Endpoints/Warehouse/DeleteWarehouseEndpoint.cs
#	PyroFetes/Endpoints/Warehouse/GetWarehouseEndpoint.cs
#	PyroFetes/Endpoints/Warehouse/UpdateWarehouseEndpoint.cs
2025-10-16 17:08:38 +02:00
15545980af Normalement c'est réglé ! 2025-10-16 17:03:51 +02:00
dda2240e86 Merge branch 'feature/gabriel2' into develop 2025-10-16 16:46:33 +02:00
a014c6c9f7 gabriel2 2025-10-16 16:42:45 +02:00
2112605cf3 Ajout de Login et du model réuni avec tout les autres Sujet 2025-10-16 16:30:17 +02:00
90d685d42c Commentaire create color endpooint 2025-10-16 16:25:19 +02:00
2bcca6f856 Merge remote-tracking branch 'origin/develop' into develop 2025-10-16 15:52:52 +02:00
6d564c89ff Correction des routes d'api 2025-10-16 15:52:24 +02:00
bad259e9f5 MAJ 2025-10-10 11:39:36 +02:00
32dee6eb18 Merge branch 'feature/mathy' into develop 2025-10-10 11:37:56 +02:00
b3347fe163 Commentaire des DTO 2025-10-10 11:21:57 +02:00
0e74cb40f5 Merge branch 'feature/gabriel' into develop 2025-10-09 17:36:59 +02:00
91b4aca2fa 17:17 09/10 2025-10-09 17:17:42 +02:00
1734ec0219 le reste 2025-10-09 17:03:05 +02:00
7a8daa6ab8 le sln 2025-10-09 17:01:54 +02:00
8f4171a045 09/10 2025-10-09 16:55:29 +02:00
8a8a47c99c Initial commit 2025-10-09 16:52:35 +02:00
bb5dd63da2 MAJ Coquille 2025-10-09 16:18:21 +02:00
c5805d979b MaJ des .txt en .cs 2025-10-09 16:09:30 +02:00
44da6ed371 Maj 2025-10-09 15:50:02 +02:00
08bf910437 Maj Warehouse et Supplier 2025-10-09 15:39:10 +02:00
d1fa3aca68 MAJ Mathilde 2025-10-09 15:16:08 +02:00
f155d03559 Actualiser PyroFetes/DTO/Material/Response/GetMaterialDto.cs 2025-10-08 16:55:00 +02:00
f3ed82f4a4 Actualiser PyroFetes/DTO/Material/Request/UpdateMaterialDto.cs 2025-10-08 16:54:31 +02:00
22275b63f2 Actualiser PyroFetes/DTO/Material/Request/CreateMaterialDto.cs 2025-10-08 16:54:02 +02:00
018f7c5c25 Ajouter PyroFetes/Endpoints/Material/UpdateMaterialEndpoint 2025-10-08 16:45:05 +02:00
81ab26f765 Ajouter PyroFetes/Endpoints/Material/GetMaterialEndpoint 2025-10-08 16:44:35 +02:00
75ab503dfc Ajouter PyroFetes/Endpoints/Material/GetAllMaterialsEndpoint 2025-10-08 16:43:09 +02:00
52f0e84323 Ajouter PyroFetes/Endpoints/Material/DeleteMaterialEndpoint 2025-10-08 16:42:33 +02:00
9b9ec133aa Ajouter PyroFetes/Endpoints/Material/CreateMaterialEndpoint 2025-10-08 16:41:53 +02:00
4aa6db31b0 Ajouter PyroFetes/Endpoints/Effect/UpdateEffectEndpoint 2025-10-08 16:40:48 +02:00
149cd9eb33 Ajouter PyroFetes/Endpoints/Effect/GetEffectEndpoint 2025-10-08 16:40:22 +02:00
d7bc054cb5 Ajouter PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint 2025-10-08 16:39:54 +02:00
abe508bd7c Ajouter PyroFetes/Endpoints/Effect/DeleteEffectEndpoint 2025-10-08 16:39:29 +02:00
94ea571a42 Ajouter PyroFetes/Endpoints/Effect/CreateEffectEndpoint 2025-10-08 16:39:11 +02:00
93d259638a Ajouter PyroFetes/Endpoints/Color/UpdateColorEndpoint 2025-10-08 16:38:39 +02:00
e6030cacf2 Ajouter PyroFetes/Endpoints/Color/GetColorEndpoint 2025-10-08 16:38:21 +02:00
ccaaf25dbc Ajouter PyroFetes/Endpoints/Color/GetAllColorsEndpoint 2025-10-08 16:38:00 +02:00
abc1c42b53 Ajouter PyroFetes/Endpoints/Color/DeleteColorEndpoint 2025-10-08 16:37:32 +02:00
7e3eaa3b51 Merge remote-tracking branch 'origin/develop' into develop 2025-10-08 16:36:09 +02:00
658d346dd0 MAJ 2025-10-08 16:35:46 +02:00
997d7c64fb Ajouter PyroFetes/Endpoints/Color/CreateColorEndpoint 2025-10-08 16:35:28 +02:00
81854417d8 Merge branch 'feature/matheo' into develop 2025-10-08 16:30:56 +02:00
423f8f9645 MAJ Product's DTO 2025-10-08 16:30:20 +02:00
bd8495b79a MAJ Program en FastEndpoint 2025-10-08 16:27:55 +02:00
c729af3d32 AJout des DTO et endpoint sur le nouveau git 2025-10-08 15:46:36 +02:00
170 changed files with 3389 additions and 6260 deletions

View File

@@ -0,0 +1,9 @@
namespace PyroFetes.DTO.Brand.Request
{
// DTO pour créer une nouvelle marque
public class CreateBrandDto
{
// Nom de la marque
public string? Name { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace PyroFetes.DTO.Brand.Request
{
// 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; }
}
}

View File

@@ -0,0 +1,12 @@
namespace API.DTO.Brand.Response
{
// 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; }
}
}

View File

@@ -0,0 +1,11 @@
// Définition de l'espace de noms pour les DTO liés à la création de classifications
namespace API.DTO.Classification.Request
{
// 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; }
}
}

View File

@@ -0,0 +1,15 @@
// Définition de l'espace de noms pour les DTO liés à la mise à jour de classifications
namespace API.DTO.Classification.Request
{
// 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; }
}
}

View File

@@ -0,0 +1,14 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,11 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,14 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,14 @@
// 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
{
// 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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,14 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,14 @@
// 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
{
// 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; }
}
}

View File

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

View File

@@ -0,0 +1,8 @@
namespace PyroFetes.DTO.Login.Request;
public class CreateLoginDto
{
public string? Username { get; set; }
public string? FullName { get; set; }
public string? Password { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace PyroFetes.DTO.Login.Request;
public class UpdateLoginDto
{
public int Id { get; set; }
public string? Username { get; set; }
public string? FullName { get; set; }
public string? Password { get; set; }
}

View File

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

View File

@@ -0,0 +1,10 @@
namespace PyroFetes.DTO.Login.Response;
public class GetLoginDto
{
public int Id { get; set; }
public string? Username { get; set; }
public string? FullName { get; set; }
public string? Password { get; set; }
public string? Salt { get; set; }
}

View File

@@ -0,0 +1,17 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,20 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,20 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,19 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,22 @@
// 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
{
// 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; }
}
}

View File

@@ -0,0 +1,22 @@
// 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
{
// 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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,50 @@
namespace PyroFetes.DTO.Product.Request;
using 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 string? Image { get; set; }
public string? Link { get; set; }
public int MinimalQuantity { get; set; }
// DTO utilisé lors de la création dun 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 leffet du produit
public decimal Duration { get; set; }
// Calibre du produit
public decimal Caliber { get; set; }
// Numéro dhomologation
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; }
// 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 venant du DTO ProductSupplierPriceDto
public List<ProductSupplierPriceDto>? Suppliers { get; set; }
// Liste des entrepôts liés au produit venant du DTO CreateProductWarehouseDto
public List<CreateProductWarehouseDto>? Warehouses { get; set; }
}
}

View File

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

View File

@@ -1,16 +1,53 @@
namespace PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Request;
public class UpdateProductDto
namespace PyroFetes.DTO.Product.Request
{
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 string? Image { get; set; }
public string? Link { get; set; }
public int MinimalQuantity { get; set; }
// DTO utilisé pour la mise à jour dun 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 leffet du produit
public decimal Duration { get; set; }
// Calibre du produit
public decimal Caliber { get; set; }
// Numéro dhomologation
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 venant du DTO ProductSupplierPriceDto
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
// Liste des entrepôts associés venant du DTO UpdateProductWarehouseDto
public List<UpdateProductWarehouseDto> Warehouses { get; set; } = new();
}
}

View File

@@ -1,16 +1,54 @@
namespace PyroFetes.DTO.Product.Response;
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
public class GetProductDto
namespace PyroFetes.DTO.Product.Response
{
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 string? Image { get; set; }
public string? Link { get; set; }
public int MinimalQuantity { get; set; }
// DTO utilisé pour renvoyer les informations complètes dun 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 leffet du produit
public decimal Duration { get; set; }
// Calibre du produit
public decimal Caliber { get; set; }
// Numéro dhomologation
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 dinformations (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 venant du DTO ProductSupplierPriceDto
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
// Entrepôts liés venant du DTO ProductWarehouseDto
public List<GetProductWarehouseDto> Warehouses { get; set; } = new();
}
}

View File

@@ -0,0 +1,9 @@
namespace API.DTO.ProductCategory.Request
{
// DTO pour créer une catégorie de produit
public class CreateProductCategoryDto
{
// Nom de la catégorie
public string? Label { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace API.DTO.ProductCategory.Request
{
// 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; }
}
}

View File

@@ -0,0 +1,12 @@
namespace API.DTO.ProductCategory.Response
{
// 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; }
}
}

View File

@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.ProductColor.Request;
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Color
public class ProductColorDto
{
public int ProductId { get; set; } // Id du produit (pour update)
public int ColorId { get; set; } // Id de la couleur
}

View File

@@ -0,0 +1,11 @@
namespace PyroFetes.DTO.ProductColor.Response;
// DTO utilisé pour renvoyer les informations dun produit lié à une couleur
public class GetProductColorDto
{
// Identifiant du produit concerné
public int ProductId { get; set; }
// Identifiant de la couleur
public int ColorId { get; set; }
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
namespace PyroFetes.DTO.ProductEffect.Request;
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Effect
public class ProductEffectDto
{
public int ProductId { get; set; } // Id du produit (pour update)
public int EffectId { get; set; } // Id de l'effet
}

View File

@@ -0,0 +1,12 @@
namespace PyroFetes.DTO.ProductEffect.Response;
// DTO utilisé pour renvoyer les informations dun produit lié à un effet
public class GetProductEffectDto
{
// Identifiant du produit concerné
public int ProductId { get; set; }
// Identifiant de l'effet
public int EffectId { get; set; }
}

View File

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

View File

@@ -0,0 +1,18 @@
namespace PyroFetes.DTO.Product.Response
{
// DTO utilisé pour renvoyer les informations dun 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; }
}
}

View File

@@ -0,0 +1,28 @@
namespace PyroFetes.DTO.Product.Request
{
// DTO utilisé lors de la création dune 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 dune 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; }
}
}

View File

@@ -0,0 +1,18 @@
namespace PyroFetes.DTO.Product.Response
{
// DTO utilisé pour renvoyer les informations dun 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 laffichage)
public string WarehouseName { get; set; } = string.Empty;
// Quantité du produit stockée dans cet entrepôt
public int Quantity { get; set; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,12 +1,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? Phone { get; set; }
public string? Address { get; set; }
public int ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
// DTO pour créer un nouveau fournisseur
public class CreateSupplierDto
{
// 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 dans la classe SupplierProductPriceDto
public List<SupplierProductPriceDto>? 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; }
}
}

View File

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

View File

@@ -1,13 +1,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? Phone { get; set; }
public string? Address { get; set; }
public int ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
// DTO pour mettre à jour un fournisseur existant
public class UpdateSupplierDto
{
// Identifiant du fournisseur à mettre à jour
public int Id { 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<SupplierProductPriceDto>? Products { get; set; }
}
}

View File

@@ -1,13 +1,45 @@
namespace PyroFetes.DTO.Supplier.Response;
using PyroFetes.DTO.Supplier.Request;
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? Phone { get; set; }
public string? Address { get; set; }
public int ZipCode { get; set; }
public string? City { get; set; }
public int DeliveryDelay { get; set; }
// DTO pour récupérer les informations d'un fournisseur
public class GetSupplierDto
{
// Identifiant du fournisseur
public int Id { get; set; }
// Nom du fournisseur
public string Name { 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<SupplierProductPriceDto> 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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,40 @@
namespace API.DTO.Warehouse.Request
{
// DTO pour créer un entrepôt
public class CreateWarehouseDto
{
// 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 à stocker dans cet entrepôt venant de la classe en dessous
public List<CreateWarehouseProductDto>? 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; }
}
}

View File

@@ -0,0 +1,43 @@
namespace API.DTO.Warehouse.Request
{
// DTO pour mettre à jour un entrepôt
public class UpdateWarehouseDto
{
// Identifiant de l'entrepôt à mettre à jour
public int Id { 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<UpdateWarehouseProductDto>? 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; }
}
}

View File

@@ -0,0 +1,46 @@
namespace API.DTO.Warehouse.Response
{
// DTO pour la lecture d'un entrepôt
public class GetWarehouseDto
{
// Identifiant de l'entrepôt
public int Id { 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 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<WarehouseProductDto>? 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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
using API.DTO.Color.Request;
using API.DTO.Color.Response;
using FastEndpoints;
using PyroFetes;
namespace API.Endpoints.Color;
public class CreateColorEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateColorDto, GetColorDto> //Instanciation d'une connexion à la bdd dans un endpoint, utilise l'élément de requête CreateColorDto et l'élement de réponse GetColorDto
{
public override void Configure() //Configuration de l'endpoint
{
Post("Api/colors"); //Création d'un endpoint pour créer une couleur avec les données de CreateColorDto
AllowAnonymous(); //Laisser passer les requêtes non authentifiées
}
public override async Task HandleAsync(CreateColorDto req, CancellationToken ct) //La méthode HandleAsync est appelée lorsqu'une requête est envoyée à l'endpoint
{
PyroFetes.Models.Color color = new()
{
Label = req.Label,
};
pyroFetesDbContext.Colors.Add(color);
await pyroFetesDbContext.SaveChangesAsync(ct);
Console.WriteLine("Added Color");
GetColorDto responseDto = new()
{
Id = color.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class DeleteColorRequest
{
public int Id { get; set; }
}
public class DeleteColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteColorRequest>
{
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 pyrofetesdbcontext
.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;
}
pyrofetesdbcontext.Colors.Remove(colorToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}

View File

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

View File

@@ -0,0 +1,41 @@
using API.DTO.Color.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class GetColorRequest
{
public int Id { get; set; }
}
public class GetColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetColorRequest, GetColorDto>
{
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 pyrofetesdbcontext
.Colors
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (color == null)
{
Console.WriteLine("Aucune couleur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetColorDto responseDto = new()
{
Id = color.Id,
Label = color.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

@@ -0,0 +1,41 @@
using API.DTO.Color.Request;
using API.DTO.Color.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class UpdateColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateColorDto, GetColorDto>
{
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 pyrofetesdbcontext
.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 pyrofetesdbcontext.SaveChangesAsync(ct);
GetColorDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}

View File

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

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