mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Serve report mutations through the database interface (#7846)
cmdReportAssign, cmdReportResolve, cmdReportReopen and cmdReportAddComment still ran their lookups and updates inline through Servatrice_DatabaseInterface. Add assignReport, resolveReport, reopenReport, getUserNameById, getReportNotificationTarget, countReportCommentsInLastHour, getReportCommentTarget and addReportComment to Server_DatabaseInterface with fail-closed defaults, and model the outcomes as ReportAssignResult and ReportUpdateResult so "no such report", "wrong state" and "query failed" stay distinguishable. Authorization checks, audit records, notification recipients and every response code stay in the handler.
This commit is contained in:
parent
a54e13756c
commit
948035af06
4 changed files with 339 additions and 148 deletions
|
|
@ -303,6 +303,20 @@ public:
|
|||
bool getReportComments(int reportId, QList<ServerInfo_ReportComment> &comments) override;
|
||||
bool getReportStats(ReportStatsRecord &stats) override;
|
||||
bool getReportUserInfo(const QString &userName, ReportUserInfoRecord &info) override;
|
||||
Server_DatabaseInterface::ReportAssignResult assignReport(int reportId, int moderatorId) override;
|
||||
Server_DatabaseInterface::ReportUpdateResult
|
||||
resolveReport(int reportId, const QString &status, const QString ¬e, int moderatorId) override;
|
||||
Server_DatabaseInterface::ReportUpdateResult reopenReport(int reportId) override;
|
||||
bool getUserNameById(int userId, QString &userName) override;
|
||||
bool getReportNotificationTarget(int reportId, int &reporterId, QString &reportedUserName) override;
|
||||
int countReportCommentsInLastHour(int authorId) override;
|
||||
bool getReportCommentTarget(int reportId, ReportCommentTargetRecord &target) override;
|
||||
bool addReportComment(int reportId,
|
||||
const QString &authorName,
|
||||
int authorId,
|
||||
const QString &commentText,
|
||||
bool isModerator,
|
||||
qlonglong &commentId) override;
|
||||
bool addReport(int reporterId,
|
||||
const QString &reporterName,
|
||||
int reportedUserId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue