feat(phase1b): sase.tr read-only connection

- prisma/sase/schema.prisma with User + UserSubscription (partial view)
- lib/db-sase.ts exports typed RO client
- /projects/sase shows live metrics (users count, new users 7d, active subs)
- seed marks sase as active

DATABASE_URL_SASE_RO wired to super_panel_reader (SELECT-only)
This commit is contained in:
Semih
2026-05-13 10:38:03 +00:00
parent d189206f06
commit f72dcc05ba
6 changed files with 165 additions and 30 deletions

View File

@@ -0,0 +1,42 @@
// Partial view of Sase.tr public schema.
// Owned by the spoke; panel reads with super_panel_reader (SELECT only).
// Add models here only as panel features need them — keep the surface narrow.
generator client {
provider = "prisma-client-js"
output = "../../node_modules/.prisma/client-sase"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL_SASE_RO")
}
model User {
id String @id @default(uuid()) @db.Uuid
name String @db.VarChar(255)
email String @unique @db.VarChar(255)
emailVerified Boolean @default(false) @map("email_verified")
role String @default("user") @db.VarChar(20)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz(6)
@@map("users")
}
model UserSubscription {
id String @id @default(uuid()) @db.Uuid
userId String @map("user_id") @db.Uuid
planId String @map("plan_id") @db.Uuid
status String @default("pending") @db.VarChar(20)
billingPeriod String @default("monthly") @map("billing_period") @db.VarChar(10)
startDate DateTime? @map("start_date") @db.Timestamptz(6)
endDate DateTime? @map("end_date") @db.Timestamptz(6)
cancelledAt DateTime? @map("cancelled_at") @db.Timestamptz(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz(6)
@@index([status])
@@index([userId])
@@map("user_subscriptions")
}

View File

@@ -3,7 +3,7 @@ import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const projects = [
{ key: "sase", name: "Sase.tr", description: "VIN/chassis lookup + auto parts catalog", active: false },
{ key: "sase", name: "Sase.tr", description: "VIN/chassis lookup + auto parts catalog", active: true },
{ key: "catvicer", name: "Catvicer", description: "Multi-tenant catering SaaS", active: false },
{ key: "kokpit", name: "Kokpit", description: "Internal ops dashboard", active: false },
{ key: "otoyedekparca", name: "otoyedekparca.co", description: "Auto parts marketplace", active: false },