Summary Update.

This commit is contained in:
2026-06-06 23:38:50 -04:00
parent dd75ca4b06
commit 2916d17868
30 changed files with 1231 additions and 21 deletions

View File

@@ -2,11 +2,24 @@ using SurrealDb.Net.Models;
namespace RelayServer.Models;
/// <summary>
/// Surreal record for the `channel_message_edits` table. One row per historical version of
/// an edited message — written by HandleEditMessage BEFORE overwriting the live row.
///
/// Encrypted with the channel AES key (same as ChannelMessages), so HandleGetEditHistory
/// can decrypt + re-encrypt per requester.
/// </summary>
public class ChannelMessageEdits : Record
{
/// <summary>"channel_messages:abc" — which live message this version belonged to.</summary>
public required string MessageId { get; set; }
/// <summary>Base64 AES-GCM ciphertext of the JSON-serialised previous ChatMessageContent.</summary>
public required string CipherText { get; set; }
public required string Nonce { get; set; }
public required string Tag { get; set; }
/// <summary>When this version was the current text (i.e. when it was replaced).</summary>
public required DateTime EditedAt { get; set; }
}

View File

@@ -2,14 +2,36 @@ using SurrealDb.Net.Models;
namespace RelayServer.Models;
/// <summary>
/// Surreal record for the `channel_messages` table. One row per message.
///
/// Encryption: CipherText/Nonce/Tag use the channel AES key (ChannelDbKey), NOT any user's
/// RSA keypair. This means the server can decrypt for history queries; the per-recipient
/// RSA wrapping happens at delivery time in DeliverToServerMembers.
/// </summary>
public class ChannelMessages : Record
{
/// <summary>"channels:xyz" — which channel this belongs to.</summary>
public required string ChannelId { get; set; }
/// <summary>"users:keeper317" — who wrote it. Lowercased to match CoreClientService's id format.</summary>
public required string SenderUserId { get; set; }
/// <summary>Base64 AES-GCM ciphertext of the JSON-serialised ChatMessageContent.</summary>
public required string CipherText { get; set; }
/// <summary>Base64 AES-GCM 96-bit nonce. Different every message.</summary>
public required string Nonce { get; set; }
/// <summary>Base64 AES-GCM 128-bit authentication tag.</summary>
public required string Tag { get; set; }
/// <summary>UTC timestamp of original send. Drives history ordering.</summary>
public required DateTime CreatedAt { get; set; }
/// <summary>UTC timestamp of last edit. Null = never edited. Drives the (edited) bubble footer.</summary>
public DateTime? EditedAt { get; set; }
/// <summary>Soft-delete flag. Tombstones in history responses; bubbles show "deleted" placeholder.</summary>
public bool IsDeleted { get; set; }
}

View File

@@ -3,13 +3,38 @@ using RelayShared.Services;
namespace RelayServer.Models;
/// <summary>
/// Surreal record for the `channels` table. One row per channel.
///
/// Lifecycle: created by HandleCreateChannel (or seeded by ServerBootstrapService at boot).
/// Soft-deleted by HandleDeleteChannel (IsDeleted flipped, row stays for audit).
/// </summary>
public class Channels : Record
{
/// <summary>Sidebar display name. Lowercased and dash-separated for new channels.</summary>
public required string Name { get; set; }
/// <summary>Creation timestamp. Drives sidebar sort order.</summary>
public required DateTime CreatedAt { get; set; }
/// <summary>Drives client rendering and server routing — Text/Voice/File/Forum/Stage.</summary>
public ChannelType Type { get; set; } = ChannelType.Text;
/// <summary>Sidebar category header (e.g. "General"). Empty means default group.</summary>
public string Group { get; set; } = string.Empty;
/// <summary>
/// True for announcement-style channels (#welcome, #files). Non-admins are blocked from
/// posting via PermissionService.CanSendMessagesAsync.
/// </summary>
public bool IsReadOnly { get; set; }
/// <summary>Soft-delete flag. Filtered out of channel-list builds in BuildChannelListForUser.</summary>
public bool IsDeleted { get; set; }
/// <summary>
/// Surreal record id of a File channel ("channels:xyz"). When set, ChatSocketBehavior's
/// MirrorAttachmentIfNeeded auto-copies non-gif attachments into the linked channel.
/// </summary>
public string? LinkedFileChannelId { get; set; }
}