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
@@ -51,12 +51,22 @@ public class MessageCommandService : IMessageCommandService
{
if (!await _usersRepository.ExistsByIdAsync(sendParams.RecipientId))
{
_logger.LogWarning("Attempt to send message to non-existent user {RecipientId}", sendParams.RecipientId);
return new SendMessageResult(false, new KeyNotFoundException($"Recipient user {sendParams.RecipientId} not found."), default);
if (!_privateChats.Exist(sendParams.RecipientId))
{
_logger.LogWarning("Attempt to send message to non-existent user {RecipientId}", sendParams.RecipientId);
return new SendMessageResult(false, new KeyNotFoundException($"Recipient user {sendParams.RecipientId} not found."), default);
}
else
{
recipientId = sendParams.RecipientId;
}
}
else
{
// Verify friendship for private messages
await _verifyFriendship.VerifyAsync(sendParams.FromUserId, sendParams.RecipientId);
recipientId = await GetPrivateChatsIdAsync(sendParams.FromUserId, sendParams.RecipientId);
}
// Verify friendship for private messages
await _verifyFriendship.VerifyAsync(sendParams.FromUserId, sendParams.RecipientId);
recipientId = await GetPrivateChatsIdAsync(sendParams.FromUserId, sendParams.RecipientId);
}
else if (sendParams.RecipientType == RecipientType.Group)
{