feat(guild): /guild/search_guild

Implement SearchAsync in GuildService (wraps IGuildRepository.SearchAsync +
CountBatchByGuildIdsAsync), wire the controller action, add 7 integration
tests (GuildSearchFlowTests) covering no-filter / activity / join_condition /
bucket-1 / bucket-3 / name-prefix / flat-entry shape, and a wire-shape test
in GuildWireShape confirming list entries are flat (no detail wrapper).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-27 13:01:58 -04:00
parent 09104f4e73
commit 3f8f04eb1a
4 changed files with 263 additions and 4 deletions

View File

@@ -85,6 +85,20 @@ public class GuildWireShape
Assert.That(guildNode.TryGetProperty("guild_id", out _), Is.False, "guild_id must be inside detail, not at guild level");
}
[Test]
public void GuildSearchGuild_response_serializes_with_flat_list_entries()
{
var resp = new GuildSearchGuildResponse { List = new() {
new GuildDetailDto { GuildId = 100_000_001, GuildName = "Alpha", LeaderName = "Lead", LeaderViewerId = 7, Activity = 1, JoinCondition = 1, MemberNum = 5, GuildEmblemId = 100000000, Description = "" }
} };
var json = JsonSerializer.Serialize(resp, Opts);
using var doc = JsonDocument.Parse(json);
var arr = doc.RootElement.GetProperty("list");
Assert.That(arr.ValueKind, Is.EqualTo(JsonValueKind.Array));
Assert.That(arr[0].GetProperty("guild_id").GetString(), Is.EqualTo("100000001"));
Assert.That(arr[0].TryGetProperty("detail", out _), Is.False, "search list entries are flat, no detail wrapper");
}
[Test]
public void GuildInfo_non_joined_serializes_to_prod_shape()
{