| 12345678910111213141516171819202122232425262728293031 |
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Stocks;
- /// <summary>일별 시세 히스토리 — 페이징 + 기간(from/to) 필터 (익명 열람)</summary>
- internal sealed class History : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapGet("api/stocks/{code:regex(^\\d{{6}}$)}/history", async (
- string code,
- ISender sender,
- int page = 1,
- ushort perPage = 30,
- DateOnly? from = null,
- DateOnly? to = null,
- CancellationToken ct = default
- ) => {
- var result = await sender.Send(new Application.Features.Api.Stocks.GetHistory.Query(code, page, perPage, from, to), ct);
- return result.Match(
- () => ApiResponse.Ok(result.Value),
- CustomResults.Problem
- );
- })
- .WithTags("Stocks")
- .AllowAnonymous();
- }
- }
|