Put roles into endpoints

This commit is contained in:
Cristiano
2026-05-28 15:36:33 +02:00
parent fc9da89ebe
commit 5869ae18c4
61 changed files with 68 additions and 61 deletions
@@ -14,7 +14,7 @@ public class AddProductoToQuotationEndpoint(
public override void Configure()
{
Post("/quotations/{@Id}/products", x => new { x.ProductId, x.QuotationId });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(AddQuotationProductDto req, CancellationToken ct)
@@ -17,7 +17,7 @@ public class CreateQuotationEndpoint(
public override void Configure()
{
Post("/quotations");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CreateQuotationDto req, CancellationToken ct)
@@ -16,7 +16,7 @@ public class DeleteProductFromQuotationEndpoint(QuotationProductsRepository quot
public override void Configure()
{
Delete("/quotations/{@ProductId}/{@QuotationId}", x => new { x.ProductId, x.QuotationId });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(DeleteQuotationProductRequest req, CancellationToken ct)
@@ -15,7 +15,8 @@ public class DeleteQuotationEndpoint(QuotationsRepository quotationsRepository)
public override void Configure()
{
Delete("/quotations/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(DeleteQuotationRequest req, CancellationToken ct)
@@ -10,7 +10,7 @@ public class GetAllQuotationEndpoint(QuotationsRepository quotationsRepository)
public override void Configure()
{
Get("/quotations");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CancellationToken ct)
@@ -18,7 +18,7 @@ public class GetQuotationEndpoint(
public override void Configure()
{
Get("/quotations/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(GetQuotationRequest req, CancellationToken ct)
@@ -17,7 +17,7 @@ public class GetQuotationPdfEndpoint(
public override void Configure()
{
Get("/quotations/{@Id}/pdf", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
Description(b => b.Produces<byte[]>(200, MediaTypeNames.Application.Pdf));
}
@@ -14,7 +14,7 @@ public class PatchQuotationConditionsSaleEndpoint(
public override void Configure()
{
Patch("/quotations/{@Id}/saleConditions", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(PatchQuotationConditionsSaleDto req, CancellationToken ct)
@@ -14,7 +14,7 @@ public class PatchQuotationMessageEndpoint(
public override void Configure()
{
Patch("/quotations/{@Id}/message", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(PatchQuotationMessageDto req, CancellationToken ct)
@@ -14,7 +14,7 @@ public class PatchQuotationProductQuantityEndpoint(
public override void Configure()
{
Patch("/quotations/{@ProductId}/{@QuotationId}/Quantity", x => new { x.ProductId, x.QuotationId });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(PatchQuotationProductQuantityDto req, CancellationToken ct)
@@ -13,7 +13,8 @@ public class UpdateQuotationEndpoint(
public override void Configure()
{
Put("/quotations/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(UpdateQuotationDto req, CancellationToken ct)