#67 added blob storage service + endpoints for profile picture. WIP

This commit is contained in:
Dominic Villemure
2024-06-23 20:24:15 -04:00
parent 0a9c3ec94c
commit ab88511f22
15 changed files with 338 additions and 2 deletions

View File

@@ -9,11 +9,17 @@ public class GetMyUser : EndpointGroupBase
{
app.MapGroup(this)
.RequireAuthorization()
.MapGet(GetCurrentUser);
.MapGet(GetCurrentUser)
.MapGet(GetCurrentUserProfilePicture, "profile-picture");
}
private static async Task<UserDto> GetCurrentUser(ISender sender, [AsParameters] GetCurrentUserQuery query)
{
return await sender.Send(query);
}
private static async Task<Stream> GetCurrentUserProfilePicture(ISender sender, [AsParameters] GetCurrentUserProfilePictureQuery query)
{
return await sender.Send(query);
}
}

View File

@@ -10,6 +10,7 @@ public class Users : EndpointGroupBase
app.MapGroup(this)
.MapPost(CreateUser)
.MapPost(Login, "/login")
.MapPost(UploadProfilePicture, "/upload-profile-picture")
.MapGet(GetMinimalUser);
}
@@ -27,4 +28,13 @@ public class Users : EndpointGroupBase
{
return await sender.Send(command);
}
private static async Task<string> UploadProfilePicture(ISender sender, Stream stream)
{
var command = new UploadProfilePictureCommand
{
ProfilePicture = stream
};
return await sender.Send(command);
}
}