+ Memberships
- DDD
- FutureCreator
- UserTransactions
This commit is contained in:
2024-10-20 14:01:58 -04:00
parent 3d10427821
commit 28d74503df
117 changed files with 2149 additions and 1999 deletions

View File

@@ -0,0 +1,45 @@
using Hutopy.Web.Common;
using Hutopy.Web.Features.Memberships.Data;
namespace Hutopy.Web.Features.Memberships.Handlers;
[PublicAPI]
public record struct TipSentModel(
Guid Id,
DateTimeOffset CreatedAt,
Guid CreatorId,
string CreatorName,
decimal Amount,
string Currency,
string Message);
[PublicAPI]
public class GetSentTipsHandler(
MembershipDbContext dbContext)
: EndpointWithoutRequest<List<TipSentModel>>
{
public override void Configure()
{
Get("/api/tips/sent");
Options(o => o.WithTags("Memberships"));
}
public override async Task HandleAsync(
CancellationToken ct)
{
var tips = await dbContext
.Tips
.Where(t => t.TipperId == User.GetUserId())
.Select(tip => new TipSentModel(
tip.Id,
tip.CreatedAt,
tip.CreatorId,
tip.CreatorName,
tip.Amount,
tip.Currency,
tip.Message))
.ToListAsync(ct);
await SendOkAsync(tips, ct);
}
}