2026-03-10 08:17:45 -04:00
|
|
|
generator client {
|
|
|
|
|
provider = "prisma-client"
|
|
|
|
|
output = "../src/generated/prisma"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
|
provider = "postgresql"
|
|
|
|
|
}
|
|
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
// ─── Auth.js tables ──────────────────────────────────────────
|
|
|
|
|
|
2026-04-11 01:00:11 -04:00
|
|
|
model User {
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
email String @unique
|
|
|
|
|
emailVerified DateTime?
|
|
|
|
|
hashedPassword String?
|
|
|
|
|
username String?
|
|
|
|
|
displayName String?
|
|
|
|
|
avatarUrl String @default("")
|
|
|
|
|
role String @default("viewer")
|
2026-04-16 19:08:08 -04:00
|
|
|
activeOrgId String?
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
accounts Account[]
|
|
|
|
|
sessions Session[]
|
|
|
|
|
memberships OrgMember[]
|
|
|
|
|
|
|
|
|
|
assignedCards ResponseCard[] @relation("AssignedCards")
|
|
|
|
|
assignorCards ResponseCard[] @relation("AssignorCards")
|
|
|
|
|
reviewedCards ResponseCard[] @relation("ReviewedCards")
|
|
|
|
|
activityLogs ActivityLog[]
|
|
|
|
|
notifications Notification[]
|
|
|
|
|
|
|
|
|
|
authentikUid String? @unique
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Account {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
userId String
|
|
|
|
|
type String
|
|
|
|
|
provider String
|
|
|
|
|
providerAccountId String
|
|
|
|
|
refresh_token String?
|
|
|
|
|
access_token String?
|
|
|
|
|
expires_at Int?
|
|
|
|
|
token_type String?
|
|
|
|
|
scope String?
|
|
|
|
|
id_token String?
|
|
|
|
|
session_state String?
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
sessionToken String @unique
|
|
|
|
|
userId String
|
|
|
|
|
expires DateTime
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model VerificationToken {
|
|
|
|
|
identifier String
|
|
|
|
|
token String @unique
|
|
|
|
|
expires DateTime
|
|
|
|
|
|
|
|
|
|
@@unique([identifier, token])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Organization / Multi-tenancy ────────────────────────────
|
|
|
|
|
|
|
|
|
|
model Organization {
|
Add onboarding wizard, email verification, integration architecture, and settings restructure
- Auto-sign-in after registration instead of redirect to login
- Email verification system with token generation, send/confirm API routes, and persistent banner
- 7-step onboarding wizard (org, location, services, upload source, AI, integrations, complete)
- Middleware redirects owners with incomplete onboarding to /onboarding
- Integration provider plugin architecture with registry and 6 providers (Planning Center, Monday.com, Airtable, Google Sheets, Webhook, CSV Export)
- Full integration CRUD API with test, sync, fields, and OAuth authorize/callback routes
- Refactored fireIntegrationEvent to use Integration model with legacy AppSettings fallback
- Migration script for existing Monday.com/webhook config to Integration rows
- Settings page restructured from monolithic 1290-line file into focused sub-routes with section navigation
- Integration hub UI with provider tiles, connect flow, and individual config pages
- Post-onboarding contextual guidance cards on dashboard with dismissible hints
- Schema: Integration model, onboardingComplete/onboardingStep on Organization, dismissedHints on OrgMember
Made-with: Cursor
2026-04-15 02:29:13 -04:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
name String
|
|
|
|
|
slug String @unique
|
|
|
|
|
type String @default("church")
|
|
|
|
|
timezone String @default("America/Chicago")
|
|
|
|
|
settings Json?
|
2026-04-16 19:08:08 -04:00
|
|
|
allowedDomains String[] @default([])
|
Add onboarding wizard, email verification, integration architecture, and settings restructure
- Auto-sign-in after registration instead of redirect to login
- Email verification system with token generation, send/confirm API routes, and persistent banner
- 7-step onboarding wizard (org, location, services, upload source, AI, integrations, complete)
- Middleware redirects owners with incomplete onboarding to /onboarding
- Integration provider plugin architecture with registry and 6 providers (Planning Center, Monday.com, Airtable, Google Sheets, Webhook, CSV Export)
- Full integration CRUD API with test, sync, fields, and OAuth authorize/callback routes
- Refactored fireIntegrationEvent to use Integration model with legacy AppSettings fallback
- Migration script for existing Monday.com/webhook config to Integration rows
- Settings page restructured from monolithic 1290-line file into focused sub-routes with section navigation
- Integration hub UI with provider tiles, connect flow, and individual config pages
- Post-onboarding contextual guidance cards on dashboard with dismissible hints
- Schema: Integration model, onboardingComplete/onboardingStep on Organization, dismissedHints on OrgMember
Made-with: Cursor
2026-04-15 02:29:13 -04:00
|
|
|
onboardingComplete Boolean @default(false)
|
|
|
|
|
onboardingStep Int @default(0)
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
locations Location[]
|
|
|
|
|
members OrgMember[]
|
|
|
|
|
invitations Invitation[]
|
|
|
|
|
apiKeys ApiKey[]
|
|
|
|
|
cards ResponseCard[]
|
|
|
|
|
jobs ProcessingJob[]
|
|
|
|
|
integrations Integration[]
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model OrgMember {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
userId String
|
|
|
|
|
organizationId String
|
|
|
|
|
role String @default("viewer")
|
Add onboarding wizard, email verification, integration architecture, and settings restructure
- Auto-sign-in after registration instead of redirect to login
- Email verification system with token generation, send/confirm API routes, and persistent banner
- 7-step onboarding wizard (org, location, services, upload source, AI, integrations, complete)
- Middleware redirects owners with incomplete onboarding to /onboarding
- Integration provider plugin architecture with registry and 6 providers (Planning Center, Monday.com, Airtable, Google Sheets, Webhook, CSV Export)
- Full integration CRUD API with test, sync, fields, and OAuth authorize/callback routes
- Refactored fireIntegrationEvent to use Integration model with legacy AppSettings fallback
- Migration script for existing Monday.com/webhook config to Integration rows
- Settings page restructured from monolithic 1290-line file into focused sub-routes with section navigation
- Integration hub UI with provider tiles, connect flow, and individual config pages
- Post-onboarding contextual guidance cards on dashboard with dismissible hints
- Schema: Integration model, onboardingComplete/onboardingStep on Organization, dismissedHints on OrgMember
Made-with: Cursor
2026-04-15 02:29:13 -04:00
|
|
|
dismissedHints Json?
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
|
|
|
|
|
@@unique([userId, organizationId])
|
2026-04-11 01:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
model Location {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
organizationId String
|
|
|
|
|
name String
|
|
|
|
|
address String?
|
|
|
|
|
timezone String?
|
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
|
|
|
collectionDays CollectionDay[]
|
|
|
|
|
cards ResponseCard[]
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CollectionDay {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
locationId String
|
|
|
|
|
name String
|
|
|
|
|
description String?
|
|
|
|
|
rrule String?
|
|
|
|
|
dayOfWeek Int?
|
|
|
|
|
timeStart String?
|
|
|
|
|
timeEnd String?
|
|
|
|
|
isRecurring Boolean @default(true)
|
|
|
|
|
date DateTime?
|
|
|
|
|
isActive Boolean @default(true)
|
|
|
|
|
location Location @relation(fields: [locationId], references: [id], onDelete: Cascade)
|
|
|
|
|
cards ResponseCard[]
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
Add onboarding wizard, email verification, integration architecture, and settings restructure
- Auto-sign-in after registration instead of redirect to login
- Email verification system with token generation, send/confirm API routes, and persistent banner
- 7-step onboarding wizard (org, location, services, upload source, AI, integrations, complete)
- Middleware redirects owners with incomplete onboarding to /onboarding
- Integration provider plugin architecture with registry and 6 providers (Planning Center, Monday.com, Airtable, Google Sheets, Webhook, CSV Export)
- Full integration CRUD API with test, sync, fields, and OAuth authorize/callback routes
- Refactored fireIntegrationEvent to use Integration model with legacy AppSettings fallback
- Migration script for existing Monday.com/webhook config to Integration rows
- Settings page restructured from monolithic 1290-line file into focused sub-routes with section navigation
- Integration hub UI with provider tiles, connect flow, and individual config pages
- Post-onboarding contextual guidance cards on dashboard with dismissible hints
- Schema: Integration model, onboardingComplete/onboardingStep on Organization, dismissedHints on OrgMember
Made-with: Cursor
2026-04-15 02:29:13 -04:00
|
|
|
// ─── Integrations ────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
model Integration {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
organizationId String
|
|
|
|
|
provider String
|
|
|
|
|
name String
|
|
|
|
|
enabled Boolean @default(false)
|
|
|
|
|
config Json
|
|
|
|
|
fieldMapping Json?
|
|
|
|
|
syncDirection String @default("push")
|
|
|
|
|
triggerEvents Json?
|
|
|
|
|
lastSyncAt DateTime?
|
|
|
|
|
lastSyncStatus String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
|
|
@@unique([organizationId, provider, name])
|
|
|
|
|
@@index([organizationId, provider])
|
|
|
|
|
}
|
|
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
// ─── Invitations ─────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
model Invitation {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
email String
|
|
|
|
|
role String @default("viewer")
|
|
|
|
|
organizationId String
|
|
|
|
|
invitedById String
|
|
|
|
|
token String @unique @default(cuid())
|
|
|
|
|
expiresAt DateTime
|
|
|
|
|
acceptedAt DateTime?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── System config ───────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
model SystemConfig {
|
|
|
|
|
id String @id @default("singleton")
|
|
|
|
|
isSetupComplete Boolean @default(false)
|
|
|
|
|
setupStep Int @default(0)
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Core application models ─────────────────────────────────
|
|
|
|
|
|
2026-03-10 08:17:45 -04:00
|
|
|
model ResponseCard {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
name String?
|
|
|
|
|
gender String?
|
|
|
|
|
dateOfBirth String?
|
|
|
|
|
maritalStatus String?
|
|
|
|
|
maritalStatusOther String?
|
|
|
|
|
visitType String?
|
|
|
|
|
cellPhone String?
|
|
|
|
|
homePhone String?
|
|
|
|
|
email String?
|
|
|
|
|
address String?
|
|
|
|
|
aptNumber String?
|
|
|
|
|
city String?
|
|
|
|
|
state String?
|
|
|
|
|
zip String?
|
|
|
|
|
prayerRequests String?
|
|
|
|
|
prayerForTeam Boolean @default(false)
|
|
|
|
|
prayerConfidential Boolean @default(false)
|
|
|
|
|
|
|
|
|
|
messageTopics Json?
|
|
|
|
|
messageTopicsOther String?
|
|
|
|
|
nextStep Json?
|
|
|
|
|
attendanceDuration String?
|
|
|
|
|
campusPreference Json?
|
|
|
|
|
campusPreferenceOther String?
|
|
|
|
|
howHeard Json?
|
|
|
|
|
howHeardOther String?
|
|
|
|
|
serviceAttended String?
|
|
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
followUp String?
|
|
|
|
|
notes String?
|
|
|
|
|
serviceTime String?
|
|
|
|
|
planningCenter String?
|
|
|
|
|
iSaidYesBookSent Boolean @default(false)
|
|
|
|
|
ftGuestLetterSent Boolean @default(false)
|
|
|
|
|
firstTimeGuestDate DateTime?
|
|
|
|
|
salvationDate DateTime?
|
|
|
|
|
|
|
|
|
|
assignedToId String?
|
|
|
|
|
assignedById String?
|
|
|
|
|
assignedAt DateTime?
|
|
|
|
|
reviewedById String?
|
|
|
|
|
reviewedAt DateTime?
|
|
|
|
|
reviewNotes String?
|
|
|
|
|
|
|
|
|
|
assignedTo User? @relation("AssignedCards", fields: [assignedToId], references: [id])
|
|
|
|
|
assignedBy User? @relation("AssignorCards", fields: [assignedById], references: [id])
|
|
|
|
|
reviewedBy User? @relation("ReviewedCards", fields: [reviewedById], references: [id])
|
|
|
|
|
|
2026-03-10 08:17:45 -04:00
|
|
|
sourceFile String?
|
|
|
|
|
frontImagePath String?
|
|
|
|
|
backImagePath String?
|
|
|
|
|
ocrStatus String @default("pending")
|
|
|
|
|
reviewStatus String @default("unreviewed")
|
|
|
|
|
ocrConfidence Float?
|
|
|
|
|
ocrError String?
|
|
|
|
|
rawOcrResponse Json?
|
|
|
|
|
|
2026-04-07 13:23:29 -04:00
|
|
|
mondayItemId String?
|
|
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
organizationId String?
|
|
|
|
|
locationId String?
|
|
|
|
|
collectionDayId String?
|
|
|
|
|
collectionDate DateTime?
|
|
|
|
|
|
|
|
|
|
organization Organization? @relation(fields: [organizationId], references: [id])
|
|
|
|
|
location Location? @relation(fields: [locationId], references: [id])
|
|
|
|
|
collectionDay CollectionDay? @relation(fields: [collectionDayId], references: [id])
|
|
|
|
|
|
2026-03-10 08:17:45 -04:00
|
|
|
@@index([ocrStatus])
|
|
|
|
|
@@index([reviewStatus])
|
|
|
|
|
@@index([name])
|
|
|
|
|
@@index([createdAt])
|
2026-04-07 13:23:29 -04:00
|
|
|
@@index([mondayItemId])
|
2026-04-11 01:00:11 -04:00
|
|
|
@@index([assignedToId])
|
|
|
|
|
@@index([reviewedById])
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
@@index([organizationId])
|
|
|
|
|
@@index([locationId])
|
|
|
|
|
@@index([collectionDayId])
|
2026-03-10 08:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ProcessingJob {
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
fileName String
|
|
|
|
|
filePath String
|
|
|
|
|
status String @default("queued")
|
|
|
|
|
totalPages Int @default(0)
|
|
|
|
|
processed Int @default(0)
|
|
|
|
|
error String?
|
|
|
|
|
cardIds Json?
|
|
|
|
|
organizationId String?
|
|
|
|
|
|
|
|
|
|
organization Organization? @relation(fields: [organizationId], references: [id])
|
2026-03-10 08:17:45 -04:00
|
|
|
|
|
|
|
|
@@index([status])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model AppSettings {
|
|
|
|
|
id String @id @default("singleton")
|
|
|
|
|
ollamaUrl String @default("http://192.168.68.108:11434")
|
|
|
|
|
model String @default("llava:7b")
|
|
|
|
|
watchDir String @default("")
|
|
|
|
|
watching Boolean @default(false)
|
2026-03-10 14:21:05 -04:00
|
|
|
|
|
|
|
|
sourceRetentionDays Int @default(30)
|
|
|
|
|
imageRetentionDays Int @default(180)
|
2026-03-11 10:24:15 -04:00
|
|
|
|
2026-03-11 12:05:38 -04:00
|
|
|
aiProvider String @default("gateway")
|
2026-03-11 10:24:15 -04:00
|
|
|
aiModel String @default("")
|
2026-04-07 12:41:52 -04:00
|
|
|
|
2026-04-07 13:23:29 -04:00
|
|
|
mondayApiToken String @default("")
|
|
|
|
|
mondayBoardId String @default("")
|
|
|
|
|
mondayEnabled Boolean @default(false)
|
|
|
|
|
mondayColumnMap Json?
|
|
|
|
|
mondayWebhookId String @default("")
|
|
|
|
|
mondayWebhookUrl String @default("")
|
|
|
|
|
|
|
|
|
|
webhookUrl String @default("")
|
|
|
|
|
webhookSecret String @default("")
|
|
|
|
|
webhookEnabled Boolean @default(false)
|
|
|
|
|
webhookEvents Json?
|
|
|
|
|
|
2026-04-07 12:41:52 -04:00
|
|
|
emailImapHost String @default("imap.dreamhost.com")
|
|
|
|
|
emailImapPort Int @default(993)
|
|
|
|
|
emailImapUser String @default("echo-ocr@stillwell.cloud")
|
|
|
|
|
emailImapPass String @default("")
|
|
|
|
|
emailImapTls Boolean @default(true)
|
|
|
|
|
emailFolder String @default("INBOX")
|
|
|
|
|
emailWatching Boolean @default(false)
|
|
|
|
|
emailProcessed String @default("mark_read")
|
|
|
|
|
emailProcessedFolder String @default("Processed")
|
2026-04-16 00:51:44 -04:00
|
|
|
|
|
|
|
|
ftpEnabled Boolean @default(false)
|
|
|
|
|
ftpHost String @default("")
|
|
|
|
|
ftpPort Int @default(21)
|
|
|
|
|
ftpUser String @default("")
|
|
|
|
|
ftpPass String @default("")
|
|
|
|
|
ftpTls Boolean @default(true)
|
|
|
|
|
ftpIncomingDir String @default("/incoming")
|
|
|
|
|
ftpProcessedDir String @default("/processed")
|
2026-03-10 08:17:45 -04:00
|
|
|
}
|
2026-04-07 13:23:29 -04:00
|
|
|
|
|
|
|
|
model ActivityLog {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
createdAt DateTime @default(now())
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
cardId String?
|
2026-04-07 13:23:29 -04:00
|
|
|
action String
|
|
|
|
|
source String
|
|
|
|
|
summary String
|
|
|
|
|
changes Json?
|
2026-04-11 01:00:11 -04:00
|
|
|
userId String?
|
2026-04-07 13:23:29 -04:00
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
|
|
2026-04-07 13:23:29 -04:00
|
|
|
@@index([cardId, createdAt])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Notification {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
read Boolean @default(false)
|
|
|
|
|
dismissed Boolean @default(false)
|
|
|
|
|
type String
|
|
|
|
|
title String
|
|
|
|
|
message String
|
|
|
|
|
cardId String?
|
|
|
|
|
actionUrl String?
|
|
|
|
|
meta Json?
|
2026-04-11 01:00:11 -04:00
|
|
|
userId String?
|
2026-04-07 13:23:29 -04:00
|
|
|
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
|
|
2026-04-07 13:23:29 -04:00
|
|
|
@@index([read, dismissed, createdAt])
|
|
|
|
|
@@index([cardId])
|
2026-04-11 01:00:11 -04:00
|
|
|
@@index([userId])
|
2026-04-07 13:23:29 -04:00
|
|
|
}
|
Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment
Major architectural upgrade preparing Echo OCR for self-hosted SaaS deployment:
- Auth: Built-in Auth.js v5 with credentials + Authentik OIDC SSO, JWT sessions,
middleware route protection, login/signup/setup pages, registration API
- UI: Dashboard layout with collapsible sidebar nav, AppShell wrapper, route
groups for (dashboard) and (auth), new pages for events/people/reports
- Schema: Auth.js tables (Account, Session, VerificationToken), Organization,
OrgMember, Location, CollectionDay, Invitation, SystemConfig, ApiKey models;
proper User relations to ResponseCard/ActivityLog/Notification
- Permissions: Role hierarchy (owner/admin/editor/reviewer/viewer) with
action-based permission map and requirePermission/requireAuth helpers
- Onboarding: Multi-step setup wizard for first-user bootstrap (account, org,
location) with SystemConfig tracking
- Events: CollectionDay model with rrule support for recurring church services
- Auto-assign: Event-aware card assignment engine replacing getPreviousSunday()
- Migration: seed-migration.ts script for upgrading existing deployments
Made-with: Cursor
2026-04-15 00:59:38 -04:00
|
|
|
|
|
|
|
|
model ApiKey {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
name String
|
|
|
|
|
hashedKey String @unique
|
|
|
|
|
prefix String
|
|
|
|
|
organizationId String
|
|
|
|
|
permissions Json
|
|
|
|
|
lastUsedAt DateTime?
|
|
|
|
|
expiresAt DateTime?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id])
|
|
|
|
|
}
|