mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
MessageRepository + Tests
+ GetAllAsync rework + FindByIdAsync + rework FindBySenderAndReceiverIdAsync
This commit is contained in:
@@ -16,6 +16,21 @@ public class Message
|
||||
|
||||
public Guid? ReplyToMessageId { get; set; }
|
||||
public Message? ReplyToMessage { get; set; } // navigation
|
||||
|
||||
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
|
||||
|
||||
@@ -8,6 +8,6 @@ public interface IMessagesReader
|
||||
Task<Message> FindByIdAsync(Guid messageId);
|
||||
Task<List<Message>> FindBySenderIdAsync(Guid senderId);
|
||||
Task<List<Message>> FindByReceiverIdAsync(Guid receiverId);
|
||||
Task<List<Message>> FindBySenderAndReceiverIdAsync(Guid senderId, Guid receiverId);
|
||||
Task<List<Message>> FindBySenderAndReceiverIdAsync(Guid senderId, Guid receiverId, RecipientType recipientType = RecipientType.User);
|
||||
Task<List<Message>> FindBySentAtAsync(DateTime date);
|
||||
}
|
||||
Reference in New Issue
Block a user