Фронт

This commit is contained in:
Халимов Рустам
2026-03-27 16:04:46 +03:00
parent 28fb8c25de
commit 030ae1e4e4
19 changed files with 234 additions and 174 deletions

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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)
{