внедрил систему статусов (BIO)

This commit is contained in:
max
2026-04-17 18:33:46 +03:00
parent ae710c3d43
commit d2e6eb578a
14 changed files with 280 additions and 17 deletions
@@ -2,5 +2,11 @@ using System;
namespace Knot.Modules.Profiles.Application.Profiles.DTOs;
public record UpdateProfileRequest(string? DisplayName, string? Bio, DateTime? Birthday);
public record UpdateProfileRequest(
string? DisplayName,
string? Bio,
DateTime? Birthday,
string? StatusText,
string? StatusEmoji,
DateTime? StatusExpiresAt);
public record UpdateSettingsRequest(bool? HideStoryViews);
@@ -11,7 +11,10 @@ public sealed record UpdateProfileCommand(
Guid UserId,
string? DisplayName,
string? Bio,
DateTime? Birthday) : ICommand<UserProfileDto>;
DateTime? Birthday,
string? StatusText,
string? StatusEmoji,
DateTime? StatusExpiresAt) : ICommand<UserProfileDto>;
internal sealed class UpdateProfileCommandHandler : ICommandHandler<UpdateProfileCommand, UserProfileDto>
{
@@ -28,9 +31,18 @@ internal sealed class UpdateProfileCommandHandler : ICommandHandler<UpdateProfil
if (profile is null)
return Result.Failure<UserProfileDto>(ProfilesErrors.ProfileNotFound);
if ((request.Bio?.Length ?? 0) > 200)
return Result.Failure<UserProfileDto>(ProfilesErrors.BioTooLong);
if ((request.StatusText?.Length ?? 0) > 50)
return Result.Failure<UserProfileDto>(ProfilesErrors.StatusTextTooLong);
profile.DisplayName = request.DisplayName ?? profile.DisplayName;
profile.About = request.Bio;
profile.Birthday = request.Birthday;
profile.StatusText = request.StatusText;
profile.StatusEmoji = request.StatusEmoji;
profile.StatusExpiresAt = request.StatusExpiresAt;
var result = await _repository.UpdateAsync(profile, cancellationToken);
if (result.IsFailure)