forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroute.ts
More file actions
23 lines (20 loc) · 714 Bytes
/
Copy pathroute.ts
File metadata and controls
23 lines (20 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// src/app/api/settings/db-size/route.ts
import { NextResponse } from "next/server"
import { authenticate } from "@/lib/api-helpers"
import { errMsg } from "@/lib/error-utils"
import { log } from "@/lib/logger"
import { getDbSizeHistory } from "@/lib/server-data"
export async function GET() {
const auth = await authenticate()
if (auth instanceof NextResponse) return auth
try {
const data = await getDbSizeHistory()
return NextResponse.json(data)
} catch (err) {
log.error(
{ route: "GET /api/settings/db-size", error: errMsg(err) },
"Failed to fetch DB size history"
)
return NextResponse.json({ error: "Failed to load database size history" }, { status: 500 })
}
}