Files
TP-Fluent/BookHive/Endpoints/Authors/GetAuthorsEndpoint.cs
2026-03-17 10:27:53 +01:00

19 lines
504 B
C#

using BookHive.DTO.Author;
using BookHive.Repositories;
using FastEndpoints;
namespace BookHive.Endpoints.Authors;
public class GetAuthorsEndpoint(AuthorRepository authorRepository) : EndpointWithoutRequest<List<GetAuthorDto>>
{
public override void Configure()
{
Get("/authors/");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await authorRepository.ProjectToListAsync<GetAuthorDto>(ct), ct);
}
}