| 123456789101112131415161718192021222324252627 |
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- namespace Web.Api.Endpoints.Feed;
- internal sealed class All : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapGet("api/feed/all", async (
- int? page,
- int? perPage,
- ISender sender,
- CancellationToken ct
- ) => {
- var query = new Application.Features.Api.Feed.GetAll.Query(
- page is > 0 ? page.Value : 1,
- (ushort)Math.Clamp(perPage ?? 20, 1, 50)
- );
- var result = await sender.Send(query, ct);
- return ApiResponse.Ok(result);
- })
- .WithTags("Feed");
- }
- }
|