many fixes and improvements - rework for modules/ and common/

feat(emailer): add Postmark and Resend providers
This commit is contained in:
2025-06-06 12:21:43 -04:00
parent 31ba18fa8d
commit 25b94d3e02
313 changed files with 6586 additions and 18260 deletions

View File

@@ -0,0 +1,44 @@
using Hutopy.Modules.Messaging.Data;
namespace Hutopy.Modules.Messaging.Handlers;
public sealed class GetMessageCountRequest
{
public Guid SubjectId { get; set; }
[BindFrom("page_size")] public int PageSize { get; set; } = 1000;
}
public record struct GetMessageCountResponse
{
public required int Count { get; init; }
}
public class GetMessageCount(
MessagingDbContext context)
: Endpoint<GetMessageCountRequest, GetMessageCountResponse>
{
public override void Configure()
{
Get("/api/messages/{SubjectId:guid}/count");
Options(o => o.WithTags("Messages"));
AllowAnonymous();
}
public override async Task HandleAsync(
GetMessageCountRequest req,
CancellationToken ct)
{
var messageCount = await context.GetMessageCountAsync(
req.SubjectId,
null,
req.PageSize,
ct);
await SendAsync(
new()
{
Count = messageCount
},
cancellation: ct);
}
}