using Application.Abstractions.Messaging; using Web.Api.Common; using Web.Api.Extensions; namespace Web.Api.Endpoints.Stocks; /// 종목 배당 이력 — 단축코드(6자리) 배당 이력. 시가배당율·주당배당금·권리락일 포함 (익명 열람). 종목 상세 배당탭. internal sealed class Dividends : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/stocks/{code:regex(^\\d{{6}}$)}/dividends", async ( string code, ISender sender, int page = 1, ushort perPage = 30, CancellationToken ct = default ) => { var result = await sender.Send(new Application.Features.Api.Stocks.GetStockDividends.Query(code, page, perPage), ct); return result.Match( () => ApiResponse.Ok(result.Value), CustomResults.Problem ); }) .WithTags("Stocks") .AllowAnonymous(); } }