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,49 @@
using Hutopy.Infrastructure.Security;
using Hutopy.Modules.Identity.Contracts;
using Hutopy.Modules.Tipping.Data;
using Hutopy.Modules.Tipping.Models;
namespace Hutopy.Modules.Tipping.Handlers;
[PublicAPI]
public record struct GetReceivedTipsResponse(
IEnumerable<TipReceivedModel> Tips);
[PublicAPI]
public class GetReceivedTipsHandler(
IUserLookup userLookup,
TippingDbContext dbContext)
: EndpointWithoutRequest<GetReceivedTipsResponse>
{
public override void Configure()
{
Get("/api/tips");
Options(o => o.WithTags("Tips"));
}
public override async Task HandleAsync(
CancellationToken ct)
{
var tips = await dbContext
.Tips
.Where(tip => tip.CreatorId == User.GetUserId())
.ToListAsync(ct);
var result = await Task.WhenAll(
tips.Select(async tip =>
{
var tipper = await userLookup.GetUserAsync(tip.CreatorId, ct);
return new TipReceivedModel(
tip.Id,
tip.CreatedAt,
tip.CreatedBy,
tipper?.Fullname ?? "Unknown User",
tip.Amount,
tip.Currency,
tip.Message);
}));
await SendOkAsync(new GetReceivedTipsResponse(result), ct);
}
}