Add endpoint to display all customers, and updated dto to create quotation and purchase order
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace PyroFetes.DTO.Customer.Response;
|
||||
|
||||
public class GetCustomerDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Note { get; set; }
|
||||
}
|
||||
@@ -5,5 +5,6 @@ namespace PyroFetes.DTO.PurchaseOrder.Request;
|
||||
public class CreatePurchaseOrderDto
|
||||
{
|
||||
public string? PurchaseConditions { get; set; }
|
||||
public int SupplierId { get; set; }
|
||||
public List<CreatePurchaseOrderProductDto>? Products { get; set; }
|
||||
}
|
||||
@@ -6,5 +6,7 @@ public class CreateQuotationDto
|
||||
{
|
||||
public string? Message { get; set; }
|
||||
public string? ConditionsSale { get; set; }
|
||||
public int CustomerId { get; set; }
|
||||
public int SupplierId { get; set; }
|
||||
public List<CreateProductQuotationDto>? Products { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FastEndpoints;
|
||||
using PyroFetes.DTO.Customer.Response;
|
||||
using PyroFetes.Repositories;
|
||||
|
||||
namespace PyroFetes.Endpoints.Customers;
|
||||
|
||||
public class GetAllCustomersEndpoint(CustomersRepository customersRepository, AutoMapper.IMapper mapper) : EndpointWithoutRequest<List<GetCustomerDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/customers");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
await Send.OkAsync(await customersRepository.ProjectToListAsync<GetCustomerDto>(ct), ct);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using PyroFetes.DTO.Customer.Response;
|
||||
using PyroFetes.DTO.Deliverer.Response;
|
||||
using PyroFetes.DTO.DeliveryNote.Response;
|
||||
using PyroFetes.DTO.Price.Response;
|
||||
@@ -59,5 +60,7 @@ public class EntityToDtoMappings : Profile
|
||||
CreateMap<WarehouseProduct, GetWareHouseProductDto>();
|
||||
|
||||
CreateMap<Warehouse, GetWareHouseDto>();
|
||||
|
||||
CreateMap<Customer, GetCustomerDto>();
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ builder.Services.AddScoped<SettingsRepository>();
|
||||
builder.Services.AddScoped<UsersRepository>();
|
||||
builder.Services.AddScoped<WarehouseProductsRepository>();
|
||||
builder.Services.AddScoped<WareHouseRepository>();
|
||||
builder.Services.AddScoped<CustomersRepository>();
|
||||
|
||||
// Ajout des services
|
||||
builder.Services.AddScoped<IDeliveryNotePdfService, DeliveryNotePdfService>();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Repositories;
|
||||
|
||||
public class CustomersRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository<Customer>(pyrofetesContext, mapper);
|
||||
Reference in New Issue
Block a user