6290475ea3
Kommerzielle Hosting-/Abo-Plattform für Rapport-Instanzen. - React-Frontend (Vite/JSX): Landing, Register, Login, Plans, Dashboard - Node/Express-Backend: Auth (bcrypt+JWT), Stripe-Billing, Provisioning - HOST-Postgres-Schema: accounts, subscriptions, instances - Provisioning-Interface + Modell-A-Adapter (Studio im geteilten Stack) - MOCK-Modus: voller End-to-End-Flow ohne Stripe/Rapport-Stack testbar - Idempotentes Fulfillment (Upsert auf stripe_subscription_id) - docker-compose für lokale host-db; identisch auf Hetzner deploybar E2E lokal verifiziert: Register -> Checkout(mock) -> Instanz -> Idempotenz. Lizenz: proprietär (kein AGPL-Code eingebunden, nur Netzwerk-API zur Familie). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
880 B
JavaScript
27 lines
880 B
JavaScript
// Kunden-Dashboard-Daten: Konto + aktuelles Abo + bereitgestellte Instanz.
|
|
import { Router } from "express";
|
|
import { one } from "../db.js";
|
|
import { requireAuth } from "../auth.js";
|
|
import { publicPlans } from "../plans.js";
|
|
|
|
export const accountRouter = Router();
|
|
|
|
accountRouter.get("/me", requireAuth, async (req, res) => {
|
|
const subscription = await one(
|
|
`select plan, status, current_period_end, stripe_subscription_id
|
|
from subscriptions where account_id = $1 order by created_at desc limit 1`,
|
|
[req.account.id]
|
|
);
|
|
const instance = await one(
|
|
`select studio_slug, instance_url, status, created_at
|
|
from instances where account_id = $1 order by created_at desc limit 1`,
|
|
[req.account.id]
|
|
);
|
|
res.json({
|
|
account: req.account,
|
|
subscription: subscription || null,
|
|
instance: instance || null,
|
|
plans: publicPlans(),
|
|
});
|
|
});
|