using FastEndpoints; using Hutopy.Web.Messages.Data; using Microsoft.EntityFrameworkCore; namespace Hutopy.Web.Messages.Handlers; public class GetMessages( MessagingDbContext context) : EndpointWithoutRequest> { public override void Configure() { Tags("Messages"); Get("/api/messages/{ContentId:guid}"); AllowAnonymous(); } public override async Task HandleAsync( CancellationToken ct) { var contentId = Route("ContentId"); var comments = await context .Messages .Where(c => c.ContentId == contentId) .ToListAsync(cancellationToken: ct); await SendAsync(comments, cancellation: ct); } }