test to make server

This commit is contained in:
Artemy
2026-02-08 22:30:29 +07:00
parent cc2921d257
commit 0a43e35797
56 changed files with 949 additions and 442 deletions
@@ -25,26 +25,24 @@ public class MessagesLoader : IMessagesLoader
}
public async Task<List<Message>> LoadMessagesInUserChat(
Guid userId,
Guid privateChatId,
Guid currentUser,
Guid? startMessageId,
int before = 20,
int after = 2)
{
if (userId == Guid.Empty)
throw new ArgumentException("User id cannot be empty");
if (privateChatId == Guid.Empty)
throw new ArgumentException("PrivateChatId id cannot be empty");
if (!_privateChatsRepository.Exist(userId, currentUser))
if (!_privateChatsRepository.Exist(privateChatId))
throw new InvalidOperationException("Private chat not found");
var chat = await _privateChatsRepository.GetByMembersAsync(userId, currentUser);
var query = _dbContext.Messages
.AsNoTracking()
.Include(m => m.MediaAttachments)
.ThenInclude(m => m.MediaFile)
.Where(m => m.RecipientType == RecipientType.User &&
m.RecipientId == chat.Id);
m.RecipientId == privateChatId);
if (startMessageId is null)
{