MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / reportQuote

Function reportQuote

backend/src/api/controllers/quote.ts:139–165  ·  view source on GitHub ↗
(
  req: MonkeyRequest<undefined, ReportQuoteRequest>,
)

Source from the content-addressed store, hash-verified

137}
138
139export async function reportQuote(
140 req: MonkeyRequest<undefined, ReportQuoteRequest>,
141): Promise<MonkeyResponse> {
142 const { uid } = req.ctx.decodedToken;
143 const {
144 reporting: { maxReports, contentReportLimit },
145 } = req.ctx.configuration.quotes;
146
147 const { quoteId, quoteLanguage, reason, comment, captcha } = req.body;
148
149 await verifyCaptcha(captcha);
150
151 const newReport: ReportDAL.DBReport = {
152 _id: new ObjectId(),
153 id: uuidv4(),
154 type: "quote",
155 timestamp: new Date().getTime(),
156 uid,
157 contentId: `${quoteLanguage}-${quoteId}`,
158 reason,
159 comment: comment ?? "",
160 };
161
162 await ReportDAL.createReport(newReport, maxReports, contentReportLimit);
163
164 return new MonkeyResponse("Quote reported", null);
165}

Callers

nothing calls this directly

Calls 1

verifyCaptchaFunction · 0.70

Tested by

no test coverage detected