mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
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:
@@ -15,4 +15,21 @@ public class User
|
||||
public Invitation? Invite { get; set; }
|
||||
public List<Friendship> SentFriendRequests { get; set; } = new();
|
||||
public List<Friendship> ReceivedFriendRequests { get; set; } = new();
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
var user = obj as User;
|
||||
|
||||
return Id == user.Id &&
|
||||
Username == user.Username &&
|
||||
Description == user.Description &&
|
||||
PasswordHash == user.PasswordHash &&
|
||||
IconId == user.IconId &&
|
||||
CreatedOn == user.CreatedOn &&
|
||||
WasOnline == user.WasOnline &&
|
||||
InviteId == user.InviteId &&
|
||||
Invite == user.Invite &&
|
||||
SentFriendRequests == user.SentFriendRequests &&
|
||||
ReceivedFriendRequests == user.ReceivedFriendRequests;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user