fix(guild): friend_list returns bare array-at-root (matches GuildFriendListTask.Parse)
GuildFriendListTask.Parse() reads base.ResponseData[data][i] directly —
data must be a bare JSON array, not {friends:[...]}. Delete the
GuildFriendListResponse wrapper DTO; promote GuildInviteCandidateDto to its
own file. Controller now returns List<GuildInviteCandidateDto> so the
middleware wraps it as data:[…]. Update wire-shape and integration tests to
assert array-at-root.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -174,13 +174,13 @@ public sealed class GuildController : SVSimController
|
||||
}
|
||||
|
||||
[HttpPost("friend_list")]
|
||||
public async Task<ActionResult<GuildFriendListResponse>> FriendList([FromBody] BaseRequest _, CancellationToken ct)
|
||||
public async Task<ActionResult<List<GuildInviteCandidateDto>>> FriendList([FromBody] BaseRequest _, CancellationToken ct)
|
||||
{
|
||||
if (!TryGetViewerId(out var viewerId)) return Unauthorized();
|
||||
|
||||
var friendInfo = await _friends.GetFriendsAsync(viewerId, ct);
|
||||
if (friendInfo.Friends.Count == 0)
|
||||
return new GuildFriendListResponse { Friends = new() };
|
||||
return new List<GuildInviteCandidateDto>();
|
||||
|
||||
// For each friend, determine if they are already in a guild (is_join_guild).
|
||||
var friendViewerIds = friendInfo.Friends.Select(f => (long)f.ViewerId).ToList();
|
||||
@@ -206,7 +206,7 @@ public sealed class GuildController : SVSimController
|
||||
});
|
||||
}
|
||||
|
||||
return new GuildFriendListResponse { Friends = candidates };
|
||||
return candidates;
|
||||
}
|
||||
|
||||
[HttpPost("invite_user_list")]
|
||||
|
||||
Reference in New Issue
Block a user