Adds JetBrains.Annotations to reduce amount of false positives by static code analysis
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
using FastEndpoints;
|
||||
using Hutopy.Application.AzureBlobStorage.Constants;
|
||||
using Hutopy.Application.AzureBlobStorage.Constants;
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeLogoRequest(
|
||||
Guid CreatorId,
|
||||
IFormFile File);
|
||||
|
||||
[PublicAPI]
|
||||
public class ChangeLogoHandler(
|
||||
IHttpContextAccessor contextAccessor,
|
||||
ContentDbContext context,
|
||||
IBlobStorage blobStorage)
|
||||
: Endpoint<ChangeLogoRequest>
|
||||
@@ -22,7 +21,7 @@ public class ChangeLogoHandler(
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
|
||||
public override async Task HandleAsync(ChangeLogoRequest request, CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
@@ -37,7 +36,7 @@ public class ChangeLogoHandler(
|
||||
await SendNotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TODO: this upload should be done to the Creators container
|
||||
var blobUrl = await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Users,
|
||||
@@ -45,11 +44,11 @@ public class ChangeLogoHandler(
|
||||
request.File.OpenReadStream(),
|
||||
request.File.ContentType,
|
||||
ct);
|
||||
|
||||
|
||||
creator.Images.Logo = blobUrl;
|
||||
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
|
||||
await SendOkAsync(blobUrl, ct);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user