From f2aceafc9147bb9a374cd46b28db3b7027f915f8 Mon Sep 17 00:00:00 2001 From: Yogesh Date: Tue, 10 Mar 2026 16:42:22 +0530 Subject: [PATCH] fix: declaration in route.tsx --- src/lib/services/report.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/services/report.ts b/src/lib/services/report.ts index 4f21808..96e8b08 100644 --- a/src/lib/services/report.ts +++ b/src/lib/services/report.ts @@ -4,7 +4,7 @@ import { CustomError } from "@/lib/utils/error"; const exams: string[] = ["CAT-1", "CAT-2", "FAT", "Model CAT-1", "Model CAT-2", "Model FAT"] const ALLOWED_FIELDS = ["subject", "courseCode", "exam", "slot", "year"]; -const MAX_REPORTS_PER_PAPER = 5; + export interface ReportTagBody { paperId?: string; @@ -21,10 +21,10 @@ interface ReportedFieldInput { export async function reportTag(paperId: string, body: ReportTagBody) { await connectToDatabase(); - const MAX_REPORTS_PER_PAPER = 5; + const count = await TagReport.countDocuments({ paperId }); - if (count >= MAX_REPORTS_PER_PAPER) { + if (count >= 5){ throw new CustomError("Received many reports; we are currently working on it.", 429) } const reportedFields: ReportedFieldInput[] = Array.isArray(body.reportedFields)