| 1234567891011121314151617181920212223242526272829 |
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Stocks;
- /// <summary>종목 배당 이력 — 단축코드(6자리) 배당 이력. 시가배당율·주당배당금·권리락일 포함 (익명 열람). 종목 상세 배당탭.</summary>
- 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();
- }
- }
|