mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 09:12:08 +01:00
feat: implement platform management system with authentication and dashboard
- Add PlatformUser model with roles (SUPER_ADMIN, ADMIN, SUPPORT) - Implement platform authentication with NextAuth - Create platform dashboard showing companies, users, and sessions - Add platform API endpoints for company management - Update landing page with SaaS design - Include test improvements and accessibility updates
This commit is contained in:
@ -9,6 +9,22 @@ datasource db {
|
||||
directUrl = env("DATABASE_URL_DIRECT")
|
||||
}
|
||||
|
||||
/// *
|
||||
/// * PLATFORM USER (super-admin for Notso AI)
|
||||
/// * Platform-level users who can manage companies and platform-wide settings
|
||||
/// * Separate from Company users for platform management isolation
|
||||
model PlatformUser {
|
||||
id String @id @default(uuid())
|
||||
email String @unique @db.VarChar(255) /// Platform user email address
|
||||
password String @db.VarChar(255) /// Hashed password for platform authentication
|
||||
role PlatformUserRole @default(ADMIN) /// Platform permission level
|
||||
name String @db.VarChar(255) /// Display name for platform user
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
||||
|
||||
@@index([email])
|
||||
}
|
||||
|
||||
/// *
|
||||
/// * COMPANY (multi-tenant root)
|
||||
/// * Root entity for multi-tenant architecture
|
||||
@ -16,6 +32,7 @@ datasource db {
|
||||
model Company {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(255) /// Company name for display and filtering
|
||||
status CompanyStatus @default(ACTIVE) /// Company status for suspension/activation
|
||||
csvUrl String @db.Text /// URL endpoint for CSV data import
|
||||
csvUsername String? @db.VarChar(255) /// Optional HTTP auth username for CSV endpoint
|
||||
csvPassword String? @db.VarChar(255) /// Optional HTTP auth password for CSV endpoint
|
||||
@ -28,6 +45,7 @@ model Company {
|
||||
users User[] @relation("CompanyUsers") /// Users belonging to this company
|
||||
|
||||
@@index([name])
|
||||
@@index([status])
|
||||
}
|
||||
|
||||
/// *
|
||||
@ -269,6 +287,13 @@ model CompanyAIModel {
|
||||
/// * ENUMS – typed constants for better data integrity
|
||||
///
|
||||
|
||||
/// Platform-level user roles for Notso AI team
|
||||
enum PlatformUserRole {
|
||||
SUPER_ADMIN /// Full platform access, can create/suspend companies
|
||||
ADMIN /// Platform administration, company management
|
||||
SUPPORT /// Customer support access, read-only company access
|
||||
}
|
||||
|
||||
/// User permission levels within a company
|
||||
enum UserRole {
|
||||
ADMIN /// Full access to company data and settings
|
||||
@ -276,6 +301,14 @@ enum UserRole {
|
||||
AUDITOR /// Read-only access for compliance and auditing
|
||||
}
|
||||
|
||||
/// Company operational status
|
||||
enum CompanyStatus {
|
||||
ACTIVE /// Company is operational and can access all features
|
||||
SUSPENDED /// Company access is temporarily disabled
|
||||
TRIAL /// Company is in trial period with potential limitations
|
||||
ARCHIVED /// Company is archived and data is read-only
|
||||
}
|
||||
|
||||
/// AI-determined sentiment categories for sessions
|
||||
enum SentimentCategory {
|
||||
POSITIVE /// Customer expressed satisfaction or positive emotions
|
||||
|
||||
Reference in New Issue
Block a user