using System.Security.Claims; using MediatR; using Web.Api.Common; using Web.Api.Extensions; namespace Web.Api.Endpoints.Wallet; internal sealed class MyWallet : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/wallet", async ( ClaimsPrincipal user, ISender sender, CancellationToken ct ) => { var memberID = user.GetMemberID(); if (memberID is null) { return ApiResponse.Fail(StatusCodes.Status401Unauthorized, "Invalid token"); } var result = await sender.Send(new Application.Features.Api.Member.Wallet.GetMy.Query(memberID.Value), ct); return ApiResponse.Ok(result); }) .WithTags("Wallet") .RequireAuthorization(); } }