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
@@ -17,7 +17,7 @@ public class AddProductToSupplierEndpoint(
public override void Configure()
{
Post("/suppliers/{@SupplierId}/{@ProductId}/", x => new { x.SupplierId, x.ProductId });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CreatePriceDto req, CancellationToken ct)
@@ -10,7 +10,7 @@ public class CreateSupplierEndpoint(SuppliersRepository suppliersRepository, Aut
public override void Configure()
{
Post("/suppliers");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct)
@@ -16,7 +16,7 @@ public class DeleteProductToSupplierEndpoint(PricesRepository pricesRepository)
public override void Configure()
{
Delete("/suppliers/{@SupplierId}/{@Product}", x => new { x.SupplierId, x.ProductId });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(DeletePriceRequest req, CancellationToken ct)
@@ -15,7 +15,7 @@ public class DeleteSupplierEndpoint(SuppliersRepository suppliersRepository) : E
public override void Configure()
{
Delete("/suppliers/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct)
@@ -9,7 +9,7 @@ public class GetAllSuppliersEndpoint(SuppliersRepository suppliersRepository) :
public override void Configure()
{
Get("/suppliers");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CancellationToken ct)
@@ -16,7 +16,7 @@ public class GetSupplierEndpoint(SuppliersRepository suppliersRepository, AutoMa
public override void Configure()
{
Get("/suppliers/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct)
@@ -13,7 +13,7 @@ public class PatchPriceEndpoint(
public override void Configure()
{
Patch("/prices/{@ProductId}/{@SupplierId}/SellingPrice", x => new { x.ProductId, x.SupplierId });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(PatchPriceSellingPriceDto req, CancellationToken ct)
@@ -12,7 +12,8 @@ public class PatchSupplierDeliveryDelayEndpoint(SuppliersRepository suppliersRep
public override void Configure()
{
Patch("/suppliers/{@Id}/deliveryDelay", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(PatchSupplierDeliveryDelayDto req, CancellationToken ct)
@@ -11,7 +11,7 @@ public class UpdateSupplierEndpoint(SuppliersRepository suppliersRepository, Aut
public override void Configure()
{
Put("/suppliers/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct)