mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
test to make server
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user