feat(guild_chat): deck + replay attachments

Implement all five guild_chat attachment endpoints:
- add_deck: server looks up deck by (viewerId, format, deckNo) and snapshots
  the current state into a DECK-type chat message DeckPayload column.
- delete_deck: author OR leader/sub-leader may clear; returns refreshed
  deck_log. Extended IGuildChatMessageRepository.ClearDeckAsync with
  leaderOverride flag; added GetDeckMessagesAsync + GetByMessageIdAsync.
- add_replay: stores {"battle_id": N} in ReplayPayload; full shape is
  TODO(post-merge) pending replay-subsystem capture.
- replay_detail: returns the stored ReplayPayload as JsonElement passthrough.
- deck_log: returns all active DECK messages grouped by API-side Format string
  key ("1"=Rotation, "2"=Unlimited, "3"=PreRotation always present;
  "4"=Crossover, "5"=MyRotation only when non-empty).

Adds DeckLogDataDto (typed) for deck_log / delete_deck responses.
Replay response uses JsonElement passthrough (TODO(post-merge)).
8 new integration tests — all green. Full suite 1530/1530 pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-27 15:14:06 -04:00
parent ab1e23b7cb
commit eb65c2081c
11 changed files with 846 additions and 54 deletions

View File

@@ -14,7 +14,18 @@ public interface IGuildChatMessageRepository
Task<int> GetMaxMessageIdAsync(int guildId, CancellationToken ct = default);
Task DeleteAllForGuildAsync(int guildId, CancellationToken ct = default);
/// <summary>For /guild_chat/delete_deck: clears the deck payload + body without removing the message row,
/// so the slot remains in the timeline ("[deleted]"). Returns false if not found / not deletable by caller.</summary>
Task<bool> ClearDeckAsync(int guildId, int messageId, long callerViewerId, CancellationToken ct = default);
/// <summary>Fetch a single message by (guildId, messageId). Returns null if not found.</summary>
Task<GuildChatMessage?> GetByMessageIdAsync(int guildId, int messageId, CancellationToken ct = default);
/// <summary>
/// Fetch all DECK-type messages for a guild (non-null DeckPayload only — clears are excluded).
/// </summary>
Task<IReadOnlyList<GuildChatMessage>> GetDeckMessagesAsync(int guildId, CancellationToken ct = default);
/// <summary>
/// For /guild_chat/delete_deck: clears the deck payload + body without removing the message row,
/// so the slot remains in the timeline ("[deleted]"). Returns false if not found / not deletable by caller.
/// <paramref name="leaderOverride"/> bypasses the author check — pass true when caller is Leader or SubLeader.
/// </summary>
Task<bool> ClearDeckAsync(int guildId, int messageId, long callerViewerId, bool leaderOverride, CancellationToken ct = default);
}