1a52fe80f3
- Implemented multi-user authentication with role-based access control. - Added environment variables for initial admin user setup. - Updated README and example environment file with new authentication options. - Introduced user and system configuration models in the database schema. - Enhanced authentication middleware to support user registration and role management. - Updated frontend to handle new authentication flows, including admin user creation and role updates.
60 lines
1.8 KiB
Plaintext
60 lines
1.8 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
output = "../src/generated/client"
|
|
binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x", "linux-musl-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Collection {
|
|
id String @id @default(uuid())
|
|
name String
|
|
drawings Drawing[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Drawing {
|
|
id String @id @default(uuid())
|
|
name String
|
|
elements String // Stored as JSON string
|
|
appState String // Stored as JSON string
|
|
files String @default("{}") // Stored as JSON string
|
|
preview String? // SVG string for thumbnail
|
|
version Int @default(1)
|
|
collectionId String?
|
|
collection Collection? @relation(fields: [collectionId], references: [id])
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Library {
|
|
id String @id @default("default") // Singleton pattern - use "default" ID
|
|
items String @default("[]") // Stored as JSON string array of library items
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
username String? @unique
|
|
email String? @unique
|
|
passwordHash String
|
|
role String @default("USER")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model SystemConfig {
|
|
id String @id @default("default")
|
|
registrationEnabled Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|