feat(db): chat log guild, team and filter result; chat flags

chat_log gets guild_id, team_id and filtered (migrations mysql 100, sqlite 83),
and the chat log queries take a time range, a guild, a team, a conversation
between two characters and paging back by id. Whispers are their own visibility
switch (includeWhispers), apart from team and guild chat (includePrivate).
Whisper partners and teams that talked are listed with counts.

chat_flags, chat_flag_messages and chat_flag_events (mysql 101, sqlite 84) hold
flagged chat with a copy of the messages around it, its status, note, linked
player report and history. Open flags are in the dashboard snapshot.

Tests on SQLite alone (dDatabaseSqliteTests) and in the MySQL parity tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 18:22:26 -05:00
parent 1bdb4258a0
commit af54ca282f
22 changed files with 1015 additions and 41 deletions

View File

@@ -369,6 +369,18 @@ class TestSQLDatabase : public GameDatabase {
uint64_t InsertChatMessage(const ChatMessage& message) override { return 0; }
std::vector<ChatMessage> GetChatMessages(const ChatQuery& query) override { return {}; }
uint64_t CountChatMessages(const ChatQuery& query) override { return 0; }
std::vector<WhisperPartner> GetWhisperPartners(LWOOBJID characterId, uint32_t offset, uint32_t limit) override { return {}; }
uint64_t CountWhisperPartners(LWOOBJID characterId) override { return 0; }
std::vector<ChatTeam> GetChatTeams(LWOOBJID characterId, uint32_t offset, uint32_t limit) override { return {}; }
uint64_t CountChatTeams(LWOOBJID characterId) override { return 0; }
uint64_t InsertChatFlag(const ChatFlag& flag, const std::vector<uint64_t>& messageIds) override { return 0; }
std::optional<ChatFlag> GetChatFlag(uint64_t id) override { return std::nullopt; }
std::vector<ChatFlag> GetChatFlags(const ChatFlagQuery& query) override { return {}; }
uint64_t CountChatFlags(const ChatFlagQuery& query) override { return 0; }
bool UpdateChatFlag(uint64_t id, const std::string& status, const std::string& note, uint64_t playerReportId, int64_t time, const std::string& updatedBy) override { return false; }
void InsertChatFlagEvent(const ChatFlagEvent& event) override {}
std::vector<ChatFlagEvent> GetChatFlagEvents(uint64_t flagId) override { return {}; }
std::vector<std::pair<uint64_t, uint64_t>> GetFlaggedMessages(const std::vector<uint64_t>& messageIds) override { return {}; }
void InsertModerationDecision(const std::string& kind, int64_t subjectId, const std::string& subject, bool approved, const std::string& reason, int64_t time) override {}
nlohmann::json GetModerationDecisions(const std::string& kind, int64_t subjectId, uint32_t limit) override { return nlohmann::json::array(); }
Totp GetTotp(uint32_t accountId) override { return {}; }