mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-09 12:56:07 +08:00
moved logging to controller
This commit is contained in:
parent
90660a6858
commit
db4174c29a
2 changed files with 6 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ const ReportDAO = require("../../dao/report");
|
|||
const UserDAO = require("../../dao/user");
|
||||
const MonkeyError = require("../../handlers/error");
|
||||
const Captcha = require("../../handlers/captcha");
|
||||
const Logger = require("../../handlers/logger");
|
||||
|
||||
class QuotesController {
|
||||
static async reportQuote(req, res) {
|
||||
|
|
@ -33,6 +34,11 @@ class QuotesController {
|
|||
|
||||
await ReportDAO.createReport(newReport);
|
||||
|
||||
Logger.log("report_created", {
|
||||
type: newReport.type,
|
||||
details: newReport.details,
|
||||
});
|
||||
|
||||
res.sendStatus(200);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const MonkeyError = require("../handlers/error");
|
||||
const { mongoDB } = require("../init/mongodb");
|
||||
const Logger = require("../handlers/logger");
|
||||
|
||||
const MAX_REPORTS = 1000;
|
||||
const CONTENT_REPORT_LIMIT = 5;
|
||||
|
|
@ -28,10 +27,6 @@ class ReportDAO {
|
|||
}
|
||||
|
||||
await mongoDB().collection("reports").insertOne(report);
|
||||
Logger.log("report_created", {
|
||||
type: report.type,
|
||||
details: report.details,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue