From bd8495b79a513c3c2175df247cd63bdd3adf318f Mon Sep 17 00:00:00 2001 From: colesm Date: Wed, 8 Oct 2025 16:27:55 +0200 Subject: [PATCH 1/2] MAJ Program en FastEndpoint --- PyroFetes/Program.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/PyroFetes/Program.cs b/PyroFetes/Program.cs index d127d73..e610bf4 100644 --- a/PyroFetes/Program.cs +++ b/PyroFetes/Program.cs @@ -1,18 +1,19 @@ -var builder = WebApplication.CreateBuilder(args); +using API; +using FastEndpoints; +using FastEndpoints.Swagger; +using PyroFetes; -// Add services to the container. -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +WebApplicationBuilder builder = WebApplication.CreateBuilder(args); -var app = builder.Build(); +// On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet +builder.Services.AddFastEndpoints().SwaggerDocument(); -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} +// 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(); From 423f8f9645e614f60c6fb71f5a830ed0f54d9f53 Mon Sep 17 00:00:00 2001 From: colesm Date: Wed, 8 Oct 2025 16:30:20 +0200 Subject: [PATCH 2/2] MAJ Product's DTO --- PyroFetes/DTO/Product/Request/CreateProductDto.cs | 9 ++++++++- PyroFetes/DTO/Product/Request/UpdateProductDto.cs | 9 ++++++++- PyroFetes/DTO/Product/Response/GetProductDto.cs | 9 ++++++++- PyroFetes/Endpoints/Product/CreateProductEndpoint.cs | 6 +++--- PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs | 4 ++-- PyroFetes/Endpoints/Product/GetProductEndpoint.cs | 4 ++-- PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs | 6 +++--- 7 files changed, 34 insertions(+), 13 deletions(-) diff --git a/PyroFetes/DTO/Product/Request/CreateProductDto.cs b/PyroFetes/DTO/Product/Request/CreateProductDto.cs index 137eb75..305aa8f 100644 --- a/PyroFetes/DTO/Product/Request/CreateProductDto.cs +++ b/PyroFetes/DTO/Product/Request/CreateProductDto.cs @@ -1,4 +1,6 @@ -namespace API.DTO.Product.Request; +using PyroFetes.Models; + +namespace PyroFetes.DTO.Product.Request; public class CreateProductDto { @@ -15,4 +17,9 @@ public class CreateProductDto public int ClassificationId { get; set;} public int ProductCategoryId { get; set; } + public List? Brands { get; set; } + public List? Effects { get; set; } + public List? Colors {get; set;} + public List? Prices {get; set;} + public List? WarehouseProducts {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 b648fbb..d22198a 100644 --- a/PyroFetes/DTO/Product/Request/UpdateProductDto.cs +++ b/PyroFetes/DTO/Product/Request/UpdateProductDto.cs @@ -1,4 +1,6 @@ -namespace API.DTO.Product.Request; +using PyroFetes.Models; + +namespace PyroFetes.DTO.Product.Request; public class UpdateProductDto { @@ -15,4 +17,9 @@ public class UpdateProductDto public string? Link { get; set; } public int ClassificationId { get; set;} public int ProductCategoryId { get; set; } + public List? Brands { get; set; } + public List? Effects { get; set; } + public List? Colors {get; set;} + public List? Prices {get; set;} + public List? WarehouseProducts {get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Product/Response/GetProductDto.cs b/PyroFetes/DTO/Product/Response/GetProductDto.cs index dd4a979..3aae16b 100644 --- a/PyroFetes/DTO/Product/Response/GetProductDto.cs +++ b/PyroFetes/DTO/Product/Response/GetProductDto.cs @@ -1,4 +1,6 @@ -namespace API.DTO.Product.Response; +using PyroFetes.Models; + +namespace PyroFetes.DTO.Product.Response; public class GetProductDto { @@ -17,4 +19,9 @@ public class GetProductDto public string? ClassificationLabel { get; set; } public int ProductCategoryId { get; set; } public string? ProductCategoryLabel { get; set; } + public List? Brands { get; set; } + public List? Effects { get; set; } + public List? Colors {get; set;} + public List? Prices {get; set;} + public List? WarehouseProducts {get; set; } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs b/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs index 931e3e9..5a30b83 100644 --- a/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/CreateProductEndpoint.cs @@ -1,6 +1,6 @@ -using API.DTO.Product.Request; -using API.DTO.Product.Response; -using FastEndpoints; +using FastEndpoints; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; namespace PyroFetes.Endpoints.Product; diff --git a/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs b/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs index 5a19eca..ee81ef9 100644 --- a/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs +++ b/PyroFetes/Endpoints/Product/GetAllProductsEndpoint.cs @@ -1,6 +1,6 @@ -using API.DTO.Product.Response; -using FastEndpoints; +using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Response; namespace PyroFetes.Endpoints.Product; diff --git a/PyroFetes/Endpoints/Product/GetProductEndpoint.cs b/PyroFetes/Endpoints/Product/GetProductEndpoint.cs index 2ca8089..df4b64f 100644 --- a/PyroFetes/Endpoints/Product/GetProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/GetProductEndpoint.cs @@ -1,6 +1,6 @@ -using API.DTO.Product.Response; -using FastEndpoints; +using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Response; namespace PyroFetes.Endpoints.Product; diff --git a/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs b/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs index 0c079ff..2512e9c 100644 --- a/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs +++ b/PyroFetes/Endpoints/Product/UpdateProductEndpoint.cs @@ -1,7 +1,7 @@ -using API.DTO.Product.Request; -using API.DTO.Product.Response; -using FastEndpoints; +using FastEndpoints; using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Product.Request; +using PyroFetes.DTO.Product.Response; namespace PyroFetes.Endpoints.Product;