41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
using SurrealDb.Net.Models;
|
|
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; }
|
|
}
|