From 37c5efe6b7c9d33ddb084921014bf8d3b22dcfe5 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 12:59:39 +0530 Subject: [PATCH] fix: resolve 4 bugs in devtrack --- src/app/api/metrics/repo-health/route.ts | 2 +- src/app/api/milestones/route.ts | 2 +- src/app/api/project-tutor/route.ts | 3 ++- src/app/api/user/orgs/route.ts | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/api/metrics/repo-health/route.ts b/src/app/api/metrics/repo-health/route.ts index 8e059da02..058acefe7 100644 --- a/src/app/api/metrics/repo-health/route.ts +++ b/src/app/api/metrics/repo-health/route.ts @@ -150,7 +150,7 @@ export async function GET(req: NextRequest) { return Response.json({ error: "Unauthorized" }, { status: 401 }); } - const requestedDays = parseInt(req.nextUrl.searchParams.get("days") ?? "30", 10); + const requestedDays = parseInt(req.nextUrl.searchParams.get("days", 10) ?? "30", 10); // Only allow 7, 30, or 90 day windows — other values default to 30. const days = requestedDays === 7 || requestedDays === 30 || requestedDays === 90 ? requestedDays : 30; diff --git a/src/app/api/milestones/route.ts b/src/app/api/milestones/route.ts index 4019a3d7f..19ec9c30c 100644 --- a/src/app/api/milestones/route.ts +++ b/src/app/api/milestones/route.ts @@ -92,7 +92,7 @@ export async function POST(req: Request) { ? unit.trim().slice(0, MAX_UNIT_LEN) : "units"; - if (typeof targetDate !== "string" || isNaN(new Date(targetDate).getTime())) { + if (typeof targetDate !== "string" || Number.isNaN(new Date(targetDate).getTime())) { return NextResponse.json({ error: "targetDate must be a valid date string" }, { status: 400 }); } diff --git a/src/app/api/project-tutor/route.ts b/src/app/api/project-tutor/route.ts index a9d803b15..e71433c1a 100644 --- a/src/app/api/project-tutor/route.ts +++ b/src/app/api/project-tutor/route.ts @@ -163,4 +163,5 @@ Give a clear, concise answer focused on interview preparation. Keep it under 200 console.error("Project tutor error:", error); return NextResponse.json({ error: "Something went wrong" }, { status: 500 }); } -} \ No newline at end of file +} +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file diff --git a/src/app/api/user/orgs/route.ts b/src/app/api/user/orgs/route.ts index 5bc5302c2..1444d1258 100644 --- a/src/app/api/user/orgs/route.ts +++ b/src/app/api/user/orgs/route.ts @@ -173,3 +173,5 @@ export async function POST(req: NextRequest) { return NextResponse.json({ error: "Internal server error" }, { status: 500 }); } } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file