| 12345678910111213141516171819202122232425262728 |
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Chat;
- /// <summary>룸 최근 메시지 히스토리 — roomKey = main | stock:{code}, 익명 열람 허용 (게스트 읽기 — d0 §5-④)</summary>
- internal sealed class History : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapGet("api/chat/rooms/{roomKey}/messages", async (
- string roomKey,
- ISender sender,
- CancellationToken ct,
- int count = 50
- ) => {
- var result = await sender.Send(new Application.Features.Api.Chat.GetHistory.Query(roomKey, count), ct);
- return result.Match(
- data => ApiResponse.Ok(data),
- CustomResults.Problem
- );
- })
- .WithTags("Chat")
- .AllowAnonymous();
- }
- }
|