using MediatR; using Web.Api.Common; namespace Web.Api.Endpoints.Crypto; internal sealed class CryptoTrades : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/crypto/{symbol}/trades", async ( string symbol, int? count, ISender sender, CancellationToken ct ) => { return ApiResponse.Ok( await sender.Send(new Application.Features.Api.Crypto.Trade.GetRecent.Query(symbol, count ?? 50), ct) ); }) .WithTags("Crypto") .AllowAnonymous(); app.MapGet("api/crypto/{symbol}/trades/live", async ( string symbol, ISender sender, CancellationToken ct ) => { return ApiResponse.Ok( await sender.Send(new Application.Features.Api.Crypto.Trade.GetLive.Query(symbol), ct) ); }) .WithTags("Crypto") .AllowAnonymous(); } }