+ 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,34 @@
using Hutopy.Web.Common;
using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Contents.Handlers.Models;
namespace Hutopy.Web.Features.Contents.Handlers;
[PublicAPI]
public class GetFollowedCreatorsHandler(
ContentDbContext context)
: EndpointWithoutRequest<List<FollowModel>>
{
public override void Configure()
{
Get("/api/creators/followed");
Options((o => o.WithTags("Creators")));
}
public override async Task HandleAsync(
CancellationToken ct)
{
var userId = HttpContext.User.GetUserId();
var subscriptions = await context
.Followers
.Where(s => s.CreatedBy == userId)
.Select(s => new FollowModel(
s.CreatorId,
s.Creator!.Name,
s.Creator.Images.Logo))
.ToListAsync(cancellationToken: ct);
await SendOkAsync(subscriptions, ct);
}
}