mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
Add user avatar and profile feature, consolidate Auth and UserManagement features (#257)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using MediatR;
|
||||
|
||||
namespace Features.Auth.Commands.Profile.UpdateBiography;
|
||||
|
||||
/// <summary>Updates the biography of the given user account's profile.</summary>
|
||||
/// <param name="UserAccountId">
|
||||
/// The authenticated caller's own ID, extracted from the access token -- never bind this from
|
||||
/// client-supplied input.
|
||||
/// </param>
|
||||
public record UpdateBiographyCommand(Guid UserAccountId, string Biography) : IRequest;
|
||||
@@ -0,0 +1,19 @@
|
||||
using Features.Auth.Repository;
|
||||
using MediatR;
|
||||
|
||||
namespace Features.Auth.Commands.Profile.UpdateBiography;
|
||||
|
||||
/// <summary>Handles <see cref="UpdateBiographyCommand" /> by updating the stored biography.</summary>
|
||||
public class UpdateBiographyHandler(IUserProfileRepository userProfileRepository)
|
||||
: IRequestHandler<UpdateBiographyCommand>
|
||||
{
|
||||
/// <exception cref="Domain.Exceptions.NotFoundException">
|
||||
/// Thrown when no user profile exists for the given user account.
|
||||
/// </exception>
|
||||
public Task Handle(UpdateBiographyCommand request, CancellationToken cancellationToken) =>
|
||||
userProfileRepository.UpdateBiographyAsync(
|
||||
request.UserAccountId,
|
||||
request.Biography,
|
||||
cancellationToken
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user