Adds JetBrains.Annotations to reduce amount of false positives by static code analysis

This commit is contained in:
Jonathan Bourdon
2024-08-07 03:29:59 -04:00
parent f3b225d3a8
commit 7baf1146ac
42 changed files with 118 additions and 119 deletions

View File

@@ -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 ChangeBannerRequest(
Guid CreatorId,
IFormFile File);
[PublicAPI]
public class ChangeBannerHandler(
IHttpContextAccessor contextAccessor,
ContentDbContext context,
IBlobStorage blobStorage)
: Endpoint<ChangeBannerRequest>
@@ -22,7 +21,7 @@ public class ChangeBannerHandler(
Options(o => o.WithTags("Contents"));
AllowFileUploads();
}
public override async Task HandleAsync(ChangeBannerRequest request, CancellationToken ct)
{
var creator = await context
@@ -37,7 +36,7 @@ public class ChangeBannerHandler(
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 ChangeBannerHandler(
request.File.OpenReadStream(),
request.File.ContentType,
ct);
creator.Images.Banner = blobUrl;
await context.SaveChangesAsync(ct);
await SendOkAsync(blobUrl, ct);
}
}