using Hutopy.Application.AzureBlobStorage.Constants; using Hutopy.Application.Common.Interfaces; namespace Hutopy.Web.Features.Users.Handlers; [PublicAPI] public class GetCurrentUserPortraitHandler( IIdentityService identityService, IBlobStorage blobStorage ) : EndpointWithoutRequest { public override void Configure() { Get("/api/users/portrait"); Options(o => o.WithTags("Users")); } public override async Task HandleAsync( CancellationToken cancellationToken) { var identityUser = await identityService.GetCurrentUserAsync(); var stream = await blobStorage.DownloadFileAsync( ContainerNames.Users, $"{identityUser.Id.ToString()}/{SubDirectoryNames.Profile}/{CommonFileNames.ProfilePicture}", cancellationToken); await SendOkAsync(stream, cancellationToken); } }