| 1234567891011121314151617181920212223242526272829303132 |
- using System.Security.Claims;
- using MediatR;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Studio.Wallet;
- /// <summary>지갑 — 출금 신청</summary>
- internal sealed class WithdrawRequest : IEndpoint
- {
- public sealed record Body(int AccountID, int Amount);
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapPost("api/studio/wallet/withdraw", async (
- Body body,
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetRequiredMemberID();
- var result = await sender.Send(new Application.Features.Api.Studio.Wallet.RequestWithdraw.Command(memberID, body.AccountID, body.Amount), ct);
- return result.Match(
- data => ApiResponse.Ok(data),
- CustomResults.Problem
- );
- })
- .WithTags("StudioWallet")
- .RequireAuthorization();
- }
- }
|