mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Serve report list views through the database interface (#7844)
cmdReportList, cmdReportMyList and cmdReportDetails still prepared their SELECTs inline through Servatrice_DatabaseInterface and mapped the result columns to protocol records in the socket handler. Add getReportList, getReportsSubmittedBy, getReportForDetails and getReportComments to Server_DatabaseInterface with fail-closed defaults and a ReportLookupResult outcome, implement them with the previous statements, joins and null handling, and keep the detail authorization check and the tolerated comment-query failure in the handler in the same order. Response codes are unchanged.
This commit is contained in:
parent
fb836c6e0c
commit
2ba80cb61d
4 changed files with 349 additions and 232 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <libcockatrice/protocol/pb/serverinfo_chat_message.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_moderator_login.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_private_chat_message.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_report.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user_alt.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user_session.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_warning.pb.h>
|
||||
|
|
@ -291,6 +292,15 @@ public:
|
|||
bool results) override;
|
||||
int countReportsSubmittedInLastDay(int reporterId) override;
|
||||
int getReportedUserId(const QString &userName) override;
|
||||
bool getReportList(bool unresolvedOnly,
|
||||
int offset,
|
||||
int limit,
|
||||
int &totalCount,
|
||||
QList<ServerInfo_Report> &reports) override;
|
||||
bool getReportsSubmittedBy(int reporterId, QList<ServerInfo_Report> &reports) override;
|
||||
Server_DatabaseInterface::ReportLookupResult
|
||||
getReportForDetails(int reportId, int &reporterId, ServerInfo_Report &report) override;
|
||||
bool getReportComments(int reportId, QList<ServerInfo_ReportComment> &comments) override;
|
||||
bool addReport(int reporterId,
|
||||
const QString &reporterName,
|
||||
int reportedUserId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue