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