Client portal: profile, activity pages + middleware fix

This commit is contained in:
JCBSComputer
2026-07-01 11:25:08 +02:00
parent 5d971dc749
commit 6016ab2855
23 changed files with 1789 additions and 2 deletions
@@ -0,0 +1,23 @@
import { NextResponse } from "next/server"
import { query } from "@/lib/db"
import { getPortalSession, isPortalError } from "../portal-utils"
export async function GET() {
const session = await getPortalSession()
if (isPortalError(session)) return session
if (!session.customerId) {
return NextResponse.json({ projects: [] })
}
const result = await query(
`SELECT id, name, description, status, start_date, end_date, budget, currency,
created_at, updated_at
FROM projects
WHERE customer_id = $1 AND deleted_at IS NULL
ORDER BY created_at DESC`,
[session.customerId],
)
return NextResponse.json({ projects: result.rows })
}