MarkRead.cs 895 B

1234567891011121314151617181920212223242526272829
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. using System.Security.Claims;
  5. namespace Web.Api.Endpoints.Notification;
  6. /// <summary>알림 읽음 처리</summary>
  7. internal sealed class MarkRead : IEndpoint
  8. {
  9. public void MapEndpoint(IEndpointRouteBuilder app)
  10. {
  11. /// 개별(notificationID) 또는 전체 읽음 처리. 뱃지 카운트 갱신.
  12. app.MapPost("api/notification/read", async (
  13. Application.Features.Api.Notification.MarkRead.Command body,
  14. ClaimsPrincipal user,
  15. ISender sender,
  16. CancellationToken ct
  17. ) => {
  18. var memberID = user.GetRequiredMemberID();
  19. var command = body with { MemberID = memberID };
  20. await sender.Send(command, ct);
  21. return ApiResponse.Ok();
  22. })
  23. .WithTags("Notification")
  24. .RequireAuthorization();
  25. }
  26. }