using MediatR; using Web.Api.Common; namespace Web.Api.Endpoints.Forum.Post; internal sealed class Search : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/forum/posts", async ( ISender sender, CancellationToken ct, int? boardID = null, int? search = null, string? keyword = null, string? startAt = null, string? endAt = null, int? sort = null, bool? isNotice = null, bool? isSecret = null, bool? isReply = null, bool? isDeleted = null, int pageNum = 1, ushort perPage = 20 ) => { var query = new Application.Features.Api.Forum.Post.Search.Query( boardID, search, keyword, startAt, endAt, sort, isNotice, isSecret, isReply, isDeleted, pageNum, perPage ); return ApiResponse.Ok(await sender.Send(query, ct)); }) .WithTags("Forum") .AllowAnonymous(); } }