@trycompai/db 1.2.2 → 1.2.4
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/dist/generated/prisma/client.d.ts +1 -0
- package/dist/generated/prisma/client.js +4 -0
- package/dist/generated/prisma/default.d.ts +1 -0
- package/dist/generated/prisma/default.js +4 -0
- package/dist/generated/prisma/edge.d.ts +1 -0
- package/dist/generated/prisma/edge.js +785 -0
- package/dist/generated/prisma/index-browser.js +750 -0
- package/dist/generated/prisma/index.d.ts +64125 -0
- package/dist/generated/prisma/index.js +814 -0
- package/dist/generated/prisma/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/dist/generated/prisma/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/dist/generated/prisma/libquery_engine-linux-musl-openssl-3.0.x.so.node +0 -0
- package/dist/generated/prisma/package.json +150 -0
- package/dist/generated/prisma/runtime/edge-esm.js +34 -0
- package/dist/generated/prisma/runtime/edge.js +34 -0
- package/dist/generated/prisma/runtime/index-browser.d.ts +370 -0
- package/dist/generated/prisma/runtime/index-browser.js +16 -0
- package/dist/generated/prisma/runtime/library.d.ts +3697 -0
- package/dist/generated/prisma/runtime/library.js +146 -0
- package/dist/generated/prisma/runtime/react-native.js +83 -0
- package/dist/generated/prisma/runtime/wasm-compiler-edge.js +83 -0
- package/dist/generated/prisma/runtime/wasm-engine-edge.js +35 -0
- package/dist/generated/prisma/schema.prisma +789 -0
- package/dist/generated/prisma/wasm.d.ts +1 -0
- package/dist/generated/prisma/wasm.js +750 -0
- package/package.json +3 -2
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
model Attachment {
|
|
2
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('att'::text)"))
|
|
3
|
+
name String
|
|
4
|
+
url String
|
|
5
|
+
type AttachmentType
|
|
6
|
+
entityId String
|
|
7
|
+
entityType AttachmentEntityType
|
|
8
|
+
|
|
9
|
+
// Dates
|
|
10
|
+
createdAt DateTime @default(now())
|
|
11
|
+
updatedAt DateTime @updatedAt
|
|
12
|
+
|
|
13
|
+
// Relationships
|
|
14
|
+
organizationId String
|
|
15
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
16
|
+
comment Comment? @relation(fields: [commentId], references: [id])
|
|
17
|
+
commentId String?
|
|
18
|
+
|
|
19
|
+
@@index([entityId, entityType])
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
enum AttachmentEntityType {
|
|
23
|
+
task
|
|
24
|
+
vendor
|
|
25
|
+
risk
|
|
26
|
+
comment
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
enum AttachmentType {
|
|
30
|
+
image
|
|
31
|
+
video
|
|
32
|
+
audio
|
|
33
|
+
document
|
|
34
|
+
other
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
model User {
|
|
38
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('usr'::text)"))
|
|
39
|
+
name String
|
|
40
|
+
email String
|
|
41
|
+
emailVerified Boolean
|
|
42
|
+
image String?
|
|
43
|
+
createdAt DateTime @default(now())
|
|
44
|
+
updatedAt DateTime @updatedAt
|
|
45
|
+
lastLogin DateTime?
|
|
46
|
+
|
|
47
|
+
accounts Account[]
|
|
48
|
+
auditLog AuditLog[]
|
|
49
|
+
integrationResults IntegrationResult[]
|
|
50
|
+
invitations Invitation[]
|
|
51
|
+
members Member[]
|
|
52
|
+
sessions Session[]
|
|
53
|
+
|
|
54
|
+
@@unique([email])
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
model EmployeeTrainingVideoCompletion {
|
|
58
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('evc'::text)"))
|
|
59
|
+
completedAt DateTime?
|
|
60
|
+
videoId String
|
|
61
|
+
|
|
62
|
+
memberId String
|
|
63
|
+
member Member @relation(fields: [memberId], references: [id], onDelete: Cascade)
|
|
64
|
+
|
|
65
|
+
@@unique([memberId, videoId])
|
|
66
|
+
@@index([memberId])
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
model Session {
|
|
70
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('ses'::text)"))
|
|
71
|
+
expiresAt DateTime
|
|
72
|
+
token String
|
|
73
|
+
createdAt DateTime @default(now())
|
|
74
|
+
updatedAt DateTime @updatedAt
|
|
75
|
+
ipAddress String?
|
|
76
|
+
userAgent String?
|
|
77
|
+
userId String
|
|
78
|
+
activeOrganizationId String?
|
|
79
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
80
|
+
|
|
81
|
+
@@unique([token])
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
model Account {
|
|
85
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('acc'::text)"))
|
|
86
|
+
accountId String
|
|
87
|
+
providerId String
|
|
88
|
+
userId String
|
|
89
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
90
|
+
accessToken String?
|
|
91
|
+
refreshToken String?
|
|
92
|
+
idToken String?
|
|
93
|
+
accessTokenExpiresAt DateTime?
|
|
94
|
+
refreshTokenExpiresAt DateTime?
|
|
95
|
+
scope String?
|
|
96
|
+
password String?
|
|
97
|
+
createdAt DateTime
|
|
98
|
+
updatedAt DateTime
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
model Verification {
|
|
102
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('ver'::text)"))
|
|
103
|
+
identifier String
|
|
104
|
+
value String
|
|
105
|
+
expiresAt DateTime
|
|
106
|
+
createdAt DateTime @default(now())
|
|
107
|
+
updatedAt DateTime @updatedAt
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
model Member {
|
|
111
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('mem'::text)"))
|
|
112
|
+
organizationId String
|
|
113
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
114
|
+
userId String
|
|
115
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
116
|
+
role String // Purposefully a string, since BetterAuth doesn't support enums this way
|
|
117
|
+
createdAt DateTime @default(now())
|
|
118
|
+
|
|
119
|
+
department Departments @default(none)
|
|
120
|
+
isActive Boolean @default(true)
|
|
121
|
+
employeeTrainingVideoCompletion EmployeeTrainingVideoCompletion[]
|
|
122
|
+
fleetDmLabelId Int?
|
|
123
|
+
|
|
124
|
+
assignedPolicies Policy[] @relation("PolicyAssignee") // Policies where this member is an assignee
|
|
125
|
+
approvedPolicies Policy[] @relation("PolicyApprover") // Policies where this member is an approver
|
|
126
|
+
risks Risk[]
|
|
127
|
+
tasks Task[]
|
|
128
|
+
vendors Vendor[]
|
|
129
|
+
comments Comment[]
|
|
130
|
+
auditLogs AuditLog[]
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
model Invitation {
|
|
134
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('inv'::text)"))
|
|
135
|
+
organizationId String
|
|
136
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
137
|
+
email String
|
|
138
|
+
role String // Purposefully a string, since BetterAuth doesn't support enums this way
|
|
139
|
+
status String
|
|
140
|
+
expiresAt DateTime
|
|
141
|
+
inviterId String
|
|
142
|
+
user User @relation(fields: [inviterId], references: [id], onDelete: Cascade)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// This is only for the app to consume, shouldn't be enforced by DB
|
|
146
|
+
// Otherwise it won't work with Better Auth, as per https://www.better-auth.com/docs/plugins/organization#access-control
|
|
147
|
+
enum Role {
|
|
148
|
+
owner
|
|
149
|
+
admin
|
|
150
|
+
auditor
|
|
151
|
+
employee
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
enum PolicyStatus {
|
|
155
|
+
draft
|
|
156
|
+
published
|
|
157
|
+
needs_review
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
model Comment {
|
|
161
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('cmt'::text)"))
|
|
162
|
+
content String
|
|
163
|
+
entityId String
|
|
164
|
+
entityType CommentEntityType
|
|
165
|
+
|
|
166
|
+
// Dates
|
|
167
|
+
createdAt DateTime @default(now())
|
|
168
|
+
|
|
169
|
+
// Relationships
|
|
170
|
+
authorId String
|
|
171
|
+
author Member @relation(fields: [authorId], references: [id])
|
|
172
|
+
organizationId String
|
|
173
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
174
|
+
|
|
175
|
+
// Relation to Attachments
|
|
176
|
+
attachments Attachment[]
|
|
177
|
+
|
|
178
|
+
@@index([entityId])
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
enum CommentEntityType {
|
|
182
|
+
task
|
|
183
|
+
vendor
|
|
184
|
+
risk
|
|
185
|
+
policy
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
model Context {
|
|
189
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('ctx'::text)"))
|
|
190
|
+
organizationId String
|
|
191
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
192
|
+
|
|
193
|
+
question String
|
|
194
|
+
answer String
|
|
195
|
+
|
|
196
|
+
tags String[]
|
|
197
|
+
|
|
198
|
+
createdAt DateTime @default(now())
|
|
199
|
+
updatedAt DateTime @updatedAt
|
|
200
|
+
|
|
201
|
+
@@index([organizationId])
|
|
202
|
+
@@index([question])
|
|
203
|
+
@@index([answer])
|
|
204
|
+
@@index([tags])
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
model Control {
|
|
208
|
+
// Metadata
|
|
209
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('ctl'::text)"))
|
|
210
|
+
name String
|
|
211
|
+
description String
|
|
212
|
+
|
|
213
|
+
// Review dates
|
|
214
|
+
lastReviewDate DateTime?
|
|
215
|
+
nextReviewDate DateTime?
|
|
216
|
+
|
|
217
|
+
// Relationships
|
|
218
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
219
|
+
organizationId String
|
|
220
|
+
requirementsMapped RequirementMap[]
|
|
221
|
+
tasks Task[]
|
|
222
|
+
policies Policy[]
|
|
223
|
+
controlTemplateId String?
|
|
224
|
+
controlTemplate FrameworkEditorControlTemplate? @relation(fields: [controlTemplateId], references: [id])
|
|
225
|
+
|
|
226
|
+
@@index([organizationId])
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// --- Data for Framework Editor ---
|
|
230
|
+
model FrameworkEditorVideo {
|
|
231
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frk_vi'::text)"))
|
|
232
|
+
title String
|
|
233
|
+
description String
|
|
234
|
+
youtubeId String
|
|
235
|
+
url String
|
|
236
|
+
|
|
237
|
+
// Dates
|
|
238
|
+
createdAt DateTime @default(now())
|
|
239
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
model FrameworkEditorFramework {
|
|
243
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frk'::text)"))
|
|
244
|
+
name String // e.g., "soc2", "iso27001"
|
|
245
|
+
version String
|
|
246
|
+
description String
|
|
247
|
+
visible Boolean @default(false)
|
|
248
|
+
|
|
249
|
+
requirements FrameworkEditorRequirement[]
|
|
250
|
+
frameworkInstances FrameworkInstance[]
|
|
251
|
+
|
|
252
|
+
// Dates
|
|
253
|
+
createdAt DateTime @default(now())
|
|
254
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
model FrameworkEditorRequirement {
|
|
258
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frk_rq'::text)"))
|
|
259
|
+
frameworkId String
|
|
260
|
+
framework FrameworkEditorFramework @relation(fields: [frameworkId], references: [id])
|
|
261
|
+
|
|
262
|
+
name String // Original requirement ID within that framework, e.g., "Privacy"
|
|
263
|
+
identifier String @default("") // Unique identifier for the requirement, e.g., "cc1-1"
|
|
264
|
+
description String
|
|
265
|
+
|
|
266
|
+
controlTemplates FrameworkEditorControlTemplate[]
|
|
267
|
+
requirementMaps RequirementMap[]
|
|
268
|
+
|
|
269
|
+
// Dates
|
|
270
|
+
createdAt DateTime @default(now())
|
|
271
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
model FrameworkEditorPolicyTemplate {
|
|
275
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frk_pt'::text)"))
|
|
276
|
+
name String
|
|
277
|
+
description String
|
|
278
|
+
frequency Frequency // Using the enum from shared.prisma
|
|
279
|
+
department Departments // Using the enum from shared.prisma
|
|
280
|
+
content Json
|
|
281
|
+
|
|
282
|
+
controlTemplates FrameworkEditorControlTemplate[]
|
|
283
|
+
|
|
284
|
+
// Dates
|
|
285
|
+
createdAt DateTime @default(now())
|
|
286
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
287
|
+
|
|
288
|
+
// Instances
|
|
289
|
+
policies Policy[]
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
model FrameworkEditorTaskTemplate {
|
|
293
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frk_tt'::text)"))
|
|
294
|
+
name String
|
|
295
|
+
description String
|
|
296
|
+
frequency Frequency // Using the enum from shared.prisma
|
|
297
|
+
department Departments // Using the enum from shared.prisma
|
|
298
|
+
|
|
299
|
+
controlTemplates FrameworkEditorControlTemplate[]
|
|
300
|
+
|
|
301
|
+
// Dates
|
|
302
|
+
createdAt DateTime @default(now())
|
|
303
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
304
|
+
|
|
305
|
+
// Instances
|
|
306
|
+
tasks Task[]
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
model FrameworkEditorControlTemplate {
|
|
310
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frk_ct'::text)"))
|
|
311
|
+
name String
|
|
312
|
+
description String
|
|
313
|
+
|
|
314
|
+
policyTemplates FrameworkEditorPolicyTemplate[]
|
|
315
|
+
requirements FrameworkEditorRequirement[]
|
|
316
|
+
taskTemplates FrameworkEditorTaskTemplate[]
|
|
317
|
+
|
|
318
|
+
// Dates
|
|
319
|
+
createdAt DateTime @default(now())
|
|
320
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
321
|
+
|
|
322
|
+
// Instances
|
|
323
|
+
controls Control[]
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
model FrameworkInstance {
|
|
327
|
+
// Metadata
|
|
328
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('frm'::text)"))
|
|
329
|
+
organizationId String
|
|
330
|
+
|
|
331
|
+
frameworkId String
|
|
332
|
+
framework FrameworkEditorFramework @relation(fields: [frameworkId], references: [id], onDelete: Cascade)
|
|
333
|
+
|
|
334
|
+
// Relationships
|
|
335
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
336
|
+
requirementsMapped RequirementMap[]
|
|
337
|
+
|
|
338
|
+
@@unique([organizationId, frameworkId])
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
model Integration {
|
|
342
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('int'::text)"))
|
|
343
|
+
name String
|
|
344
|
+
integrationId String
|
|
345
|
+
settings Json
|
|
346
|
+
userSettings Json
|
|
347
|
+
organizationId String
|
|
348
|
+
lastRunAt DateTime?
|
|
349
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
350
|
+
results IntegrationResult[]
|
|
351
|
+
|
|
352
|
+
@@index([organizationId])
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
model IntegrationResult {
|
|
356
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('itr'::text)"))
|
|
357
|
+
title String?
|
|
358
|
+
description String?
|
|
359
|
+
remediation String?
|
|
360
|
+
status String?
|
|
361
|
+
severity String?
|
|
362
|
+
resultDetails Json?
|
|
363
|
+
completedAt DateTime? @default(now())
|
|
364
|
+
integrationId String
|
|
365
|
+
organizationId String
|
|
366
|
+
assignedUserId String?
|
|
367
|
+
|
|
368
|
+
assignedUser User? @relation(fields: [assignedUserId], references: [id], onDelete: Cascade)
|
|
369
|
+
integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)
|
|
370
|
+
|
|
371
|
+
@@index([integrationId])
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
model Onboarding {
|
|
375
|
+
organizationId String @id
|
|
376
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
377
|
+
policies Boolean @default(false)
|
|
378
|
+
employees Boolean @default(false)
|
|
379
|
+
vendors Boolean @default(false)
|
|
380
|
+
integrations Boolean @default(false)
|
|
381
|
+
risk Boolean @default(false)
|
|
382
|
+
team Boolean @default(false)
|
|
383
|
+
tasks Boolean @default(false)
|
|
384
|
+
callBooked Boolean @default(false)
|
|
385
|
+
companyBookingDetails Json?
|
|
386
|
+
companyDetails Json?
|
|
387
|
+
triggerJobId String?
|
|
388
|
+
triggerJobCompleted Boolean @default(false)
|
|
389
|
+
|
|
390
|
+
@@index([organizationId])
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
model Organization {
|
|
394
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('org'::text)"))
|
|
395
|
+
name String
|
|
396
|
+
slug String @unique @default(dbgenerated("generate_prefixed_cuid('slug'::text)"))
|
|
397
|
+
logo String?
|
|
398
|
+
createdAt DateTime @default(now())
|
|
399
|
+
metadata String?
|
|
400
|
+
onboarding Onboarding?
|
|
401
|
+
website String?
|
|
402
|
+
onboardingCompleted Boolean @default(false)
|
|
403
|
+
hasAccess Boolean @default(false)
|
|
404
|
+
|
|
405
|
+
// FleetDM
|
|
406
|
+
fleetDmLabelId Int?
|
|
407
|
+
isFleetSetupCompleted Boolean @default(false)
|
|
408
|
+
|
|
409
|
+
apiKeys ApiKey[]
|
|
410
|
+
auditLog AuditLog[]
|
|
411
|
+
controls Control[]
|
|
412
|
+
frameworkInstances FrameworkInstance[]
|
|
413
|
+
integrations Integration[]
|
|
414
|
+
invitations Invitation[]
|
|
415
|
+
members Member[]
|
|
416
|
+
policy Policy[]
|
|
417
|
+
risk Risk[]
|
|
418
|
+
vendors Vendor[]
|
|
419
|
+
tasks Task[]
|
|
420
|
+
comments Comment[]
|
|
421
|
+
attachments Attachment[]
|
|
422
|
+
trust Trust[]
|
|
423
|
+
context Context[]
|
|
424
|
+
|
|
425
|
+
@@index([slug])
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
model Policy {
|
|
429
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('pol'::text)"))
|
|
430
|
+
name String
|
|
431
|
+
description String?
|
|
432
|
+
status PolicyStatus @default(draft)
|
|
433
|
+
content Json[]
|
|
434
|
+
frequency Frequency?
|
|
435
|
+
department Departments?
|
|
436
|
+
isRequiredToSign Boolean @default(false)
|
|
437
|
+
signedBy String[] @default([])
|
|
438
|
+
reviewDate DateTime?
|
|
439
|
+
isArchived Boolean @default(false)
|
|
440
|
+
|
|
441
|
+
// Dates
|
|
442
|
+
createdAt DateTime @default(now())
|
|
443
|
+
updatedAt DateTime @updatedAt
|
|
444
|
+
lastArchivedAt DateTime?
|
|
445
|
+
lastPublishedAt DateTime?
|
|
446
|
+
|
|
447
|
+
// Relationships
|
|
448
|
+
organizationId String
|
|
449
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
450
|
+
assigneeId String?
|
|
451
|
+
assignee Member? @relation("PolicyAssignee", fields: [assigneeId], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
452
|
+
approverId String?
|
|
453
|
+
approver Member? @relation("PolicyApprover", fields: [approverId], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
454
|
+
policyTemplateId String?
|
|
455
|
+
policyTemplate FrameworkEditorPolicyTemplate? @relation(fields: [policyTemplateId], references: [id])
|
|
456
|
+
controls Control[]
|
|
457
|
+
|
|
458
|
+
@@index([organizationId])
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
model RequirementMap {
|
|
462
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('req'::text)"))
|
|
463
|
+
|
|
464
|
+
requirementId String
|
|
465
|
+
requirement FrameworkEditorRequirement @relation(fields: [requirementId], references: [id], onDelete: Cascade)
|
|
466
|
+
|
|
467
|
+
controlId String
|
|
468
|
+
control Control @relation(fields: [controlId], references: [id], onDelete: Cascade)
|
|
469
|
+
|
|
470
|
+
frameworkInstanceId String
|
|
471
|
+
frameworkInstance FrameworkInstance @relation(fields: [frameworkInstanceId], references: [id], onDelete: Cascade)
|
|
472
|
+
|
|
473
|
+
@@unique([controlId, frameworkInstanceId, requirementId])
|
|
474
|
+
@@index([requirementId, frameworkInstanceId])
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
model Risk {
|
|
478
|
+
// Metadata
|
|
479
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('rsk'::text)"))
|
|
480
|
+
title String
|
|
481
|
+
description String
|
|
482
|
+
category RiskCategory
|
|
483
|
+
department Departments?
|
|
484
|
+
status RiskStatus @default(open)
|
|
485
|
+
likelihood Likelihood @default(very_unlikely)
|
|
486
|
+
impact Impact @default(insignificant)
|
|
487
|
+
residualLikelihood Likelihood @default(very_unlikely)
|
|
488
|
+
residualImpact Impact @default(insignificant)
|
|
489
|
+
treatmentStrategyDescription String?
|
|
490
|
+
treatmentStrategy RiskTreatmentType @default(accept)
|
|
491
|
+
|
|
492
|
+
// Dates
|
|
493
|
+
createdAt DateTime @default(now())
|
|
494
|
+
updatedAt DateTime @updatedAt
|
|
495
|
+
|
|
496
|
+
// Relationships
|
|
497
|
+
organizationId String
|
|
498
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
499
|
+
assigneeId String?
|
|
500
|
+
assignee Member? @relation(fields: [assigneeId], references: [id])
|
|
501
|
+
tasks Task[]
|
|
502
|
+
|
|
503
|
+
@@index([organizationId])
|
|
504
|
+
@@index([category])
|
|
505
|
+
@@index([status])
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
enum RiskTreatmentType {
|
|
509
|
+
accept
|
|
510
|
+
avoid
|
|
511
|
+
mitigate
|
|
512
|
+
transfer
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
enum RiskCategory {
|
|
516
|
+
customer
|
|
517
|
+
governance
|
|
518
|
+
operations
|
|
519
|
+
other
|
|
520
|
+
people
|
|
521
|
+
regulatory
|
|
522
|
+
reporting
|
|
523
|
+
resilience
|
|
524
|
+
technology
|
|
525
|
+
vendor_management
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
enum RiskStatus {
|
|
529
|
+
open
|
|
530
|
+
pending
|
|
531
|
+
closed
|
|
532
|
+
archived
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
model ApiKey {
|
|
536
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('apk'::text)"))
|
|
537
|
+
name String
|
|
538
|
+
key String @unique
|
|
539
|
+
salt String?
|
|
540
|
+
createdAt DateTime @default(now())
|
|
541
|
+
expiresAt DateTime?
|
|
542
|
+
lastUsedAt DateTime?
|
|
543
|
+
isActive Boolean @default(true)
|
|
544
|
+
|
|
545
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
546
|
+
organizationId String
|
|
547
|
+
|
|
548
|
+
@@index([organizationId])
|
|
549
|
+
@@index([key])
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
model AuditLog {
|
|
553
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('aud'::text)"))
|
|
554
|
+
timestamp DateTime @default(now())
|
|
555
|
+
organizationId String
|
|
556
|
+
userId String
|
|
557
|
+
memberId String?
|
|
558
|
+
data Json
|
|
559
|
+
description String?
|
|
560
|
+
entityId String?
|
|
561
|
+
entityType AuditLogEntityType?
|
|
562
|
+
|
|
563
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
564
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
565
|
+
member Member? @relation(fields: [memberId], references: [id], onDelete: Cascade)
|
|
566
|
+
|
|
567
|
+
@@index([userId])
|
|
568
|
+
@@index([organizationId])
|
|
569
|
+
@@index([memberId])
|
|
570
|
+
@@index([entityType])
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
enum AuditLogEntityType {
|
|
574
|
+
organization
|
|
575
|
+
framework
|
|
576
|
+
requirement
|
|
577
|
+
control
|
|
578
|
+
policy
|
|
579
|
+
task
|
|
580
|
+
people
|
|
581
|
+
risk
|
|
582
|
+
vendor
|
|
583
|
+
tests
|
|
584
|
+
integration
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
model GlobalVendors {
|
|
588
|
+
website String @id @unique
|
|
589
|
+
company_name String?
|
|
590
|
+
legal_name String?
|
|
591
|
+
company_description String?
|
|
592
|
+
company_hq_address String?
|
|
593
|
+
privacy_policy_url String?
|
|
594
|
+
terms_of_service_url String?
|
|
595
|
+
service_level_agreement_url String?
|
|
596
|
+
security_page_url String?
|
|
597
|
+
trust_page_url String?
|
|
598
|
+
security_certifications String[]
|
|
599
|
+
subprocessors String[]
|
|
600
|
+
type_of_company String?
|
|
601
|
+
|
|
602
|
+
approved Boolean @default(false)
|
|
603
|
+
createdAt DateTime @default(now())
|
|
604
|
+
|
|
605
|
+
@@index([website])
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
enum Departments {
|
|
609
|
+
none
|
|
610
|
+
admin
|
|
611
|
+
gov
|
|
612
|
+
hr
|
|
613
|
+
it
|
|
614
|
+
itsm
|
|
615
|
+
qms
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
enum Frequency {
|
|
619
|
+
monthly
|
|
620
|
+
quarterly
|
|
621
|
+
yearly
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
enum Likelihood {
|
|
625
|
+
very_unlikely
|
|
626
|
+
unlikely
|
|
627
|
+
possible
|
|
628
|
+
likely
|
|
629
|
+
very_likely
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
enum Impact {
|
|
633
|
+
insignificant
|
|
634
|
+
minor
|
|
635
|
+
moderate
|
|
636
|
+
major
|
|
637
|
+
severe
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
model Task {
|
|
641
|
+
// Metadata
|
|
642
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('tsk'::text)"))
|
|
643
|
+
title String
|
|
644
|
+
description String
|
|
645
|
+
status TaskStatus @default(todo)
|
|
646
|
+
frequency TaskFrequency?
|
|
647
|
+
department Departments? @default(none)
|
|
648
|
+
order Int @default(0)
|
|
649
|
+
|
|
650
|
+
// Dates
|
|
651
|
+
createdAt DateTime @default(now())
|
|
652
|
+
updatedAt DateTime @updatedAt
|
|
653
|
+
lastCompletedAt DateTime?
|
|
654
|
+
|
|
655
|
+
// Relationships
|
|
656
|
+
controls Control[]
|
|
657
|
+
vendors Vendor[]
|
|
658
|
+
risks Risk[]
|
|
659
|
+
assigneeId String?
|
|
660
|
+
assignee Member? @relation(fields: [assigneeId], references: [id])
|
|
661
|
+
organizationId String
|
|
662
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
663
|
+
taskTemplateId String?
|
|
664
|
+
taskTemplate FrameworkEditorTaskTemplate? @relation(fields: [taskTemplateId], references: [id])
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
enum TaskStatus {
|
|
668
|
+
todo
|
|
669
|
+
in_progress
|
|
670
|
+
done
|
|
671
|
+
not_relevant
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
enum TaskFrequency {
|
|
675
|
+
daily
|
|
676
|
+
weekly
|
|
677
|
+
monthly
|
|
678
|
+
quarterly
|
|
679
|
+
yearly
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
model Trust {
|
|
683
|
+
organizationId String
|
|
684
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
685
|
+
friendlyUrl String? @unique
|
|
686
|
+
domain String?
|
|
687
|
+
domainVerified Boolean @default(false)
|
|
688
|
+
isVercelDomain Boolean @default(false)
|
|
689
|
+
vercelVerification String?
|
|
690
|
+
status TrustStatus @default(draft)
|
|
691
|
+
contactEmail String?
|
|
692
|
+
|
|
693
|
+
email String?
|
|
694
|
+
privacyPolicy String?
|
|
695
|
+
soc2 Boolean @default(false)
|
|
696
|
+
iso27001 Boolean @default(false)
|
|
697
|
+
gdpr Boolean @default(false)
|
|
698
|
+
|
|
699
|
+
soc2_status FrameworkStatus @default(started)
|
|
700
|
+
iso27001_status FrameworkStatus @default(started)
|
|
701
|
+
gdpr_status FrameworkStatus @default(started)
|
|
702
|
+
|
|
703
|
+
@@id([status, organizationId])
|
|
704
|
+
@@unique([organizationId])
|
|
705
|
+
@@index([organizationId])
|
|
706
|
+
@@index([friendlyUrl])
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
enum TrustStatus {
|
|
710
|
+
draft
|
|
711
|
+
published
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
enum FrameworkStatus {
|
|
715
|
+
started
|
|
716
|
+
in_progress
|
|
717
|
+
compliant
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
model Vendor {
|
|
721
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('vnd'::text)"))
|
|
722
|
+
name String
|
|
723
|
+
description String
|
|
724
|
+
category VendorCategory @default(other)
|
|
725
|
+
status VendorStatus @default(not_assessed)
|
|
726
|
+
inherentProbability Likelihood @default(very_unlikely)
|
|
727
|
+
inherentImpact Impact @default(insignificant)
|
|
728
|
+
residualProbability Likelihood @default(very_unlikely)
|
|
729
|
+
residualImpact Impact @default(insignificant)
|
|
730
|
+
website String?
|
|
731
|
+
|
|
732
|
+
createdAt DateTime @default(now())
|
|
733
|
+
updatedAt DateTime @updatedAt
|
|
734
|
+
|
|
735
|
+
organizationId String
|
|
736
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
737
|
+
assigneeId String?
|
|
738
|
+
assignee Member? @relation(fields: [assigneeId], references: [id], onDelete: Cascade)
|
|
739
|
+
contacts VendorContact[]
|
|
740
|
+
tasks Task[]
|
|
741
|
+
|
|
742
|
+
@@index([organizationId])
|
|
743
|
+
@@index([assigneeId])
|
|
744
|
+
@@index([category])
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
model VendorContact {
|
|
748
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('vct'::text)"))
|
|
749
|
+
vendorId String
|
|
750
|
+
name String
|
|
751
|
+
email String
|
|
752
|
+
phone String
|
|
753
|
+
createdAt DateTime @default(now())
|
|
754
|
+
updatedAt DateTime @updatedAt
|
|
755
|
+
Vendor Vendor @relation(fields: [vendorId], references: [id], onDelete: Cascade)
|
|
756
|
+
|
|
757
|
+
@@index([vendorId])
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
enum VendorCategory {
|
|
761
|
+
cloud
|
|
762
|
+
infrastructure
|
|
763
|
+
software_as_a_service
|
|
764
|
+
finance
|
|
765
|
+
marketing
|
|
766
|
+
sales
|
|
767
|
+
hr
|
|
768
|
+
other
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
enum VendorStatus {
|
|
772
|
+
not_assessed
|
|
773
|
+
in_progress
|
|
774
|
+
assessed
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
generator client {
|
|
778
|
+
provider = "prisma-client-js"
|
|
779
|
+
previewFeatures = ["postgresqlExtensions"]
|
|
780
|
+
binaryTargets = ["native", "darwin-arm64", "debian-openssl-3.0.x", "linux-musl-openssl-3.0.x"]
|
|
781
|
+
output = "./generated/prisma"
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
datasource db {
|
|
785
|
+
provider = "postgresql"
|
|
786
|
+
url = env("DATABASE_URL")
|
|
787
|
+
directUrl = env("DATABASE_URL")
|
|
788
|
+
extensions = [pgcrypto]
|
|
789
|
+
}
|