| 12345678910111213141516171819202122232425262728293031 |
- using System.Security.Claims;
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Note;
- /// <summary>쪽지 상세 — 호출 시 자동 읽음 처리 + 발신자에게 NoteRead 알림</summary>
- internal sealed class Detail : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapGet("api/note/{id:int}", async (
- int id,
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetRequiredMemberID();
- var query = new Application.Features.Api.Note.GetDetail.Query(id, memberID);
- var result = await sender.Send(query, ct);
- return result.Match(
- data => ApiResponse.Ok(data),
- CustomResults.Problem
- );
- })
- .WithTags("Note")
- .RequireAuthorization();
- }
- }
|