Фронт
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
using Knot.Shared.Kernel;
|
||||
using System;
|
||||
|
||||
namespace Knot.Modules.Profiles.Domain.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Доменное событие: профиль пользователя создан при регистрации.
|
||||
/// Профиль пользователя создан.
|
||||
/// </summary>
|
||||
public sealed record ProfileCreatedDomainEvent(Guid UserId, string Username) : IDomainEvent;
|
||||
public record ProfileCreatedDomainEvent(Guid ProfileId) : IDomainEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Доменное событие: аватар профиля был изменён (для возможной инвалидации CDN-кэша).
|
||||
/// Профиль пользователя обновлен.
|
||||
/// </summary>
|
||||
public sealed record ProfileAvatarChangedDomainEvent(Guid UserId, string? OldAvatarFileId, string? NewAvatarFileId) : IDomainEvent;
|
||||
public record ProfileUpdatedDomainEvent(Guid ProfileId) : IDomainEvent;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using Knot.Shared.Kernel;
|
||||
using System;
|
||||
|
||||
namespace Knot.Modules.Profiles.Domain;
|
||||
|
||||
public sealed class Profile : AggregateRoot<Guid>
|
||||
@@ -13,13 +10,17 @@ public sealed class Profile : AggregateRoot<Guid>
|
||||
public bool HideStoryViews { get; private set; }
|
||||
public string Profilename => Username;
|
||||
public string Name => DisplayName;
|
||||
public string AvatarUrl => Avatar;
|
||||
public string? AvatarUrl => Avatar;
|
||||
public bool IsPrivate => false;
|
||||
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
public int FollowersCount => 0;
|
||||
public int FollowingCount => 0;
|
||||
public int FriendsCount => 0;
|
||||
|
||||
#pragma warning disable CS8618
|
||||
private Profile() : base(Guid.Empty) { }
|
||||
#pragma warning restore CS8618
|
||||
|
||||
private Profile(Guid id, string username, string displayName, string? bio = null)
|
||||
: base(id)
|
||||
{
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using System;
|
||||
|
||||
namespace Knot.Modules.Profiles.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// MongoDB-документ профиля пользователя.
|
||||
/// Id совпадает с UserId из модуля Auth (Postgres).
|
||||
/// Аватар хранится в S3 — здесь лежит только ссылка.
|
||||
/// </summary>
|
||||
public sealed class ProfileDocument
|
||||
{
|
||||
@@ -21,23 +16,17 @@ public sealed class ProfileDocument
|
||||
|
||||
public string? Bio { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// URL или ключ объекта в S3-хранилище (MinIO).
|
||||
/// Пример: "/api/files/{fileId}"
|
||||
/// </summary>
|
||||
public string? AvatarUrl { get; private set; }
|
||||
|
||||
public DateTime? Birthday { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Скрывать ли просмотры сторис от других пользователей.
|
||||
/// </summary>
|
||||
public bool HideStoryViews { get; private set; }
|
||||
|
||||
public DateTime CreatedAt { get; private set; }
|
||||
|
||||
// Для MongoDB — protected-конструктор через BSON-десериализацию
|
||||
protected ProfileDocument() { }
|
||||
#pragma warning disable CS8618
|
||||
private ProfileDocument() { }
|
||||
#pragma warning restore CS8618
|
||||
|
||||
private ProfileDocument(Guid id, string username, string displayName, string? bio)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user