| 12345678910111213141516171819202122232425262728293031 |
- using System.Security.Claims;
- using MediatR;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Note;
- /// <summary>받은 쪽지 삭제 (soft delete — IsDeletedByReceiver)</summary>
- internal sealed class Delete : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapDelete("api/note/{id:int}", async (
- int id,
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetRequiredMemberID();
- var command = new Application.Features.Api.Note.DeleteNote.Command(id, memberID);
- var result = await sender.Send(command, ct);
- return result.Match(
- () => ApiResponse.Ok(true),
- CustomResults.Problem
- );
- })
- .WithTags("Note")
- .RequireAuthorization();
- }
- }
|