[Server] Serve report mutations through the database interface

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:
Lukas Brübach 2026-11-10 01:26:12 +01:00
parent 3f9e53eb2f
commit e59dd24711
4 changed files with 339 additions and 148 deletions

View file

@ -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 &note, 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,