diff --git a/PyroFetes/Endpoints/DeliveryNotes/GetDeliveryNotePdfEndpoint.cs b/PyroFetes/Endpoints/DeliveryNotes/GetDeliveryNotePdfEndpoint.cs index e9dd25a..76bbbab 100644 --- a/PyroFetes/Endpoints/DeliveryNotes/GetDeliveryNotePdfEndpoint.cs +++ b/PyroFetes/Endpoints/DeliveryNotes/GetDeliveryNotePdfEndpoint.cs @@ -1,4 +1,5 @@ -using FastEndpoints; +using System.Net.Mime; +using FastEndpoints; using PyroFetes.DTO.DeliveryNote.Request; using PyroFetes.Models; using PyroFetes.Repositories; @@ -11,12 +12,13 @@ namespace PyroFetes.Endpoints.DeliveryNotes; public class GetDeliveryNotePdfEndpoint( DeliveryNotesRepository deliveryNotesRepository, IDeliveryNotePdfService deliveryNotePdfService) - : Endpoint + : Endpoint { public override void Configure() { Get("/deliveryNotes/{@Id}/pdf", x => new {x.Id}); AllowAnonymous(); + Description(b => b.Produces(200, MediaTypeNames.Application.Pdf)); } public override async Task HandleAsync(GetDeliveryNotePdfDto req, CancellationToken ct) diff --git a/PyroFetes/Endpoints/PurchaseOrders/GetPurchaseOrderPdfEndpoint.cs b/PyroFetes/Endpoints/PurchaseOrders/GetPurchaseOrderPdfEndpoint.cs index a0f48df..a044b50 100644 --- a/PyroFetes/Endpoints/PurchaseOrders/GetPurchaseOrderPdfEndpoint.cs +++ b/PyroFetes/Endpoints/PurchaseOrders/GetPurchaseOrderPdfEndpoint.cs @@ -1,4 +1,5 @@ -using FastEndpoints; +using System.Net.Mime; +using FastEndpoints; using PyroFetes.DTO.PurchaseOrder.Request; using PyroFetes.Models; using PyroFetes.Repositories; @@ -9,12 +10,13 @@ namespace PyroFetes.Endpoints.PurchaseOrders; public class GetPurchaseOrderPdfEndpoint( PurchaseOrdersRepository purchaseOrdersRepository, IPurchaseOrderPdfService purchaseOrderPdfService) - : Endpoint + : Endpoint { public override void Configure() { Get("/purchaseOrders/{@Id}/pdf", x => new {x.Id}); AllowAnonymous(); + Description(b => b.Produces(200, MediaTypeNames.Application.Pdf)); } public override async Task HandleAsync(GetPurchaseOrderPdfDto req, CancellationToken ct) diff --git a/PyroFetes/Endpoints/Quotations/GetQuotationPdfEndpoint.cs b/PyroFetes/Endpoints/Quotations/GetQuotationPdfEndpoint.cs index 1b425f9..2920172 100644 --- a/PyroFetes/Endpoints/Quotations/GetQuotationPdfEndpoint.cs +++ b/PyroFetes/Endpoints/Quotations/GetQuotationPdfEndpoint.cs @@ -1,4 +1,5 @@ -using FastEndpoints; +using System.Net.Mime; +using FastEndpoints; using PyroFetes.DTO.Quotation.Request; using PyroFetes.Models; using PyroFetes.Repositories; @@ -10,12 +11,13 @@ namespace PyroFetes.Endpoints.Quotations; public class GetQuotationPdfEndpoint( QuotationsRepository quotationRepository, IQuotationPdfService quotationPdfService) - : Endpoint + : Endpoint { public override void Configure() { Get("/quotations/{@Id}/pdf", x => new {x.Id}); AllowAnonymous(); + Description(b => b.Produces(200, MediaTypeNames.Application.Pdf)); } public override async Task HandleAsync(GetQuotationPdfDto req, CancellationToken ct) diff --git a/PyroFetes/Program.cs b/PyroFetes/Program.cs index c57c5b1..83ef61b 100644 --- a/PyroFetes/Program.cs +++ b/PyroFetes/Program.cs @@ -4,6 +4,7 @@ using PyroFetes; using FastEndpoints; using FastEndpoints.Swagger; using FastEndpoints.Security; +using Microsoft.Net.Http.Headers; using PyroFetes.MappingProfiles; using PyroFetes.Repositories; using PyroFetes.Services.Pdf; @@ -30,7 +31,8 @@ builder.Services policyBuilder .WithOrigins("http://localhost:4200") .WithMethods("GET", "POST", "PUT", "DELETE", "PATCH") - .AllowAnyHeader(); + .AllowAnyHeader() + .WithExposedHeaders(HeaderNames.ContentDisposition); }); });