Added content type

This commit is contained in:
Dominic Villemure
2024-06-30 23:40:57 -04:00
parent 041b8178ac
commit 9481840244
7 changed files with 25 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
public static class CommonFileNames
{
public static string ProfilePicture = "profilePicture";
public static string BannerPicture = "bannerPicture";
public static string WebsiteIcon = "websiteIcon";
public static string ProfilePicture = "profilePicture.png";
public static string BannerPicture = "bannerPicture.png";
public static string WebsiteIcon = "websiteIcon.png";
}

View File

@@ -0,0 +1,6 @@
namespace Hutopy.Application.AzureBlobStorage.Constants;
public static class ContentTypes
{
public static string ImagePng = "image/png";
}

View File

@@ -2,6 +2,6 @@
public interface IAzureBlobStorageService
{
Task<string> UploadFileAsync(string containerName, string blobName, Stream fileStream);
Task<string> UploadFileAsync(string containerName, string blobName, Stream fileStream, string contentType);
Task<MemoryStream> DownloadFileAsync(string containerName, string blobName);
}

View File

@@ -17,7 +17,7 @@ public class UploadBannerPictureCommandHandler(IIdentityService identityService,
var blobName = $"{currentUserId}/{SubDirectoryNames.Profile}/{CommonFileNames.BannerPicture}";
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.BannerPicture);
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.BannerPicture, ContentTypes.ImagePng);
await identityService.UpdateCurrentUserBannerPictureUrlAsync(url);

View File

@@ -17,7 +17,7 @@ public class UploadProfilePictureCommandHandler(IIdentityService identityService
var blobName = $"{currentUserId}/{SubDirectoryNames.Profile}/{CommonFileNames.ProfilePicture}";
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.ProfilePicture);
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.ProfilePicture, ContentTypes.ImagePng);
await identityService.UpdateCurrentUserProfilePictureUrlAsync(url);

View File

@@ -17,7 +17,7 @@ public class UploadWebsiteIconCommandHandler(IIdentityService identityService, I
var blobName = $"{currentUserId}/{SubDirectoryNames.Profile}/{CommonFileNames.WebsiteIcon}";
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.WebsiteIcon);
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.WebsiteIcon, ContentTypes.ImagePng);
await identityService.UpdateCurrentUserWebsiteIconUrlAsync(url);