{"version":3,"file":"dashboard.mjs","names":[],"sources":["../../../../src/astro/routes/api/dashboard.ts"],"sourcesContent":["/**\n * Dashboard stats endpoint\n *\n * GET /_emdash/api/dashboard - Collection counts, media/user counts, recent items\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, handleError, unwrapResult } from \"#api/error.js\";\nimport { handleDashboardStats } from \"#api/handlers/dashboard.js\";\n\nexport const prerender = false;\n\nexport const GET: APIRoute = async ({ locals }) => {\n\tconst { emdash, user } = locals;\n\n\tconst denied = requirePerm(user, \"content:read\");\n\tif (denied) return denied;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\ttry {\n\t\tconst result = await handleDashboardStats(emdash.db);\n\n\t\treturn unwrapResult(result);\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to load dashboard\", \"DASHBOARD_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,YAAY;AAEzB,MAAa,MAAgB,OAAO,EAAE,aAAa;CAClD,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,SAAS,YAAY,MAAM,eAAe;AAChD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;AAGpE,KAAI;AAGH,SAAO,aAFQ,MAAM,qBAAqB,OAAO,GAAG,CAEzB;UACnB,OAAO;AACf,SAAO,YAAY,OAAO,4BAA4B,kBAAkB"}