Add GetCreatorByAlias and CreatorAlias to User

This commit is contained in:
Jonathan Bourdon
2024-07-02 03:11:06 -04:00
parent bc2dc969ff
commit eb2136083b
13 changed files with 737 additions and 20 deletions

View File

@@ -0,0 +1,29 @@
using FastEndpoints;
using Hutopy.Application.Common.Interfaces;
using Hutopy.Application.Common.Models;
namespace Hutopy.Web.Creators.Handlers;
public class GetCreatorByAlias(
IIdentityService identityService)
: EndpointWithoutRequest<UserModel?>
{
public override void Configure()
{
Tags("Creators");
Get("/api/creators/@{CreatorAlias}");
AllowAnonymous();
}
public override async Task HandleAsync(
CancellationToken ct)
{
var creatorAlias = Route<string>("CreatorAlias");
ArgumentException.ThrowIfNullOrEmpty(creatorAlias);
var user = await identityService.FindUserByCreatorAliasAsync(creatorAlias, ct);
await SendAsync(user, cancellation: ct);
}
}

View File

@@ -1,7 +1,6 @@
@using Hutopy.Infrastructure.Identity
@using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@{
string? returnUrl = null;