Структура
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
using Knot.Shared.Kernel;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.DTOs;
|
||||
|
||||
public static class ProfilesErrors
|
||||
{
|
||||
public static Error ProfileNotFound => new("Profiles.NotFound", "Profile not found");
|
||||
public static Error UsernameAlreadyExists => new("Profiles.UsernameExists", "Username already exists");
|
||||
public static Error AvatarNotFound => new("Profiles.AvatarNotFound", "Avatar not found");
|
||||
public static Error InvalidAvatarFormat => new("Profiles.InvalidAvatarFormat", "Invalid avatar format");
|
||||
public static Error AvatarUploadFailed => new("Profiles.AvatarUploadFailed", "Avatar upload failed");
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using MediatR;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.DTOs;
|
||||
|
||||
public record SearchProfilesRequest(string Query, int Limit = 20) : IRequest<List<UserProfileDto>>;
|
||||
|
||||
public record UpdateProfileRequest(
|
||||
string? DisplayName,
|
||||
string? About,
|
||||
string? Avatar,
|
||||
bool RemoveAvatar = false
|
||||
) : IRequest<UserProfileDto>;
|
||||
|
||||
public record UpdateSettingsRequest(
|
||||
bool? ShowLastSeen,
|
||||
bool? ShowAvatar,
|
||||
bool? ShowAbout,
|
||||
bool? ShowPhoneNumber,
|
||||
bool? ShowForwardedMessages,
|
||||
bool? ShowAddToGroupPermission
|
||||
) : IRequest<UserProfileDto>;
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Knot.Contracts.Profiles.Application.DTOs;
|
||||
|
||||
public class UserProfileDto
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public string? DisplayName { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? About { get; set; }
|
||||
public string? Avatar { get; set; }
|
||||
public bool IsBot { get; set; }
|
||||
public DateTime? LastSeen { get; set; }
|
||||
public bool IsPremium { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Knot.Shared.Kernel;
|
||||
using MediatR;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.Profiles.Avatar;
|
||||
|
||||
public record UploadAvatarCommand(Stream Stream, string FileName) : IRequest<Result<string>>;
|
||||
|
||||
public record DeleteAvatarCommand() : IRequest<Result>;
|
||||
|
||||
public record CropAvatarCommand(int X, int Y, int Width, int Height) : IRequest<Result<string>>;
|
||||
@@ -0,0 +1,9 @@
|
||||
using Knot.Contracts.Profiles.Application.DTOs;
|
||||
using Knot.Shared.Kernel;
|
||||
using MediatR;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.Profiles.GetUser;
|
||||
|
||||
public record GetProfileQuery(Guid UserId) : IRequest<Result<UserProfileDto>>;
|
||||
|
||||
public record GetCurrentUserQuery() : IRequest<Result<UserProfileDto>>;
|
||||
@@ -0,0 +1,6 @@
|
||||
using Knot.Contracts.Profiles.Application.DTOs;
|
||||
using MediatR;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.Profiles.Search;
|
||||
|
||||
public record SearchProfilesQuery(string Query, int Limit = 20) : IRequest<List<UserProfileDto>>;
|
||||
@@ -0,0 +1,12 @@
|
||||
using Knot.Contracts.Profiles.Application.DTOs;
|
||||
using Knot.Shared.Kernel;
|
||||
using MediatR;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.Profiles.UpdateProfile;
|
||||
|
||||
public record UpdateProfileCommand(
|
||||
string? DisplayName,
|
||||
string? About,
|
||||
string? Avatar,
|
||||
bool RemoveAvatar = false
|
||||
) : IRequest<Result<UserProfileDto>>;
|
||||
@@ -0,0 +1,14 @@
|
||||
using Knot.Contracts.Profiles.Application.DTOs;
|
||||
using Knot.Shared.Kernel;
|
||||
using MediatR;
|
||||
|
||||
namespace Knot.Contracts.Profiles.Application.Profiles.UpdateSettings;
|
||||
|
||||
public record UpdateSettingsCommand(
|
||||
bool? ShowLastSeen,
|
||||
bool? ShowAvatar,
|
||||
bool? ShowAbout,
|
||||
bool? ShowPhoneNumber,
|
||||
bool? ShowForwardedMessages,
|
||||
bool? ShowAddToGroupPermission
|
||||
) : IRequest<Result<UserProfileDto>>;
|
||||
Reference in New Issue
Block a user