Refactored Program.cs

This commit is contained in:
Cristiano
2025-11-20 15:20:13 +01:00
parent d64890dec9
commit 0b72549143
2 changed files with 20 additions and 8 deletions

View File

@@ -30,7 +30,8 @@ public class CreatePurchaseProductEndpoint(
return;
}
PurchaseOrder? purchaseOrder = await purchaseOrdersRepository.FirstOrDefaultAsync(new GetPurchaseOrderByIdSpec(req.PurchaseOrderId), ct);
PurchaseOrder? purchaseOrder =
await purchaseOrdersRepository.FirstOrDefaultAsync(new GetPurchaseOrderByIdSpec(req.PurchaseOrderId), ct);
if (purchaseOrder == null)
{

View File

@@ -5,7 +5,7 @@ using FastEndpoints;
using FastEndpoints.Swagger;
using FastEndpoints.Security;
using PyroFetes.MappingProfiles;
using IMapper = FastEndpoints.IMapper;
using PyroFetes.Repositories;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
@@ -19,6 +19,17 @@ builder.Services
// On ajoute ici la configuration de la base de données
builder.Services.AddDbContext<PyroFetesDbContext>();
builder.Services.AddScoped<DeliverersRepository>();
builder.Services.AddScoped<DeliveryNotesRepository>();
builder.Services.AddScoped<PricesRepository>();
builder.Services.AddScoped<ProductDeliveriesRepository>();
builder.Services.AddScoped<ProductsRepository>();
builder.Services.AddScoped<PurchaseOrdersRepository>();
builder.Services.AddScoped<PurchaseProductsRepository>();
builder.Services.AddScoped<QuotationProductsRepository>();
builder.Services.AddScoped<QuotationsRepository>();
builder.Services.AddScoped<SuppliersRepository>();
builder.Services.AddScoped<SettingsRepository>();
MapperConfiguration mappingConfig = new(mc =>
{