mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Add admin friendships controller and improve friend request handling
Introduces FriendshipsController for admin operations, including listing and removing friendships. Updates routing for admin controllers, improves error handling in UsersController, and enhances FriendsController and related services to include requester details in friendship DTOs. Refactors friend request acceptance to use query parameters and updates console client for improved user feedback and local development configuration.
This commit is contained in:
@@ -98,7 +98,7 @@ public class FriendsController : Controller
|
||||
}
|
||||
|
||||
[HttpPost("accept")]
|
||||
public async Task<IActionResult> AcceptFriend(Guid friendshipId)
|
||||
public async Task<IActionResult> AcceptFriend([FromQuery] Guid friendshipId)
|
||||
{
|
||||
if (friendshipId == Guid.Empty)
|
||||
return BadRequest("Requester ID is invalid");
|
||||
@@ -144,7 +144,7 @@ public class FriendsController : Controller
|
||||
return StatusCode(500, new { error = "Internal server error." });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<UserDto> BuildUserDtos(IEnumerable<User> users) => users.Select(user => new UserDto
|
||||
{
|
||||
Id = user.Id,
|
||||
@@ -159,6 +159,7 @@ public class FriendsController : Controller
|
||||
Id = f.Id,
|
||||
Status = f.Status,
|
||||
AddresseeId = f.AddresseeId,
|
||||
RequesterId = f.RequesterId
|
||||
RequesterId = f.RequesterId,
|
||||
Requester = BuildUserDtos([f.Requester]).First(),
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user