Files
Govor/Govor.Core/Models/Message.cs
T
Artemy 66819a015a Refactor media attachments to use MediaFile entity
This commit introduces the MediaFile entity and updates the media attachments model, repositories, and related logic to reference MediaFile instead of storing file metadata directly in MediaAttachments. Controller, service, and SignalR request/response contracts are updated to support the new structure. Database configurations and validators are also adjusted accordingly. This refactor improves media management and normalization in the data model.
2025-07-06 21:09:12 +07:00

39 lines
1.3 KiB
C#

namespace Govor.Core.Models;
public class Message
{
public Guid Id { get; set; }
public Guid SenderId { get; set; }
public Guid RecipientId { get; set; } // or GroupId
public RecipientType RecipientType { get; set; }
public string EncryptedContent { get; set; } = string.Empty;
public DateTime SentAt { get; set; }
public bool IsEdited { get; set; } = false;
public DateTime? EditedAt { get; set; }
public List<MessageReaction> Reactions { get; set; } = new List<MessageReaction>();
public List<MediaAttachments> MediaAttachments { get; set; } = new List<MediaAttachments>();
public List<MessageView> MessageViews { get; set; } = new List<MessageView>();
public Guid? ReplyToMessageId { get; set; }
public override bool Equals(object? obj)
{
if (obj is not Message other) return false;
return Id == other.Id &&
SenderId == other.SenderId &&
RecipientId == other.RecipientId &&
RecipientType == other.RecipientType &&
EncryptedContent == other.EncryptedContent &&
SentAt == other.SentAt &&
IsEdited == other.IsEdited &&
EditedAt == other.EditedAt &&
ReplyToMessageId == other.ReplyToMessageId;
}
}
public enum RecipientType
{
User,
Group
}