-
Notifications
You must be signed in to change notification settings - Fork 0
feat(dashboard): neutralize colored icons, chart theming, DB migrations #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d25c0f7
286d3e4
653faa0
96c6a93
ab1f7ac
6140a5b
7668bb2
cd88309
239f502
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,6 +97,21 @@ export async function GET(request: NextRequest) { | |
| case "segments": | ||
| const segmentId = searchParams.get("segment") || "all"; | ||
| return NextResponse.json(await query.getSegmentedMetrics(from, to, segmentId, projectId)); | ||
| case "skriuw-events": | ||
| return NextResponse.json(await query.getSkriuwEventCounts(projectFilter ?? "skriuw", from, to)); | ||
| case "skriuw-trend": | ||
| return NextResponse.json(await query.getSkriuwEventTrend(projectFilter ?? "skriuw", from, to)); | ||
| case "skriuw-notes": | ||
| return NextResponse.json(await query.getSkriuwNotesActivity(projectFilter ?? "skriuw", from, to)); | ||
| case "skriuw-journal": | ||
| return NextResponse.json(await query.getSkriuwJournalActivity(projectFilter ?? "skriuw", from, to)); | ||
| case "skriuw-auth": | ||
| return NextResponse.json(await query.getSkriuwAuthMetrics(projectFilter ?? "skriuw", from, to)); | ||
| case "skriuw-recent": | ||
| const skriuwLimit = parseInt(searchParams.get("limit") || "50"); | ||
| return NextResponse.json(await query.getSkriuwRecentEvents(projectFilter ?? "skriuw", skriuwLimit, from, to)); | ||
| case "skriuw-searches": | ||
| return NextResponse.json(await query.getSkriuwTopSearches(projectFilter ?? "skriuw", 20, from, to)); | ||
|
Comment on lines
+100
to
+114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded Every new branch uses
The root cause is that ♻️ Proposed directionIn -export async function getSkriuwEventCounts(projectId: string, from?: Date, to?: Date): Promise<EventCount[]> {
+export async function getSkriuwEventCounts(projectId?: string, from?: Date, to?: Date): Promise<EventCount[]> {
const range = getRange(from, to);
- const results =
- await sql`... AND project_id = ${projectId} ...`;
+ const projectClause = projectId ? sql`AND project_id = ${projectId}` : sql``;
+ const results =
+ await sql`... ${projectClause} ...`;In - case "skriuw-events":
- return NextResponse.json(await query.getSkriuwEventCounts(projectFilter ?? "skriuw", from, to));
+ case "skriuw-events":
+ return NextResponse.json(await query.getSkriuwEventCounts(projectFilter, from, to));(Apply to all seven 🧰 Tools🪛 Biome (2.4.12)[error] 111-111: Other switch clauses can erroneously access this declaration. (lint/correctness/noSwitchDeclarations) 🤖 Prompt for AI Agents |
||
| default: | ||
| return NextResponse.json({ error: "Unknown metric" }, { status: 400 }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseIntwithout radix or NaN guard forlimit.parseInt(searchParams.get("limit") || "50")will returnNaNfor non-numeric inputs (e.g.?limit=abc), which then flows into the SQLLIMITclause and 500s. Also no upper bound, so?limit=1000000is allowed. Validate and clamp at the boundary.🛡️ Proposed fix
The added braces also resolve the Biome
noSwitchDeclarationswarning on line 111 by scopingskriuwLimitto its own block.📝 Committable suggestion
🧰 Tools
🪛 Biome (2.4.12)
[error] 111-111: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
(lint/correctness/noSwitchDeclarations)
🤖 Prompt for AI Agents