diff --git a/PyroFetes/DTO/Customer/Response/GetCustomerDto.cs b/PyroFetes/DTO/Customer/Response/GetCustomerDto.cs new file mode 100644 index 0000000..53105bf --- /dev/null +++ b/PyroFetes/DTO/Customer/Response/GetCustomerDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Customer.Response; + +public class GetCustomerDto +{ + public int Id { get; set; } + public string? Note { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/PurchaseOrder/Request/CreatePurchaseOrderDto.cs b/PyroFetes/DTO/PurchaseOrder/Request/CreatePurchaseOrderDto.cs index 12e3c20..87d17c1 100644 --- a/PyroFetes/DTO/PurchaseOrder/Request/CreatePurchaseOrderDto.cs +++ b/PyroFetes/DTO/PurchaseOrder/Request/CreatePurchaseOrderDto.cs @@ -5,5 +5,6 @@ namespace PyroFetes.DTO.PurchaseOrder.Request; public class CreatePurchaseOrderDto { public string? PurchaseConditions { get; set; } + public int SupplierId { get; set; } public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Quotation/Request/CreateQuotationDto.cs b/PyroFetes/DTO/Quotation/Request/CreateQuotationDto.cs index e775c9f..890f999 100644 --- a/PyroFetes/DTO/Quotation/Request/CreateQuotationDto.cs +++ b/PyroFetes/DTO/Quotation/Request/CreateQuotationDto.cs @@ -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? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Endpoints/Customers/GetAllCustomersEndpoint.cs b/PyroFetes/Endpoints/Customers/GetAllCustomersEndpoint.cs new file mode 100644 index 0000000..75503af --- /dev/null +++ b/PyroFetes/Endpoints/Customers/GetAllCustomersEndpoint.cs @@ -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> +{ + public override void Configure() + { + Get("/customers"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + await Send.OkAsync(await customersRepository.ProjectToListAsync(ct), ct); + } +} \ No newline at end of file diff --git a/PyroFetes/MappingProfiles/EntityToDtoMappings.cs b/PyroFetes/MappingProfiles/EntityToDtoMappings.cs index 6e4c985..3e5ea84 100644 --- a/PyroFetes/MappingProfiles/EntityToDtoMappings.cs +++ b/PyroFetes/MappingProfiles/EntityToDtoMappings.cs @@ -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(); CreateMap(); + + CreateMap(); } } \ No newline at end of file diff --git a/PyroFetes/Program.cs b/PyroFetes/Program.cs index bf236f3..262fbb2 100644 --- a/PyroFetes/Program.cs +++ b/PyroFetes/Program.cs @@ -50,6 +50,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); // Ajout des services builder.Services.AddScoped(); diff --git a/PyroFetes/Repositories/CustomersRepository.cs b/PyroFetes/Repositories/CustomersRepository.cs new file mode 100644 index 0000000..ba29a90 --- /dev/null +++ b/PyroFetes/Repositories/CustomersRepository.cs @@ -0,0 +1,5 @@ +using PyroFetes.Models; + +namespace PyroFetes.Repositories; + +public class CustomersRepository(PyroFetesDbContext pyrofetesContext, AutoMapper.IMapper mapper) : PyrofetesRepository(pyrofetesContext, mapper); \ No newline at end of file