mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Update models Messages
This commit is contained in:
@@ -16,8 +16,8 @@ public class MessageValidator : IObjectValidator<Message>
|
||||
throw new ArgumentException("Sender ID cannot be empty", nameof(message.SenderId));
|
||||
if (message.RecipientId == Guid.Empty)
|
||||
throw new ArgumentException("Recipient ID cannot be empty", nameof(message.RecipientId));
|
||||
if(string.IsNullOrWhiteSpace(message.EncryptedContent))
|
||||
throw new ArgumentException("Encrypted content cannot be empty", nameof(message.EncryptedContent));
|
||||
if(string.IsNullOrWhiteSpace(message.EncryptedContent) && (message.MediaAttachments is null || message.MediaAttachments.Count == 0))
|
||||
throw new ArgumentException("Encrypted content cannot be empty when media attachments are empty", nameof(message.EncryptedContent));
|
||||
if(message.IsEdited && message.EditedAt == DateTime.MinValue)
|
||||
throw new ArgumentException("Edited at time cannot be empty", nameof(message.EditedAt));
|
||||
if (message.SentAt == DateTime.MinValue)
|
||||
|
||||
@@ -12,6 +12,10 @@ public class Message
|
||||
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 Message? ReplyToMessage { get; set; } // navigation
|
||||
}
|
||||
|
||||
public enum RecipientType
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Govor.Core.Models;
|
||||
|
||||
public class MessageView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid MessageId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public DateTime ViewedAt { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user