Files
TP-Fluent/BookHive/Endpoints/Books/GetBooksEndpoint.cs
2026-03-09 22:09:10 +01:00

19 lines
490 B
C#

using BookHive.DTO.Book;
using BookHive.Repositories;
using FastEndpoints;
namespace BookHive.Endpoints.Books;
public class GetBooksEndpoint(BookRepository bookRepository) : EndpointWithoutRequest<List<GetBookDto>>
{
public override void Configure()
{
Get("/books/");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await bookRepository.ProjectToListAsync<GetBookDto>(ct), ct);
}
}