Add GetCreatorByAlias and CreatorAlias to User
This commit is contained in:
29
src/Web/Creators/Handlers/GetCreatorByAlias.cs
Normal file
29
src/Web/Creators/Handlers/GetCreatorByAlias.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
@using Hutopy.Infrastructure.Identity
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
|
||||
@{
|
||||
string? returnUrl = null;
|
||||
|
||||
Reference in New Issue
Block a user