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
@@ -19,6 +19,7 @@ public class FriendshipService : IFriendshipService
_friendshipsRepository = friendshipsRepository;
}
public async Task<List<User>> SearchUsersAsync(string query, Guid currentId)
{
List<User> all = new List<User>();
@@ -42,6 +43,23 @@ public class FriendshipService : IFriendshipService
throw new UnauthorizedAccessException($"When we try find friends by pattern {query} something wrong", ex);
}
}
public async Task<List<User>> GetPotentialFriendsAsync(Guid userId)
{
try
{
var friendships = await _friendshipsRepository.FindByUserIdAsync(userId);
return friendships
.Where(f => f.Status == FriendshipStatus.Pending)
.Select(f => f.RequesterId == userId ? f.Addressee : f.Requester)
.ToList();
}
catch (NotFoundByKeyException<Guid> ex)
{
throw new InvalidOperationException("Nothing was found for the specified id.", ex);
}
}
public async Task<List<User>> GetFriendsAsync(Guid userId)
{