2026-10-01 08:05:56 +02:00
|
|
|
using MongoDB.Entities;
|
|
|
|
|
|
2026-10-01 10:57:01 +02:00
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2026-10-01 08:05:56 +02:00
|
|
|
namespace PrivaPub.Models.Group
|
|
|
|
|
{
|
|
|
|
|
public class DmGroup : Entity
|
|
|
|
|
{
|
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
public List<GroupMember> Members { get; set; } = new();
|
|
|
|
|
public string ConversationURI { get; set; }//context of the federated thread
|
2026-10-01 10:57:01 +02:00
|
|
|
public string ParticipantsKey { get; set; }
|
2026-10-01 08:05:56 +02:00
|
|
|
|
|
|
|
|
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
public DateTime? DeletionAt { get; set; }
|
2026-10-01 10:57:01 +02:00
|
|
|
|
|
|
|
|
public static string KeyOf(IEnumerable<GroupMember> members) =>
|
|
|
|
|
Convert.ToHexStringLower(SHA256.HashData(Encoding.UTF8.GetBytes(string.Join("\n",
|
|
|
|
|
members.Select(m => (m.IsForeign ? "remote:" : "local:") + m.AvatarId).Distinct().Order(StringComparer.Ordinal)))));
|
2026-10-01 08:05:56 +02:00
|
|
|
}
|
|
|
|
|
}
|