Сборка бэк

This commit is contained in:
Халимов Рустам
2026-03-27 15:45:34 +03:00
parent 16978c423c
commit 11f2b232a3
135 changed files with 2162 additions and 725 deletions

View File

@@ -0,0 +1,41 @@
using System;
namespace Knot.Modules.Relations.Application.Contacts;
public class ContactDto
{
public Guid Id { get; init; }
public string Username { get; init; } = string.Empty;
public string DisplayName { get; init; } = string.Empty;
public string Avatar { get; init; } = string.Empty;
public bool IsOnline { get; init; }
public DateTime? LastSeen { get; init; }
public Guid RelationId { get; init; }
public bool IsBlocked { get; init; }
public bool IsExternal { get; init; }
public string? Domain { get; init; }
public ContactDto(
Guid id,
string username,
string displayName,
string avatar,
bool isOnline,
DateTime? lastSeen,
Guid relationId,
bool isBlocked = false,
bool isExternal = false,
string? domain = null)
{
Id = id;
Username = username;
DisplayName = displayName;
Avatar = avatar;
IsOnline = isOnline;
LastSeen = lastSeen;
RelationId = relationId;
IsBlocked = isBlocked;
IsExternal = isExternal;
Domain = domain;
}
}

View File

@@ -10,18 +10,6 @@ using Knot.Modules.Relations.Application.Abstractions;
namespace Knot.Modules.Relations.Application.Contacts;
public record ContactDto(
Guid Id,
string Username,
string DisplayName,
string Avatar,
bool IsOnline,
DateTime? LastSeen,
Guid RelationId,
bool IsBlocked = false,
bool IsExternal = false,
string? Domain = null);
public record GetContactsQuery(Guid UserId) : IQuery<List<ContactDto>>;
internal sealed class GetContactsQueryHandler : IQueryHandler<GetContactsQuery, List<ContactDto>>
@@ -56,7 +44,7 @@ internal sealed class GetContactsQueryHandler : IQueryHandler<GetContactsQuery,
replica.Username,
replica.DisplayName,
replica.Avatar,
false, // Presence handled by another service or real-time
false,
null,
rel.Id,
rel.Status == ContactStatus.Blocked,

View File

@@ -14,9 +14,6 @@ internal sealed class RemoveContactCommandHandler : ICommandHandler<RemoveContac
{
private readonly IContactsDbContext _context;
public ContactRelationNotFound() : base("Contacts.NotFound", "Contact relation not found.") { }
public ContactRelationUnauthorized() : base("Contacts.Unauthorized", "You are not authorized to remove this contact.") { }
public RemoveContactCommandHandler(IContactsDbContext context)
{
_context = context;