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
@@ -11,7 +11,7 @@ public class CreateDelivererEndpoint(DeliverersRepository deliverersRepository)
public override void Configure()
{
Post("/deliverers");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CreateDelivererDto req, CancellationToken ct)
@@ -15,7 +15,7 @@ public class DeleteDelivererEndpoint(DeliverersRepository deliverersRepository)
public override void Configure()
{
Delete("/deliverers/{@Id}", x => new { x.DelivererId });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(DeleteDelivererRequest req, CancellationToken ct)
@@ -9,7 +9,7 @@ public class GetAllDelivererEndpoint(DeliverersRepository deliverersRepository)
public override void Configure()
{
Get("/deliverers");
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(CancellationToken ct)
@@ -16,7 +16,7 @@ public class GetDelivererEndpoint(DeliverersRepository deliverersRepository, Aut
public override void Configure()
{
Get("/deliverers/{@Id}", x => new { x.DelivererId });
AllowAnonymous();
Roles("Admin","Employe");
}
public override async Task HandleAsync(GetDelivererRequest req, CancellationToken ct)
@@ -12,7 +12,7 @@ public class UpdateDelivererEndpoint(DeliverersRepository deliverersRepository,
public override void Configure()
{
Put("/deliverers/{@Id}", x => new { x.Id });
AllowAnonymous();
Roles("Admin");
}
public override async Task HandleAsync(UpdateDelivererDto req, CancellationToken ct)