InventoryDelete.cs 915 B

123456789101112131415161718192021222324252627282930
  1. using System.Security.Claims;
  2. using Web.Api.Common;
  3. using Web.Api.Extensions;
  4. using Application.Abstractions.Messaging;
  5. namespace Web.Api.Endpoints.Store;
  6. /// <summary>상점 — 보관함 항목 소프트 삭제.</summary>
  7. internal sealed class InventoryDelete : IEndpoint
  8. {
  9. public void MapEndpoint(IEndpointRouteBuilder app)
  10. {
  11. app.MapDelete("api/store/inventory/{id:int}", async (
  12. int id,
  13. ClaimsPrincipal user,
  14. ISender sender,
  15. CancellationToken ct
  16. ) => {
  17. var memberID = user.GetRequiredMemberID();
  18. var result = await sender.Send(new Application.Features.Api.Store.Inventory.Delete.Command(memberID, id), ct);
  19. return result.Match(
  20. () => ApiResponse.Ok(),
  21. CustomResults.Problem
  22. );
  23. })
  24. .WithTags("Store")
  25. .RequireAuthorization();
  26. }
  27. }