feat: complete phase 3 reporting, logging, cancel counting, and settings

This commit is contained in:
2026-06-12 22:12:36 +03:30
parent 22e3fa1415
commit a8d9bff59e
20 changed files with 741 additions and 110 deletions
+12 -7
View File
@@ -8,18 +8,12 @@ generator client {
binaryTargets = ["native", "debian-openssl-3.0.x", "debian-openssl-1.1.x"]
}
enum Role {
USER
ADMIN
}
model User {
id Int @id @default(autoincrement())
username String @unique
password String
name String?
mobile String?
role Role @default(USER) // Deprecated, use roles instead
roles Json? // e.g. ["COUNTER", "ACCOUNTANT", "SUPERVISOR", "ADMIN"]
orgId Int?
avatarUrl String? @db.LongText
@@ -29,6 +23,7 @@ model User {
lockedLocations Location[] @relation("LocationLocks")
assignedTasks Task[] @relation("AssignedTasks")
createdTasks Task[] @relation("CreatedTasks")
actionLogs ActionLog[] // Logs created by this user
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
@@ -76,8 +71,9 @@ model Counting {
user_id Int
user User @relation(fields: [user_id], references: [id])
mode String @default("SHELF") // SHELF, ITEM, TASK
status String @default("PENDING") // PENDING, APPROVED, REJECTED, CORRECTION_REQUESTED
status String @default("PENDING") // PENDING, APPROVED, REJECTED, CORRECTION_REQUESTED, CANCELLED
correctionNote String? @db.Text
cancelReason String? @db.Text
is_offline Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -103,3 +99,12 @@ model Task {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model ActionLog {
id Int @id @default(autoincrement())
userId Int
user User @relation(fields: [userId], references: [id])
action String // e.g., "LOGIN", "START_SHELF", "CANCEL_SHELF", "COUNT_ITEM"
details String? @db.Text
createdAt DateTime @default(now())
}