( req: MonkeyRequest<undefined, ReportUserRequest>, )
| 1084 | } |
| 1085 | |
| 1086 | export async function reportUser( |
| 1087 | req: MonkeyRequest<undefined, ReportUserRequest>, |
| 1088 | ): Promise<MonkeyResponse> { |
| 1089 | const { uid } = req.ctx.decodedToken; |
| 1090 | const { |
| 1091 | reporting: { maxReports, contentReportLimit }, |
| 1092 | } = req.ctx.configuration.quotes; |
| 1093 | |
| 1094 | const { uid: uidToReport, reason, comment, captcha } = req.body; |
| 1095 | |
| 1096 | await verifyCaptcha(captcha); |
| 1097 | |
| 1098 | const newReport: ReportDAL.DBReport = { |
| 1099 | _id: new ObjectId(), |
| 1100 | id: uuidv4(), |
| 1101 | type: "user", |
| 1102 | timestamp: new Date().getTime(), |
| 1103 | uid, |
| 1104 | contentId: `${uidToReport}`, |
| 1105 | reason, |
| 1106 | comment: comment ?? "", |
| 1107 | }; |
| 1108 | |
| 1109 | await ReportDAL.createReport(newReport, maxReports, contentReportLimit); |
| 1110 | |
| 1111 | return new MonkeyResponse("User reported", null); |
| 1112 | } |
| 1113 | |
| 1114 | export async function setStreakHourOffset( |
| 1115 | req: MonkeyRequest<undefined, SetStreakHourOffsetRequest>, |
nothing calls this directly
no test coverage detected