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
@@ -15,7 +15,8 @@ public class DeleteProductEndpoint(ProductsRepository productsRepository) : Endp
public override void Configure()
{
Delete("/products/{@Id}", x => new { x.ProductId });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(DeleteProductsRequest req, CancellationToken ct)
@@ -9,7 +9,7 @@ public class GetAllProductsEndpoint(ProductsRepository productsRepository) : End
public override void Configure()
{
Get("/products");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CancellationToken ct)
@@ -10,7 +10,7 @@ public class GetAllProductsUnderLimitEndpoint(ProductsRepository productsReposit
public override void Configure()
{
Get("/products/underLimit");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CancellationToken ct)
@@ -18,7 +18,8 @@ public class GetProductEndpoint(
public override void Configure()
{
Get("/products/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
@@ -11,7 +11,7 @@ public class PatchProductMinimalStockEndpoint(ProductsRepository productsReposit
public override void Configure()
{
Patch("/products/{@Id}/MinimalStock", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(PatchProductMinimalStockDto req, CancellationToken ct)
@@ -11,7 +11,7 @@ public class UpdateProductEndpoint(ProductsRepository productsRepository, AutoMa
public override void Configure()
{
Put("/products/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)