first commit
This commit is contained in:
19
BookHive/Endpoints/Books/GetBooksEndpoint.cs
Normal file
19
BookHive/Endpoints/Books/GetBooksEndpoint.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user