SPB Git

Repository Public

route.ts 3.6 KB 87 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | ACADEMIC RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * PROJECT METADATA8 * -----------------------------------------------------------------------------9 * Project          : UQO Éval10 * File             : src/app/api/report/portfolio/route.ts11 * Module           : app12 * Repository       : https://git.spboucher.ai/uqo-eval13 * Project Website  : https://www.uqo-eval.app14 * Created          : 2026-08-0915 * Last Modified    : 2026-08-2816 *17 * =============================================================================18 * SOFTWARE MAINTAINER & AFFILIATION19 * =============================================================================20 *21 * Maintainer       : Simon-Pierre Boucher22 * Position         : Professor of Finance23 * Institution      : Université du Québec en Outaouais (UQO)24 * Department       : Département des sciences administratives25 * Website          : https://spboucher.ai26 * Git              : https://git.spboucher.ai27 *28 * Research Contact : research@spboucher.ai29 * Direct Contact   : simon@spboucher.ai30 * Security/Admin   : admin@spboucher.ai31 *32 * The affiliation is descriptive. It is not an institutional endorsement,33 * a license grant or a determination of ownership.34 *35 * =============================================================================36 * COPYRIGHT, AUTHORSHIP & DATA37 * =============================================================================38 *39 * Copyright (c) the author(s) of this work.40 * Ownership is not asserted by this notice; see the repository records.41 *42 * This header identifies the maintainer of the software. Scientific43 * authorship of any associated paper is stated in the paper itself and44 * is not changed by this notice. Datasets and third-party materials45 * remain the property of their respective owners and licensors.46 *47 * This file is governed by the applicable project license, copyright48 * notices, institutional agreements and relevant law.49 *50 * =============================================================================51 * LICENSE & MAINTENANCE52 * =============================================================================53 *54 * License          : None specified (no license file in this repository)55 * Classification   : Public56 *57 * =============================================================================58 * END OF SP BOUCHER SOURCE HEADER59 * =============================================================================60 */6162// UQO Éval — laboratoire pédagogique d'évaluation immobilière63import { NextRequest, NextResponse } from "next/server";64import { estimatePortfolio } from "@/lib/estimator";65import { buildPortfolioReport } from "@/lib/report-portfolio";6667export async function GET(req: NextRequest) {68  const ids = (req.nextUrl.searchParams.get("ids") ?? "")69    .split(",")70    .map((s) => s.trim())71    .filter(Boolean)72    .slice(0, 40);73  if (ids.length === 0)74    return NextResponse.json({ error: "ids requis" }, { status: 400 });75  const pf = estimatePortfolio(ids);76  if (pf.items.length === 0)77    return NextResponse.json({ error: "aucune propriété trouvée" }, { status: 404 });78  const pdf = await buildPortfolioReport(pf);79  return new NextResponse(new Uint8Array(pdf), {80    headers: {81      "Content-Type": "application/pdf",82      "Content-Disposition": `attachment; filename="uqo-eval-parc-${pf.items.length}-proprietes.pdf"`,83      "Cache-Control": "private, max-age=300",84    },85  });86}87
Files main
Menu

Theme