Files
EchoHub/src/EchoHub.Core/Models/Attachment.cs
T
HueByte 2d33773c24 feat: Add support for message attachments
- Introduced Attachment model to handle file attachments associated with messages.
- Updated ModerationController to manage message deletions and attachment cleanup.
- Enhanced ChatService to include attachments in message retrieval.
- Implemented migration for legacy single-attachment messages to the new Attachments model.
- Added unit tests for attachment handling in message formatting and parsing.
- Updated database context and migrations to support new Attachments table.
2026-07-16 05:02:12 +02:00

29 lines
1023 B
C#

namespace EchoHub.Core.Models;
/// <summary>
/// A file attached to a message (image, audio, or any file). A message may carry
/// zero or more attachments alongside its text content (Discord-style).
/// </summary>
public class Attachment
{
public Guid Id { get; set; }
public Guid MessageId { get; set; }
public Message? Message { get; set; }
public AttachmentKind Kind { get; set; }
/// <summary>Relative download URL, e.g. <c>/api/files/{fileId}</c>.</summary>
public required string Url { get; set; }
public required string FileName { get; set; }
/// <summary>Stored blob size in bytes (ciphertext size for encrypted channels).</summary>
public long FileSize { get; set; }
/// <summary>
/// Rendered ASCII-art preview for images (color-tag format). Null for audio/files.
/// Stored encrypted-at-rest when database encryption is enabled, and room-encrypted
/// for end-to-end encrypted channels.
/// </summary>
public string? AsciiPreview { get; set; }
}