@actuate-media/cms-core 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/__tests__/auth/session.test.js +1 -1
- package/dist/__tests__/auth/session.test.js.map +1 -1
- package/dist/api/handler-factory.d.ts.map +1 -1
- package/dist/api/handler-factory.js +85 -68
- package/dist/api/handler-factory.js.map +1 -1
- package/dist/api/handlers.d.ts +1 -1
- package/dist/api/handlers.d.ts.map +1 -1
- package/dist/api/handlers.js +171 -30
- package/dist/api/handlers.js.map +1 -1
- package/dist/api/index.d.ts +2 -19
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -54
- package/dist/api/index.js.map +1 -1
- package/dist/api/router.d.ts +20 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +55 -0
- package/dist/api/router.js.map +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/i18n/index.js +8 -8
- package/dist/media/optimize.d.ts +2 -3
- package/dist/media/optimize.d.ts.map +1 -1
- package/dist/media/optimize.js +10 -1
- package/dist/media/optimize.js.map +1 -1
- package/dist/next.d.ts +3 -3
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +8 -8
- package/dist/next.js.map +1 -1
- package/dist/search/index.js +22 -22
- package/dist/security/anomaly-detection.d.ts +1 -1
- package/dist/security/anomaly-detection.d.ts.map +1 -1
- package/dist/security/anomaly-detection.js +27 -5
- package/dist/security/anomaly-detection.js.map +1 -1
- package/dist/security/reauth.d.ts +1 -1
- package/dist/security/reauth.d.ts.map +1 -1
- package/dist/security/reauth.js +12 -4
- package/dist/security/reauth.js.map +1 -1
- package/dist/security/sanitize.d.ts +1 -1
- package/dist/security/sanitize.d.ts.map +1 -1
- package/dist/security/sanitize.js +9 -11
- package/dist/security/sanitize.js.map +1 -1
- package/dist/security/webhook.d.ts +1 -1
- package/dist/security/webhook.d.ts.map +1 -1
- package/dist/security/webhook.js +24 -3
- package/dist/security/webhook.js.map +1 -1
- package/package.json +3 -2
- package/prisma/cms-schema.prisma +237 -237
- package/prisma/migrations/0001_init/migration.sql +384 -384
- package/prisma/migrations/0002_folders/migration.sql +39 -39
- package/prisma/migrations/0003_search_and_webhooks/migration.sql +50 -50
- package/prisma/migrations/migration_lock.toml +3 -3
- package/prisma/schema.prisma +485 -485
- package/prisma/seed.ts +82 -82
- package/generated/browser.ts +0 -109
- package/generated/client.ts +0 -133
- package/generated/commonInputTypes.ts +0 -709
- package/generated/enums.ts +0 -125
- package/generated/internal/class.ts +0 -376
- package/generated/internal/prismaNamespace.ts +0 -2617
- package/generated/internal/prismaNamespaceBrowser.ts +0 -611
- package/generated/models/ApiKey.ts +0 -1550
- package/generated/models/AuditLog.ts +0 -1206
- package/generated/models/BackupRecord.ts +0 -1250
- package/generated/models/ContentLock.ts +0 -1472
- package/generated/models/ContentTemplate.ts +0 -1416
- package/generated/models/Document.ts +0 -3005
- package/generated/models/Folder.ts +0 -1904
- package/generated/models/FormSubmission.ts +0 -1200
- package/generated/models/InAppNotification.ts +0 -1457
- package/generated/models/Media.ts +0 -2340
- package/generated/models/MediaUsage.ts +0 -1472
- package/generated/models/OAuthAccount.ts +0 -1463
- package/generated/models/Redirect.ts +0 -1284
- package/generated/models/Session.ts +0 -1492
- package/generated/models/Site.ts +0 -1206
- package/generated/models/User.ts +0 -3513
- package/generated/models/Version.ts +0 -1511
- package/generated/models/WorkflowState.ts +0 -1514
- package/generated/models.ts +0 -29
package/prisma/cms-schema.prisma
CHANGED
|
@@ -1,237 +1,237 @@
|
|
|
1
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
2
|
-
// Actuate CMS — Prisma schema fragment
|
|
3
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
4
|
-
//
|
|
5
|
-
// This file defines the database models expected by `@actuatecms/cms-core` API
|
|
6
|
-
// handlers and server actions. It is a **fragment**: it does not include a
|
|
7
|
-
// `datasource` or `generator` block.
|
|
8
|
-
//
|
|
9
|
-
// ── How to merge into your project ─────────────────────────────────────────────
|
|
10
|
-
//
|
|
11
|
-
// 1. Ensure your root `schema.prisma` uses PostgreSQL, for example:
|
|
12
|
-
// datasource db {
|
|
13
|
-
// provider = "postgresql"
|
|
14
|
-
// url = env("DATABASE_URL")
|
|
15
|
-
// }
|
|
16
|
-
// generator client {
|
|
17
|
-
// provider = "prisma-client-js"
|
|
18
|
-
// output = "../node_modules/.prisma/client"
|
|
19
|
-
// }
|
|
20
|
-
//
|
|
21
|
-
// 2. Copy the `enum` and `model` blocks below into your `schema.prisma` (or use
|
|
22
|
-
// Prisma’s multi-file schema preview: put this file in `prisma/schema/` and
|
|
23
|
-
// include it per Prisma’s multi-file docs).
|
|
24
|
-
//
|
|
25
|
-
// 3. Resolve naming clashes: if you already have a `User` or `Document` model,
|
|
26
|
-
// rename these models and update your Actuate integration to use a custom
|
|
27
|
-
// Prisma client, or map tables with `@@map("…")` and align delegate names.
|
|
28
|
-
//
|
|
29
|
-
// 4. Run migrations:
|
|
30
|
-
// npx prisma migrate dev --name actuate-cms
|
|
31
|
-
//
|
|
32
|
-
// Models mirror `packages/cms-core/src/api/handlers.ts` and `actions.ts`
|
|
33
|
-
// (including `contentHash`, `changeType` on versions, scheduling fields, etc.).
|
|
34
|
-
//
|
|
35
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
36
|
-
|
|
37
|
-
enum DocumentStatus {
|
|
38
|
-
DRAFT
|
|
39
|
-
PUBLISHED
|
|
40
|
-
ARCHIVED
|
|
41
|
-
SCHEDULED
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
model User {
|
|
45
|
-
id String @id @default(cuid())
|
|
46
|
-
email String @unique
|
|
47
|
-
name String @default("")
|
|
48
|
-
role String @default("EDITOR")
|
|
49
|
-
passwordHash String?
|
|
50
|
-
isActive Boolean @default(true)
|
|
51
|
-
isApproved Boolean @default(false)
|
|
52
|
-
emailVerified Boolean @default(false)
|
|
53
|
-
totpEnabled Boolean @default(false)
|
|
54
|
-
totpSecret String?
|
|
55
|
-
/// JSON array of one-time backup codes (e.g. `["abcd-1234", …]`).
|
|
56
|
-
backupCodes Json?
|
|
57
|
-
oauthProvider String?
|
|
58
|
-
oauthId String?
|
|
59
|
-
createdAt DateTime @default(now())
|
|
60
|
-
updatedAt DateTime @updatedAt
|
|
61
|
-
|
|
62
|
-
sessions Session[]
|
|
63
|
-
documentsCreated Document[] @relation("DocumentCreatedBy")
|
|
64
|
-
documentsUpdated Document[] @relation("DocumentUpdatedBy")
|
|
65
|
-
documentsReviewed Document[] @relation("DocumentReviewer")
|
|
66
|
-
versions Version[]
|
|
67
|
-
mediaUploaded Media[] @relation("MediaUploadedBy")
|
|
68
|
-
auditLogs AuditLog[]
|
|
69
|
-
|
|
70
|
-
@@index([role])
|
|
71
|
-
@@index([isActive])
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
model Session {
|
|
75
|
-
id String @id @default(cuid())
|
|
76
|
-
userId String
|
|
77
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
78
|
-
/// JWT or opaque session token; optional until first persisted login (e.g. OAuth).
|
|
79
|
-
token String? @unique
|
|
80
|
-
expiresAt DateTime
|
|
81
|
-
revokedAt DateTime?
|
|
82
|
-
ipAddress String?
|
|
83
|
-
userAgent String?
|
|
84
|
-
createdAt DateTime @default(now())
|
|
85
|
-
|
|
86
|
-
@@index([userId])
|
|
87
|
-
@@index([expiresAt])
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
model Document {
|
|
91
|
-
id String @id @default(cuid())
|
|
92
|
-
collection String
|
|
93
|
-
slug String?
|
|
94
|
-
title String?
|
|
95
|
-
data Json
|
|
96
|
-
status DocumentStatus @default(DRAFT)
|
|
97
|
-
plainText String? @db.Text
|
|
98
|
-
locale String?
|
|
99
|
-
folderId String?
|
|
100
|
-
structuredData Json?
|
|
101
|
-
workflowStage String?
|
|
102
|
-
reviewerId String?
|
|
103
|
-
reviewNote String? @db.Text
|
|
104
|
-
publishedAt DateTime?
|
|
105
|
-
scheduledAt DateTime?
|
|
106
|
-
scheduledUnpublishAt DateTime?
|
|
107
|
-
deletedAt DateTime?
|
|
108
|
-
contentHash String?
|
|
109
|
-
siteId String?
|
|
110
|
-
templateId String?
|
|
111
|
-
createdById String
|
|
112
|
-
updatedById String
|
|
113
|
-
createdAt DateTime @default(now())
|
|
114
|
-
updatedAt DateTime @updatedAt
|
|
115
|
-
|
|
116
|
-
createdBy User @relation("DocumentCreatedBy", fields: [createdById], references: [id], onDelete: Restrict)
|
|
117
|
-
updatedBy User @relation("DocumentUpdatedBy", fields: [updatedById], references: [id], onDelete: Restrict)
|
|
118
|
-
reviewer User? @relation("DocumentReviewer", fields: [reviewerId], references: [id], onDelete: SetNull)
|
|
119
|
-
folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
|
|
120
|
-
versions Version[]
|
|
121
|
-
formSubmissions FormSubmission[]
|
|
122
|
-
|
|
123
|
-
@@unique([collection, slug], name: "collection_slug")
|
|
124
|
-
@@index([collection])
|
|
125
|
-
@@index([status])
|
|
126
|
-
@@index([deletedAt])
|
|
127
|
-
@@index([publishedAt])
|
|
128
|
-
@@index([folderId])
|
|
129
|
-
@@index([locale])
|
|
130
|
-
@@index([scheduledAt])
|
|
131
|
-
@@index([scheduledUnpublishAt])
|
|
132
|
-
@@index([createdById])
|
|
133
|
-
@@index([updatedById])
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
model Media {
|
|
137
|
-
id String @id @default(cuid())
|
|
138
|
-
filename String
|
|
139
|
-
storageKey String @unique
|
|
140
|
-
mimeType String
|
|
141
|
-
fileSize Int
|
|
142
|
-
width Int?
|
|
143
|
-
height Int?
|
|
144
|
-
altText String?
|
|
145
|
-
title String?
|
|
146
|
-
blurHash String?
|
|
147
|
-
focalPointX Float?
|
|
148
|
-
focalPointY Float?
|
|
149
|
-
folderId String?
|
|
150
|
-
uploadedById String
|
|
151
|
-
createdAt DateTime @default(now())
|
|
152
|
-
updatedAt DateTime @updatedAt
|
|
153
|
-
|
|
154
|
-
uploadedBy User @relation("MediaUploadedBy", fields: [uploadedById], references: [id], onDelete: Restrict)
|
|
155
|
-
folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
|
|
156
|
-
|
|
157
|
-
@@index([folderId])
|
|
158
|
-
@@index([mimeType])
|
|
159
|
-
@@index([createdAt])
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
model Version {
|
|
163
|
-
id String @id @default(cuid())
|
|
164
|
-
documentId String
|
|
165
|
-
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
|
|
166
|
-
data Json
|
|
167
|
-
changedById String
|
|
168
|
-
changedBy User @relation(fields: [changedById], references: [id], onDelete: Restrict)
|
|
169
|
-
/// CREATE | UPDATE | DELETE (see `actions.ts` / workflow).
|
|
170
|
-
changeType String @default("UPDATE")
|
|
171
|
-
createdAt DateTime @default(now())
|
|
172
|
-
|
|
173
|
-
@@index([documentId])
|
|
174
|
-
@@index([createdAt])
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
model Folder {
|
|
178
|
-
id String @id @default(cuid())
|
|
179
|
-
name String
|
|
180
|
-
/// Discriminator for folder trees (e.g. `documents`, `media`).
|
|
181
|
-
scope String
|
|
182
|
-
parentId String?
|
|
183
|
-
position Int @default(0)
|
|
184
|
-
createdAt DateTime @default(now())
|
|
185
|
-
|
|
186
|
-
parent Folder? @relation("FolderTree", fields: [parentId], references: [id], onDelete: Cascade)
|
|
187
|
-
children Folder[] @relation("FolderTree")
|
|
188
|
-
documents Document[]
|
|
189
|
-
media Media[]
|
|
190
|
-
|
|
191
|
-
@@index([scope])
|
|
192
|
-
@@index([parentId])
|
|
193
|
-
@@index([scope, parentId, position])
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
model Redirect {
|
|
197
|
-
id String @id @default(cuid())
|
|
198
|
-
source String
|
|
199
|
-
destination String
|
|
200
|
-
statusCode Int @default(301)
|
|
201
|
-
isRegex Boolean @default(false)
|
|
202
|
-
notes String?
|
|
203
|
-
createdAt DateTime @default(now())
|
|
204
|
-
updatedAt DateTime @updatedAt
|
|
205
|
-
|
|
206
|
-
@@unique([source])
|
|
207
|
-
@@index([createdAt])
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
model FormSubmission {
|
|
211
|
-
id String @id @default(cuid())
|
|
212
|
-
formId String
|
|
213
|
-
form Document @relation(fields: [formId], references: [id], onDelete: Cascade)
|
|
214
|
-
data Json
|
|
215
|
-
attribution Json?
|
|
216
|
-
submittedAt DateTime @default(now())
|
|
217
|
-
createdAt DateTime @default(now())
|
|
218
|
-
|
|
219
|
-
@@index([formId])
|
|
220
|
-
@@index([submittedAt])
|
|
221
|
-
@@index([createdAt])
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
model AuditLog {
|
|
225
|
-
id String @id @default(cuid())
|
|
226
|
-
event String
|
|
227
|
-
userId String?
|
|
228
|
-
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
229
|
-
details Json?
|
|
230
|
-
ipAddress String?
|
|
231
|
-
userAgent String?
|
|
232
|
-
createdAt DateTime @default(now())
|
|
233
|
-
|
|
234
|
-
@@index([event])
|
|
235
|
-
@@index([userId])
|
|
236
|
-
@@index([createdAt])
|
|
237
|
-
}
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// Actuate CMS — Prisma schema fragment
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// This file defines the database models expected by `@actuatecms/cms-core` API
|
|
6
|
+
// handlers and server actions. It is a **fragment**: it does not include a
|
|
7
|
+
// `datasource` or `generator` block.
|
|
8
|
+
//
|
|
9
|
+
// ── How to merge into your project ─────────────────────────────────────────────
|
|
10
|
+
//
|
|
11
|
+
// 1. Ensure your root `schema.prisma` uses PostgreSQL, for example:
|
|
12
|
+
// datasource db {
|
|
13
|
+
// provider = "postgresql"
|
|
14
|
+
// url = env("DATABASE_URL")
|
|
15
|
+
// }
|
|
16
|
+
// generator client {
|
|
17
|
+
// provider = "prisma-client-js"
|
|
18
|
+
// output = "../node_modules/.prisma/client"
|
|
19
|
+
// }
|
|
20
|
+
//
|
|
21
|
+
// 2. Copy the `enum` and `model` blocks below into your `schema.prisma` (or use
|
|
22
|
+
// Prisma’s multi-file schema preview: put this file in `prisma/schema/` and
|
|
23
|
+
// include it per Prisma’s multi-file docs).
|
|
24
|
+
//
|
|
25
|
+
// 3. Resolve naming clashes: if you already have a `User` or `Document` model,
|
|
26
|
+
// rename these models and update your Actuate integration to use a custom
|
|
27
|
+
// Prisma client, or map tables with `@@map("…")` and align delegate names.
|
|
28
|
+
//
|
|
29
|
+
// 4. Run migrations:
|
|
30
|
+
// npx prisma migrate dev --name actuate-cms
|
|
31
|
+
//
|
|
32
|
+
// Models mirror `packages/cms-core/src/api/handlers.ts` and `actions.ts`
|
|
33
|
+
// (including `contentHash`, `changeType` on versions, scheduling fields, etc.).
|
|
34
|
+
//
|
|
35
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
36
|
+
|
|
37
|
+
enum DocumentStatus {
|
|
38
|
+
DRAFT
|
|
39
|
+
PUBLISHED
|
|
40
|
+
ARCHIVED
|
|
41
|
+
SCHEDULED
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
model User {
|
|
45
|
+
id String @id @default(cuid())
|
|
46
|
+
email String @unique
|
|
47
|
+
name String @default("")
|
|
48
|
+
role String @default("EDITOR")
|
|
49
|
+
passwordHash String?
|
|
50
|
+
isActive Boolean @default(true)
|
|
51
|
+
isApproved Boolean @default(false)
|
|
52
|
+
emailVerified Boolean @default(false)
|
|
53
|
+
totpEnabled Boolean @default(false)
|
|
54
|
+
totpSecret String?
|
|
55
|
+
/// JSON array of one-time backup codes (e.g. `["abcd-1234", …]`).
|
|
56
|
+
backupCodes Json?
|
|
57
|
+
oauthProvider String?
|
|
58
|
+
oauthId String?
|
|
59
|
+
createdAt DateTime @default(now())
|
|
60
|
+
updatedAt DateTime @updatedAt
|
|
61
|
+
|
|
62
|
+
sessions Session[]
|
|
63
|
+
documentsCreated Document[] @relation("DocumentCreatedBy")
|
|
64
|
+
documentsUpdated Document[] @relation("DocumentUpdatedBy")
|
|
65
|
+
documentsReviewed Document[] @relation("DocumentReviewer")
|
|
66
|
+
versions Version[]
|
|
67
|
+
mediaUploaded Media[] @relation("MediaUploadedBy")
|
|
68
|
+
auditLogs AuditLog[]
|
|
69
|
+
|
|
70
|
+
@@index([role])
|
|
71
|
+
@@index([isActive])
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
model Session {
|
|
75
|
+
id String @id @default(cuid())
|
|
76
|
+
userId String
|
|
77
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
78
|
+
/// JWT or opaque session token; optional until first persisted login (e.g. OAuth).
|
|
79
|
+
token String? @unique
|
|
80
|
+
expiresAt DateTime
|
|
81
|
+
revokedAt DateTime?
|
|
82
|
+
ipAddress String?
|
|
83
|
+
userAgent String?
|
|
84
|
+
createdAt DateTime @default(now())
|
|
85
|
+
|
|
86
|
+
@@index([userId])
|
|
87
|
+
@@index([expiresAt])
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
model Document {
|
|
91
|
+
id String @id @default(cuid())
|
|
92
|
+
collection String
|
|
93
|
+
slug String?
|
|
94
|
+
title String?
|
|
95
|
+
data Json
|
|
96
|
+
status DocumentStatus @default(DRAFT)
|
|
97
|
+
plainText String? @db.Text
|
|
98
|
+
locale String?
|
|
99
|
+
folderId String?
|
|
100
|
+
structuredData Json?
|
|
101
|
+
workflowStage String?
|
|
102
|
+
reviewerId String?
|
|
103
|
+
reviewNote String? @db.Text
|
|
104
|
+
publishedAt DateTime?
|
|
105
|
+
scheduledAt DateTime?
|
|
106
|
+
scheduledUnpublishAt DateTime?
|
|
107
|
+
deletedAt DateTime?
|
|
108
|
+
contentHash String?
|
|
109
|
+
siteId String?
|
|
110
|
+
templateId String?
|
|
111
|
+
createdById String
|
|
112
|
+
updatedById String
|
|
113
|
+
createdAt DateTime @default(now())
|
|
114
|
+
updatedAt DateTime @updatedAt
|
|
115
|
+
|
|
116
|
+
createdBy User @relation("DocumentCreatedBy", fields: [createdById], references: [id], onDelete: Restrict)
|
|
117
|
+
updatedBy User @relation("DocumentUpdatedBy", fields: [updatedById], references: [id], onDelete: Restrict)
|
|
118
|
+
reviewer User? @relation("DocumentReviewer", fields: [reviewerId], references: [id], onDelete: SetNull)
|
|
119
|
+
folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
|
|
120
|
+
versions Version[]
|
|
121
|
+
formSubmissions FormSubmission[]
|
|
122
|
+
|
|
123
|
+
@@unique([collection, slug], name: "collection_slug")
|
|
124
|
+
@@index([collection])
|
|
125
|
+
@@index([status])
|
|
126
|
+
@@index([deletedAt])
|
|
127
|
+
@@index([publishedAt])
|
|
128
|
+
@@index([folderId])
|
|
129
|
+
@@index([locale])
|
|
130
|
+
@@index([scheduledAt])
|
|
131
|
+
@@index([scheduledUnpublishAt])
|
|
132
|
+
@@index([createdById])
|
|
133
|
+
@@index([updatedById])
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
model Media {
|
|
137
|
+
id String @id @default(cuid())
|
|
138
|
+
filename String
|
|
139
|
+
storageKey String @unique
|
|
140
|
+
mimeType String
|
|
141
|
+
fileSize Int
|
|
142
|
+
width Int?
|
|
143
|
+
height Int?
|
|
144
|
+
altText String?
|
|
145
|
+
title String?
|
|
146
|
+
blurHash String?
|
|
147
|
+
focalPointX Float?
|
|
148
|
+
focalPointY Float?
|
|
149
|
+
folderId String?
|
|
150
|
+
uploadedById String
|
|
151
|
+
createdAt DateTime @default(now())
|
|
152
|
+
updatedAt DateTime @updatedAt
|
|
153
|
+
|
|
154
|
+
uploadedBy User @relation("MediaUploadedBy", fields: [uploadedById], references: [id], onDelete: Restrict)
|
|
155
|
+
folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
|
|
156
|
+
|
|
157
|
+
@@index([folderId])
|
|
158
|
+
@@index([mimeType])
|
|
159
|
+
@@index([createdAt])
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
model Version {
|
|
163
|
+
id String @id @default(cuid())
|
|
164
|
+
documentId String
|
|
165
|
+
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
|
|
166
|
+
data Json
|
|
167
|
+
changedById String
|
|
168
|
+
changedBy User @relation(fields: [changedById], references: [id], onDelete: Restrict)
|
|
169
|
+
/// CREATE | UPDATE | DELETE (see `actions.ts` / workflow).
|
|
170
|
+
changeType String @default("UPDATE")
|
|
171
|
+
createdAt DateTime @default(now())
|
|
172
|
+
|
|
173
|
+
@@index([documentId])
|
|
174
|
+
@@index([createdAt])
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
model Folder {
|
|
178
|
+
id String @id @default(cuid())
|
|
179
|
+
name String
|
|
180
|
+
/// Discriminator for folder trees (e.g. `documents`, `media`).
|
|
181
|
+
scope String
|
|
182
|
+
parentId String?
|
|
183
|
+
position Int @default(0)
|
|
184
|
+
createdAt DateTime @default(now())
|
|
185
|
+
|
|
186
|
+
parent Folder? @relation("FolderTree", fields: [parentId], references: [id], onDelete: Cascade)
|
|
187
|
+
children Folder[] @relation("FolderTree")
|
|
188
|
+
documents Document[]
|
|
189
|
+
media Media[]
|
|
190
|
+
|
|
191
|
+
@@index([scope])
|
|
192
|
+
@@index([parentId])
|
|
193
|
+
@@index([scope, parentId, position])
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
model Redirect {
|
|
197
|
+
id String @id @default(cuid())
|
|
198
|
+
source String
|
|
199
|
+
destination String
|
|
200
|
+
statusCode Int @default(301)
|
|
201
|
+
isRegex Boolean @default(false)
|
|
202
|
+
notes String?
|
|
203
|
+
createdAt DateTime @default(now())
|
|
204
|
+
updatedAt DateTime @updatedAt
|
|
205
|
+
|
|
206
|
+
@@unique([source])
|
|
207
|
+
@@index([createdAt])
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
model FormSubmission {
|
|
211
|
+
id String @id @default(cuid())
|
|
212
|
+
formId String
|
|
213
|
+
form Document @relation(fields: [formId], references: [id], onDelete: Cascade)
|
|
214
|
+
data Json
|
|
215
|
+
attribution Json?
|
|
216
|
+
submittedAt DateTime @default(now())
|
|
217
|
+
createdAt DateTime @default(now())
|
|
218
|
+
|
|
219
|
+
@@index([formId])
|
|
220
|
+
@@index([submittedAt])
|
|
221
|
+
@@index([createdAt])
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
model AuditLog {
|
|
225
|
+
id String @id @default(cuid())
|
|
226
|
+
event String
|
|
227
|
+
userId String?
|
|
228
|
+
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
229
|
+
details Json?
|
|
230
|
+
ipAddress String?
|
|
231
|
+
userAgent String?
|
|
232
|
+
createdAt DateTime @default(now())
|
|
233
|
+
|
|
234
|
+
@@index([event])
|
|
235
|
+
@@index([userId])
|
|
236
|
+
@@index([createdAt])
|
|
237
|
+
}
|