1
This commit is contained in:
22
Yes.Blog/Endpoints/Admins/Comments/GetCommentsEndpoint.cs
Normal file
22
Yes.Blog/Endpoints/Admins/Comments/GetCommentsEndpoint.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Yes.Blog.Endpoints.Admins.Comments
|
||||
{
|
||||
public class GetCommentsEndpoint : AdminEndpointScheme, IEndpoint
|
||||
{
|
||||
public void Map(IEndpointRouteBuilder app) => app.MapGet("/comments", Handle);
|
||||
|
||||
public record Request(int? PageIndex);
|
||||
|
||||
|
||||
private async Task<IResult> Handle(
|
||||
[AsParameters] Request request,
|
||||
IMediator mediator,
|
||||
IMapper mapper,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var query = new GetCommentsQuery(request.PageIndex, 15);
|
||||
var response = await mediator.Send(query, cancellationToken);
|
||||
|
||||
return Result.Ok(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user