SPB Git

Repository Public

route.ts 2.7 KB 70 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Vrai-Prix8 * File             : src/app/api/stats/dashboard/route.ts9 * Module           : app10 * Repository       : https://git.spboucher.ai/vrai-prix11 * Created          : 2026-08-1712 * Last Modified    : 2026-08-1713 *14 * Author           : Simon-Pierre Boucher15 * Position         : Professor of Finance16 * Institution      : Université du Québec en Outaouais (UQO)17 * Organization     : SP Boucher18 * Website          : https://spboucher.ai19 * Git              : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development      : dev@spboucher.ai23 * Support          : support@spboucher.ai24 * Security/Admin   : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142/**43 * GET /api/stats/dashboard — tableau de bord statistique (docs/API.md).44 * Consommé par la page /stats et par le rapport PDF /api/stats/report.45 *46 * Particularité Vrai-Prix : les données sont un INSTANTANÉ du rôle d'évaluation47 * foncière 2026 (pas de séries quotidiennes). `period`, `from` et `to` sont48 * acceptés mais NON APPLICABLES : la réponse est toujours49 * l'instantané, avec `period.label = "instantané du rôle 2026"` et50 * `period.applicable = false`. La seule vraie série servie est la valeur51 * provinciale par millésime (2021-2026, 6 points, kind "line").52 * Cache mémoire côté serveur (import statique construit une seule fois).53 */54import { type NextRequest, NextResponse } from "next/server";55import { getDashboard } from "@/lib/stats-dashboard";5657export function GET(req: NextRequest) {58  const dash = getDashboard();59  const requested = req.nextUrl.searchParams.get("period");60  const payload = requested61    ? { ...dash, period: { ...dash.period, requested } }62    : dash;63  return NextResponse.json(payload, {64    headers: {65      "Cache-Control": "public, max-age=600",66      "Access-Control-Allow-Origin": "*",67    },68  });69}70
Files main
Menu

Theme