mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 11:32:13 +01:00
- Add package.json with dependencies and scripts for Next.js and Prisma - Implement API routes for session management, user authentication, and company configuration - Create database schema for Company, User, and Session models in Prisma - Set up authentication with NextAuth and JWT - Add password reset functionality and user registration endpoint - Configure Tailwind CSS and PostCSS for styling - Implement metrics and dashboard settings API endpoints
57 lines
1.7 KiB
Plaintext
57 lines
1.7 KiB
Plaintext
// Database schema, one company = one org, linked to users and CSV config
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = "file:./dev.db"
|
|
}
|
|
|
|
model Company {
|
|
id String @id @default(uuid())
|
|
name String
|
|
csvUrl String // where to fetch CSV
|
|
csvUsername String? // for basic auth
|
|
csvPassword String?
|
|
sentimentAlert Float? // e.g. alert threshold for negative chats
|
|
dashboardOpts String? // JSON blob for per-company dashboard preferences
|
|
users User[]
|
|
sessions Session[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
password String // hashed, use bcrypt
|
|
company Company @relation(fields: [companyId], references: [id])
|
|
companyId String
|
|
role String // 'admin' | 'user' | 'auditor'
|
|
resetToken String?
|
|
resetTokenExpiry DateTime?
|
|
}
|
|
|
|
model Session {
|
|
id String @id
|
|
company Company @relation(fields: [companyId], references: [id])
|
|
companyId String
|
|
startTime DateTime
|
|
endTime DateTime
|
|
ipAddress String?
|
|
country String?
|
|
language String?
|
|
messagesSent Int?
|
|
sentiment Float?
|
|
escalated Boolean?
|
|
forwardedHr Boolean?
|
|
fullTranscriptUrl String?
|
|
avgResponseTime Float?
|
|
tokens Int?
|
|
tokensEur Float?
|
|
category String?
|
|
initialMsg String?
|
|
createdAt DateTime @default(now())
|
|
}
|