267 lines
10 KiB
Plaintext
267 lines
10 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model LauncherNotice {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
appKey String @default("Launcher") @map("app_key")
|
|
title String
|
|
body String
|
|
linkUrl String? @map("link_url")
|
|
isActive Boolean @default(true) @map("is_active")
|
|
startsAt DateTime? @map("starts_at") @db.Timestamptz(3)
|
|
endsAt DateTime? @map("ends_at") @db.Timestamptz(3)
|
|
priority Int @default(0)
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@index([appKey, isActive, priority])
|
|
@@map("launcher_notices")
|
|
}
|
|
|
|
model LauncherTerm {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
key String @unique
|
|
body String
|
|
isRequired Boolean @default(true) @map("is_required")
|
|
createdById String? @map("created_by_id") @db.Uuid
|
|
createdByName String? @map("created_by_name")
|
|
createdByEmail String? @map("created_by_email")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@index([createdByEmail])
|
|
@@map("launcher_terms")
|
|
}
|
|
|
|
model LauncherAppVersion {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
appKey String @unique @map("app_key")
|
|
displayName String @map("display_name")
|
|
latestVersion String @map("latest_version")
|
|
minimumSupportedVersion String? @map("minimum_supported_version")
|
|
downloadUrl String? @map("download_url")
|
|
releaseNotes String? @map("release_notes")
|
|
repository String?
|
|
branch String?
|
|
commitSha String? @map("commit_sha")
|
|
isEnabled Boolean @default(true) @map("is_enabled")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@index([isEnabled])
|
|
@@map("launcher_app_versions")
|
|
}
|
|
|
|
model LauncherCommonSetting {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
key String @unique
|
|
name String
|
|
type String
|
|
value String
|
|
description String?
|
|
isActive Boolean @default(true) @map("is_active")
|
|
isSecret Boolean @default(false) @map("is_secret")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@index([type, isActive])
|
|
@@map("launcher_common_settings")
|
|
}
|
|
|
|
model LauncherApp {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
appKey String @unique @map("app_key")
|
|
displayName String @map("display_name")
|
|
description String
|
|
subtitle String?
|
|
detailUrl String? @map("detail_url")
|
|
videoPath String? @map("video_path")
|
|
iconKey String @map("icon_key")
|
|
launchUrl String? @map("launch_url")
|
|
devAppPath String? @map("dev_app_path")
|
|
execPath String? @map("exec_path")
|
|
sortOrder Int @default(0) @map("sort_order")
|
|
isEnabled Boolean @default(true) @map("is_enabled")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
userApps LauncherUserApp[]
|
|
|
|
@@index([isEnabled, sortOrder])
|
|
@@map("launcher_apps")
|
|
}
|
|
|
|
model LauncherUserApp {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
authUserId String @map("auth_user_id") @db.Uuid
|
|
appId String @map("app_id") @db.Uuid
|
|
canView Boolean @default(true) @map("can_view")
|
|
canLaunch Boolean @default(true) @map("can_launch")
|
|
assignedById String? @map("assigned_by") @db.Uuid
|
|
assignedAt DateTime @default(now()) @map("assigned_at") @db.Timestamptz(3)
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
app LauncherApp @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([authUserId, appId])
|
|
@@index([appId])
|
|
@@index([authUserId, canView, canLaunch])
|
|
@@map("launcher_user_apps")
|
|
}
|
|
|
|
model Notification {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
appKey String @default("all") @map("app_key")
|
|
audience String @default("all")
|
|
category String @default("notice")
|
|
title String
|
|
body String
|
|
linkUrl String? @map("link_url")
|
|
priority Int @default(0)
|
|
isActive Boolean @default(true) @map("is_active")
|
|
startsAt DateTime? @map("starts_at") @db.Timestamptz(3)
|
|
endsAt DateTime? @map("ends_at") @db.Timestamptz(3)
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
reads NotificationRead[]
|
|
|
|
@@index([appKey, audience, isActive, priority])
|
|
@@index([isActive, createdAt])
|
|
@@map("notifications")
|
|
}
|
|
|
|
model NotificationRead {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
notificationId String @map("notification_id") @db.Uuid
|
|
authUserId String @map("auth_user_id") @db.Uuid
|
|
readAt DateTime @default(now()) @map("read_at") @db.Timestamptz(3)
|
|
notification Notification @relation(fields: [notificationId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([notificationId, authUserId])
|
|
@@index([authUserId])
|
|
@@map("notification_reads")
|
|
}
|
|
|
|
model CommonCode {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
groupKey String @map("group_key")
|
|
code String
|
|
label String
|
|
description String?
|
|
sortOrder Int @default(0) @map("sort_order")
|
|
isActive Boolean @default(true) @map("is_active")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@unique([groupKey, code])
|
|
@@index([groupKey, isActive, sortOrder])
|
|
@@map("common_codes")
|
|
}
|
|
|
|
model DownloadFile {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
appKey String @map("app_key")
|
|
contextKey String @default("general") @map("context_key")
|
|
title String
|
|
description String?
|
|
fileName String @map("file_name")
|
|
sourceUrl String @map("source_url")
|
|
contentType String? @map("content_type")
|
|
fileSizeBytes BigInt? @map("file_size_bytes")
|
|
uploadedByAppKey String? @map("uploaded_by_app_key")
|
|
uploadedByAuthId String? @map("uploaded_by_auth_id") @db.Uuid
|
|
sortOrder Int @default(0) @map("sort_order")
|
|
isActive Boolean @default(true) @map("is_active")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
events DownloadEvent[]
|
|
|
|
@@index([appKey, contextKey, isActive, sortOrder])
|
|
@@index([uploadedByAppKey])
|
|
@@map("download_files")
|
|
}
|
|
|
|
model DownloadEvent {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
fileId String @map("file_id") @db.Uuid
|
|
authUserId String? @map("auth_user_id") @db.Uuid
|
|
appKey String @map("app_key")
|
|
userAgent String? @map("user_agent")
|
|
ipAddress String? @map("ip_address")
|
|
downloadedAt DateTime @default(now()) @map("downloaded_at") @db.Timestamptz(3)
|
|
file DownloadFile @relation(fields: [fileId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([fileId, downloadedAt])
|
|
@@index([authUserId, downloadedAt])
|
|
@@index([appKey, downloadedAt])
|
|
@@map("download_events")
|
|
}
|
|
|
|
model ProvisionedDevice {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
accountEmail String @map("account_email")
|
|
authUserId String? @map("auth_user_id") @db.Uuid
|
|
hostname String
|
|
tailscaleHostname String @map("tailscale_hostname")
|
|
sshUser String? @map("ssh_user")
|
|
workspaceRoot String? @map("workspace_root")
|
|
usageType String @default("personal") @map("usage_type")
|
|
os String?
|
|
arch String?
|
|
kernel String?
|
|
distro String?
|
|
device Json?
|
|
installedAt DateTime @default(now()) @map("installed_at") @db.Timestamptz(3)
|
|
lastProvisionedAt DateTime @default(now()) @map("last_provisioned_at") @db.Timestamptz(3)
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@unique([accountEmail, tailscaleHostname])
|
|
@@index([accountEmail])
|
|
@@index([tailscaleHostname])
|
|
@@map("provisioned_devices")
|
|
}
|
|
|
|
model DeviceAuthorization {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
deviceCodeHash String @unique @map("device_code_hash")
|
|
userCode String @unique @map("user_code")
|
|
status String @default("PENDING")
|
|
authUserId String? @map("auth_user_id") @db.Uuid
|
|
accountEmail String? @map("account_email")
|
|
authUserName String? @map("auth_user_name")
|
|
authUserRole String? @map("auth_user_role")
|
|
authUserRoles Json? @map("auth_user_roles")
|
|
device Json?
|
|
expiresAt DateTime @map("expires_at") @db.Timestamptz(3)
|
|
approvedAt DateTime? @map("approved_at") @db.Timestamptz(3)
|
|
consumedAt DateTime? @map("consumed_at") @db.Timestamptz(3)
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@index([status, expiresAt])
|
|
@@map("device_authorizations")
|
|
}
|
|
|
|
model LauncherSshKey {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
accountEmail String @map("account_email")
|
|
authUserId String? @map("auth_user_id") @db.Uuid
|
|
publicKey String @map("public_key")
|
|
publicKeyHash String @map("public_key_hash")
|
|
keyType String? @map("key_type")
|
|
label String?
|
|
lastProvisionedAt DateTime @default(now()) @map("last_provisioned_at") @db.Timestamptz(3)
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
|
|
|
@@unique([accountEmail, publicKeyHash])
|
|
@@index([accountEmail])
|
|
@@map("launcher_ssh_keys")
|
|
}
|