- Backend: Node.js + Express + TypeScript + Prisma + PostgreSQL - Frontend: React + TypeScript + Tailwind CSS + Vite - Multi-tenant with role-based access (SystemAdmin, Technician, Customer) - Workflow editor with drag-and-drop steps - JWT authentication with refresh tokens - German UI throughout
109 lines
2.5 KiB
Plaintext
109 lines
2.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Tenant {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique
|
|
logo String?
|
|
active Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
users User[]
|
|
workflows Workflow[]
|
|
categories Category[]
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
passwordHash String
|
|
firstName String
|
|
lastName String
|
|
role Role
|
|
tenantId String?
|
|
tenant Tenant? @relation(fields: [tenantId], references: [id])
|
|
active Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
createdWorkflows Workflow[] @relation("CreatedBy")
|
|
updatedWorkflows Workflow[] @relation("UpdatedBy")
|
|
}
|
|
|
|
enum Role {
|
|
SYSTEM_ADMIN
|
|
TECHNICIAN
|
|
CUSTOMER_ADMIN
|
|
CUSTOMER_USER
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(uuid())
|
|
name String
|
|
icon String?
|
|
tenantId String?
|
|
tenant Tenant? @relation(fields: [tenantId], references: [id])
|
|
workflows Workflow[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Workflow {
|
|
id String @id @default(uuid())
|
|
title String
|
|
description String?
|
|
tenantId String
|
|
tenant Tenant @relation(fields: [tenantId], references: [id])
|
|
categoryId String?
|
|
category Category? @relation(fields: [categoryId], references: [id])
|
|
status WorkflowStatus @default(DRAFT)
|
|
version Int @default(1)
|
|
isTemplate Boolean @default(false)
|
|
tags String[]
|
|
createdById String
|
|
createdBy User @relation("CreatedBy", fields: [createdById], references: [id])
|
|
updatedById String?
|
|
updatedBy User? @relation("UpdatedBy", fields: [updatedById], references: [id])
|
|
steps WorkflowStep[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([tenantId])
|
|
@@index([status])
|
|
}
|
|
|
|
enum WorkflowStatus {
|
|
DRAFT
|
|
REVIEW
|
|
PUBLISHED
|
|
ARCHIVED
|
|
}
|
|
|
|
model WorkflowStep {
|
|
id String @id @default(uuid())
|
|
workflowId String
|
|
workflow Workflow @relation(fields: [workflowId], references: [id], onDelete: Cascade)
|
|
order Int
|
|
title String
|
|
content String
|
|
type StepType @default(INSTRUCTION)
|
|
isRequired Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([workflowId])
|
|
}
|
|
|
|
enum StepType {
|
|
INSTRUCTION
|
|
CHECKLIST
|
|
WARNING
|
|
INFO
|
|
COMMAND
|
|
}
|