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

@@ -1,14 +1,15 @@
using MessagePack;
using System.Text.Json;
using System.Text.Json.Serialization;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common.Guild;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.GuildChat;
/// <summary>
/// Response for POST /guild_chat/deck_log.
/// deck_log keys are stringified API-side Format ints (e.g. "1", "2").
/// TODO(task-17): replace deck_log with typed DTOs when DeckLogData shape is fully specified.
/// Crossover/MyRotation keys must be OMITTED (not empty arrays) when those formats are disabled.
/// deck_log keys are stringified API-side Format ints (e.g. "1", "2", "3").
/// Rotation / Unlimited / PreRotation buckets are always present.
/// Crossover / MyRotation keys are included only when non-empty (client uses TryGetValue).
/// </summary>
[MessagePackObject]
public class GuildChatDeckLogResponse
@@ -19,8 +20,9 @@ public class GuildChatDeckLogResponse
/// <summary>
/// Decks shared in chat, bucketed by API-side Format value (stringified int keys).
/// JsonElement pass-through for now — Task 17 will type the inner DeckLogEntry shape.
/// Keys present: "1" (Rotation), "2" (Unlimited), "3" (PreRotation); optionally "4" (Crossover), "5" (MyRotation).
/// </summary>
[JsonPropertyName("deck_log"), Key("deck_log")]
public JsonElement? DeckLog { get; set; }
[JsonPropertyName("deck_log"), Key("deck_log"),
JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public Dictionary<string, List<DeckLogDataDto>> DeckLog { get; set; } = new();
}

View File

@@ -1,13 +1,13 @@
using MessagePack;
using System.Text.Json;
using System.Text.Json.Serialization;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common.Guild;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.GuildChat;
/// <summary>
/// Response for POST /guild_chat/delete_deck.
/// Returns refreshed deck_log after deletion.
/// TODO(task-17): replace deck_log with typed DeckLogData DTOs when deck-log shape is fully documented.
/// Returns the refreshed deck_log after deletion — same shape as /guild_chat/deck_log.
/// </summary>
[MessagePackObject]
public class GuildChatDeleteDeckResponse
@@ -17,9 +17,10 @@ public class GuildChatDeleteDeckResponse
public List<int> MaintenanceCardList { get; set; } = new();
/// <summary>
/// Refreshed deck log keyed by API-side Format int (stringified, e.g. "1", "2").
/// Using JsonElement for now; Task 17 will type this properly.
/// Refreshed deck log keyed by API-side Format int (stringified, e.g. "1", "2", "3").
/// Crossover ("4") / MyRotation ("5") included only when non-empty.
/// </summary>
[JsonPropertyName("deck_log"), Key("deck_log")]
public JsonElement? DeckLog { get; set; }
[JsonPropertyName("deck_log"), Key("deck_log"),
JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public Dictionary<string, List<DeckLogDataDto>> DeckLog { get; set; } = new();
}

View File

@@ -7,13 +7,16 @@ namespace SVSim.EmulatedEntrypoint.Models.Dtos.GuildChat;
/// <summary>
/// Response for POST /guild_chat/replay_detail.
/// Shape is opaque pending replay-subsystem documentation.
/// TODO(task-17): enumerate fields from Wizard/ReplayDetailInfo.cs when replay subsystem is documented.
/// TODO(post-merge): enumerate fields from Wizard/ReplayDetailInfo.cs when replay subsystem is documented.
/// Using JsonElement pass-through so the stored ReplayPayload JSON is forwarded verbatim.
/// </summary>
[MessagePackObject]
public class GuildChatReplayDetailResponse
{
// Placeholder — replay detail shape is undocumented until we capture a live trace.
// Using JsonElement pass-through for now.
[JsonPropertyName("_todo"), Key("_todo")]
public JsonElement? Placeholder { get; set; }
/// <summary>
/// Opaque replay payload forwarded verbatim from the stored ReplayPayload JSON.
/// TODO(post-merge): type this properly once replay subsystem shape is captured.
/// </summary>
[JsonPropertyName("replay_info"), Key("replay_info")]
public JsonElement? ReplayInfo { get; set; }
}