| 123456789101112131415161718192021222324252627282930 |
- using System.Security.Claims;
- using Web.Api.Common;
- using Web.Api.Extensions;
- using Application.Abstractions.Messaging;
- namespace Web.Api.Endpoints.Store;
- /// <summary>상점 — 보관함 쿠폰 사용 처리. 평문 코드 1회 노출.</summary>
- internal sealed class InventoryUse : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapPost("api/store/inventory/{id:int}/use", async (
- int id,
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetRequiredMemberID();
- var result = await sender.Send(new Application.Features.Api.Store.Inventory.Use.Command(memberID, id), ct);
- return result.Match(
- data => ApiResponse.Ok(data),
- CustomResults.Problem
- );
- })
- .WithTags("Store")
- .RequireAuthorization();
- }
- }
|