Adds arps as creator

This commit is contained in:
Jonathan Bourdon
2024-08-04 04:05:36 -04:00
parent 68ef947e26
commit 2276128c4e
3 changed files with 49 additions and 12 deletions

View File

@@ -5,7 +5,7 @@ namespace Hutopy.Web.Features.Contents.Data;
public class Creator
{
public Guid Id { get; set; }
public Guid CreatedBy { get; init; }
public Guid CreatedBy { get; set; }
public DateTimeOffset CreatedAt { get; init; }
[MaxLength(255)] public string Name { get; set; } = null!;

View File

@@ -36,12 +36,16 @@ public class GetCreatorByAliasHandler(
GetCreatorByAliasRequest req,
CancellationToken ct)
{
var creatorName = req.Name.ToLower();
var creator = await context
.Creators
.SingleOrDefaultAsync(
c => EF.Functions.Like(c.Name, req.Name),
c => EF.Functions.Like(c.Name, creatorName),
cancellationToken: ct);
var creators = await context.Creators.ToListAsync(cancellationToken: ct);
if (creator is null) await SendNotFoundAsync(ct);
else await SendAsync(creator, cancellation: ct);
}