Mention.cs 830 B

1234567891011121314151617181920212223242526272829303132
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. using System.Security.Claims;
  5. namespace Web.Api.Endpoints.Forum.Comment;
  6. internal sealed class Mention : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapGet("api/forum/comments/mention", async (
  11. ClaimsPrincipal user,
  12. ISender sender,
  13. CancellationToken ct,
  14. int postID,
  15. string? keyword = null
  16. ) =>
  17. {
  18. var memberID = user.GetMemberID();
  19. return ApiResponse.Ok(
  20. await sender.Send(
  21. new Application.Features.Api.Forum.Comment.Mention.Query(postID, keyword, memberID),
  22. ct
  23. )
  24. );
  25. })
  26. .WithTags("Forum")
  27. .AllowAnonymous();
  28. }
  29. }