Improve friends search and error handling in API

Refactored FriendsController to provide more precise error responses and input validation. Enhanced FriendsService to handle new exception types and improved user search logic. Added tests for user search, updated repository to throw on empty search results, and implemented User equality override. Cleaned up Program.cs controller JSON options.
This commit is contained in:
Artemy
2025-06-30 12:47:53 +07:00
parent 9bfcc1980d
commit 7aa1b1831a
7 changed files with 140 additions and 86 deletions
@@ -4,7 +4,7 @@ namespace Govor.Application.Interfaces;
public interface IFriendsService
{
Task<List<User>> SearchUsersAsync(string searchTerm, Guid currentId);
Task<List<User>> SearchUsersAsync(string query, Guid currentId);
Task SendFriendRequestAsync(Guid fromUserId, Guid toUserId);
Task AcceptFriendRequestAsync(Guid requestId, Guid currentUserId);
Task<List<User>> GetFriendsAsync(Guid userId);