@varaos/db 1.0.3 → 1.1.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/package.json
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "public"."Job" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"type" TEXT NOT NULL,
|
|
5
|
+
"status" TEXT NOT NULL DEFAULT 'pending',
|
|
6
|
+
"payload" JSONB NOT NULL,
|
|
7
|
+
"retries" INTEGER NOT NULL DEFAULT 0,
|
|
8
|
+
"maxRetries" INTEGER NOT NULL DEFAULT 3,
|
|
9
|
+
"error" TEXT,
|
|
10
|
+
"scheduledAt" TIMESTAMP(3),
|
|
11
|
+
"startedAt" TIMESTAMP(3),
|
|
12
|
+
"finishedAt" TIMESTAMP(3),
|
|
13
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
14
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
15
|
+
|
|
16
|
+
CONSTRAINT "Job_pkey" PRIMARY KEY ("id")
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- CreateTable
|
|
20
|
+
CREATE TABLE "public"."Workflow" (
|
|
21
|
+
"id" TEXT NOT NULL,
|
|
22
|
+
"name" TEXT NOT NULL,
|
|
23
|
+
"description" TEXT,
|
|
24
|
+
"status" TEXT NOT NULL DEFAULT 'active',
|
|
25
|
+
"userId" TEXT NOT NULL,
|
|
26
|
+
"workspaceId" TEXT,
|
|
27
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
28
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
29
|
+
|
|
30
|
+
CONSTRAINT "Workflow_pkey" PRIMARY KEY ("id")
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
-- CreateTable
|
|
34
|
+
CREATE TABLE "public"."WorkflowStep" (
|
|
35
|
+
"id" TEXT NOT NULL,
|
|
36
|
+
"workflowId" TEXT NOT NULL,
|
|
37
|
+
"type" TEXT NOT NULL,
|
|
38
|
+
"config" JSONB NOT NULL,
|
|
39
|
+
"order" INTEGER NOT NULL,
|
|
40
|
+
"status" TEXT NOT NULL DEFAULT 'active',
|
|
41
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
42
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
43
|
+
|
|
44
|
+
CONSTRAINT "WorkflowStep_pkey" PRIMARY KEY ("id")
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
-- CreateTable
|
|
48
|
+
CREATE TABLE "public"."WorkflowRun" (
|
|
49
|
+
"id" TEXT NOT NULL,
|
|
50
|
+
"workflowId" TEXT NOT NULL,
|
|
51
|
+
"status" TEXT NOT NULL DEFAULT 'running',
|
|
52
|
+
"input" JSONB,
|
|
53
|
+
"output" JSONB,
|
|
54
|
+
"error" TEXT,
|
|
55
|
+
"startedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
56
|
+
"finishedAt" TIMESTAMP(3),
|
|
57
|
+
|
|
58
|
+
CONSTRAINT "WorkflowRun_pkey" PRIMARY KEY ("id")
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
-- CreateTable
|
|
62
|
+
CREATE TABLE "public"."WorkflowStepRun" (
|
|
63
|
+
"id" TEXT NOT NULL,
|
|
64
|
+
"workflowRunId" TEXT NOT NULL,
|
|
65
|
+
"workflowStepId" TEXT NOT NULL,
|
|
66
|
+
"status" TEXT NOT NULL DEFAULT 'pending',
|
|
67
|
+
"input" JSONB,
|
|
68
|
+
"output" JSONB,
|
|
69
|
+
"error" TEXT,
|
|
70
|
+
"startedAt" TIMESTAMP(3),
|
|
71
|
+
"finishedAt" TIMESTAMP(3),
|
|
72
|
+
|
|
73
|
+
CONSTRAINT "WorkflowStepRun_pkey" PRIMARY KEY ("id")
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
-- CreateTable
|
|
77
|
+
CREATE TABLE "public"."Notification" (
|
|
78
|
+
"id" TEXT NOT NULL,
|
|
79
|
+
"userId" TEXT,
|
|
80
|
+
"type" TEXT NOT NULL,
|
|
81
|
+
"title" TEXT NOT NULL,
|
|
82
|
+
"body" TEXT,
|
|
83
|
+
"read" BOOLEAN NOT NULL DEFAULT false,
|
|
84
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
85
|
+
|
|
86
|
+
CONSTRAINT "Notification_pkey" PRIMARY KEY ("id")
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
-- AddForeignKey
|
|
90
|
+
ALTER TABLE "public"."Workflow" ADD CONSTRAINT "Workflow_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
91
|
+
|
|
92
|
+
-- AddForeignKey
|
|
93
|
+
ALTER TABLE "public"."Workflow" ADD CONSTRAINT "Workflow_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "public"."Workspace"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
94
|
+
|
|
95
|
+
-- AddForeignKey
|
|
96
|
+
ALTER TABLE "public"."WorkflowStep" ADD CONSTRAINT "WorkflowStep_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "public"."Workflow"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
97
|
+
|
|
98
|
+
-- AddForeignKey
|
|
99
|
+
ALTER TABLE "public"."WorkflowRun" ADD CONSTRAINT "WorkflowRun_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "public"."Workflow"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
100
|
+
|
|
101
|
+
-- AddForeignKey
|
|
102
|
+
ALTER TABLE "public"."WorkflowStepRun" ADD CONSTRAINT "WorkflowStepRun_workflowRunId_fkey" FOREIGN KEY ("workflowRunId") REFERENCES "public"."WorkflowRun"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
103
|
+
|
|
104
|
+
-- AddForeignKey
|
|
105
|
+
ALTER TABLE "public"."WorkflowStepRun" ADD CONSTRAINT "WorkflowStepRun_workflowStepId_fkey" FOREIGN KEY ("workflowStepId") REFERENCES "public"."WorkflowStep"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
106
|
+
|
|
107
|
+
-- AddForeignKey
|
|
108
|
+
ALTER TABLE "public"."Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "public"."integration_catalog" ADD COLUMN "category" TEXT,
|
|
3
|
+
ADD COLUMN "oauthType" TEXT,
|
|
4
|
+
ADD COLUMN "premium" BOOLEAN NOT NULL DEFAULT false,
|
|
5
|
+
ADD COLUMN "setupInstructions" JSONB;
|
|
6
|
+
|
|
7
|
+
-- CreateTable
|
|
8
|
+
CREATE TABLE "public"."Onboarding" (
|
|
9
|
+
"id" TEXT NOT NULL,
|
|
10
|
+
"userId" TEXT NOT NULL,
|
|
11
|
+
"persona" TEXT,
|
|
12
|
+
"setupType" TEXT,
|
|
13
|
+
"progress" JSONB,
|
|
14
|
+
"completed" BOOLEAN NOT NULL DEFAULT false,
|
|
15
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
16
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
17
|
+
|
|
18
|
+
CONSTRAINT "Onboarding_pkey" PRIMARY KEY ("id")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- CreateTable
|
|
22
|
+
CREATE TABLE "public"."WorkflowTemplate" (
|
|
23
|
+
"id" TEXT NOT NULL,
|
|
24
|
+
"name" TEXT NOT NULL,
|
|
25
|
+
"description" TEXT,
|
|
26
|
+
"category" TEXT,
|
|
27
|
+
"recommended" BOOLEAN NOT NULL DEFAULT false,
|
|
28
|
+
"iconUrl" TEXT,
|
|
29
|
+
"estimatedSetupTime" INTEGER,
|
|
30
|
+
"status" "public"."Status" NOT NULL DEFAULT 'active',
|
|
31
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
32
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
33
|
+
|
|
34
|
+
CONSTRAINT "WorkflowTemplate_pkey" PRIMARY KEY ("id")
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
-- CreateTable
|
|
38
|
+
CREATE TABLE "public"."WorkflowStepTemplate" (
|
|
39
|
+
"id" TEXT NOT NULL,
|
|
40
|
+
"templateId" TEXT NOT NULL,
|
|
41
|
+
"type" TEXT NOT NULL,
|
|
42
|
+
"config" JSONB NOT NULL,
|
|
43
|
+
"order" INTEGER NOT NULL,
|
|
44
|
+
"status" TEXT NOT NULL DEFAULT 'active',
|
|
45
|
+
|
|
46
|
+
CONSTRAINT "WorkflowStepTemplate_pkey" PRIMARY KEY ("id")
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
-- CreateTable
|
|
50
|
+
CREATE TABLE "public"."OnboardingPersona" (
|
|
51
|
+
"id" TEXT NOT NULL,
|
|
52
|
+
"key" TEXT NOT NULL,
|
|
53
|
+
"title" TEXT NOT NULL,
|
|
54
|
+
"description" TEXT,
|
|
55
|
+
"iconUrl" TEXT,
|
|
56
|
+
"recommended" BOOLEAN NOT NULL DEFAULT false,
|
|
57
|
+
"status" "public"."Status" NOT NULL DEFAULT 'active',
|
|
58
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
59
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
60
|
+
|
|
61
|
+
CONSTRAINT "OnboardingPersona_pkey" PRIMARY KEY ("id")
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
-- CreateIndex
|
|
65
|
+
CREATE UNIQUE INDEX "Onboarding_userId_key" ON "public"."Onboarding"("userId");
|
|
66
|
+
|
|
67
|
+
-- CreateIndex
|
|
68
|
+
CREATE UNIQUE INDEX "OnboardingPersona_key_key" ON "public"."OnboardingPersona"("key");
|
|
69
|
+
|
|
70
|
+
-- AddForeignKey
|
|
71
|
+
ALTER TABLE "public"."Onboarding" ADD CONSTRAINT "Onboarding_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
72
|
+
|
|
73
|
+
-- AddForeignKey
|
|
74
|
+
ALTER TABLE "public"."WorkflowStepTemplate" ADD CONSTRAINT "WorkflowStepTemplate_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "public"."WorkflowTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -43,57 +43,61 @@ model Workspace {
|
|
|
43
43
|
createdAt DateTime @default(now())
|
|
44
44
|
updatedAt DateTime @updatedAt
|
|
45
45
|
|
|
46
|
-
owner User
|
|
46
|
+
owner User @relation(fields: [ownerId], references: [id]) // defining side
|
|
47
47
|
integrations Integration[]
|
|
48
48
|
aiAgents AIAgent[]
|
|
49
|
+
Workflow Workflow[]
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
model User {
|
|
52
|
-
id
|
|
53
|
+
id String @id @default(uuid())
|
|
53
54
|
|
|
54
|
-
name
|
|
55
|
-
image
|
|
55
|
+
name String
|
|
56
|
+
image String?
|
|
56
57
|
|
|
57
|
-
email
|
|
58
|
+
email String @unique
|
|
58
59
|
|
|
59
|
-
password
|
|
60
|
+
password String?
|
|
60
61
|
|
|
61
|
-
emailVerified
|
|
62
|
+
emailVerified DateTime?
|
|
62
63
|
|
|
63
|
-
onboarding
|
|
64
|
+
onboarding DateTime?
|
|
64
65
|
|
|
65
|
-
role
|
|
66
|
+
role Role @default(user)
|
|
66
67
|
|
|
67
|
-
timezone
|
|
68
|
-
language
|
|
68
|
+
timezone String?
|
|
69
|
+
language String?
|
|
69
70
|
|
|
70
|
-
status
|
|
71
|
+
status Status @default(active)
|
|
71
72
|
|
|
72
73
|
lastLogin DateTime?
|
|
73
74
|
lastPasswordChange DateTime?
|
|
74
75
|
twoFactorEnabled Boolean @default(false)
|
|
75
76
|
twoFactorSecret String?
|
|
76
77
|
|
|
77
|
-
metadata
|
|
78
|
+
metadata Json?
|
|
78
79
|
|
|
79
|
-
plan
|
|
80
|
-
tokenBalance
|
|
81
|
-
creditsUsed
|
|
80
|
+
plan Plan @default(free)
|
|
81
|
+
tokenBalance Int @default(0)
|
|
82
|
+
creditsUsed Int @default(0)
|
|
82
83
|
|
|
83
|
-
accounts
|
|
84
|
-
integrations
|
|
85
|
-
tokenTransactions
|
|
86
|
-
auditLogs
|
|
87
|
-
subscriptions
|
|
84
|
+
accounts Account[]
|
|
85
|
+
integrations Integration[]
|
|
86
|
+
tokenTransactions TokenTransaction[]
|
|
87
|
+
auditLogs AuditLog[]
|
|
88
|
+
subscriptions Subscription[]
|
|
88
89
|
|
|
89
90
|
defaultWorkspaceId String?
|
|
90
91
|
|
|
91
92
|
// Inverse side of relation, no fields or references here!
|
|
92
93
|
defaultWorkspace Workspace? @relation()
|
|
93
94
|
|
|
94
|
-
createdAt
|
|
95
|
-
updatedAt
|
|
96
|
-
deletedAt
|
|
95
|
+
createdAt DateTime @default(now())
|
|
96
|
+
updatedAt DateTime @updatedAt
|
|
97
|
+
deletedAt DateTime?
|
|
98
|
+
Workflow Workflow[]
|
|
99
|
+
Notification Notification[]
|
|
100
|
+
Onboarding Onboarding?
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
/// OAuth or other third-party accounts linked to user
|
|
@@ -169,16 +173,20 @@ model Integration {
|
|
|
169
173
|
|
|
170
174
|
/// Master list of officially supported integrations/tools
|
|
171
175
|
model IntegrationCatalog {
|
|
172
|
-
id String
|
|
173
|
-
provider String
|
|
174
|
-
integration String
|
|
176
|
+
id String @id @default(uuid())
|
|
177
|
+
provider String // e.g. google, slack
|
|
178
|
+
integration String // e.g. gmail, drive, sheets
|
|
175
179
|
name String
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
category String? // e.g. "communication", "storage"
|
|
181
|
+
showDuringOnboarding Boolean @default(true)
|
|
182
|
+
default Boolean @default(false)
|
|
183
|
+
premium Boolean @default(false) // requires paid plan
|
|
178
184
|
iconUrl String?
|
|
179
185
|
description String?
|
|
180
186
|
docsUrl String?
|
|
181
|
-
|
|
187
|
+
oauthType String? // "oauth2", "api_key", "none"
|
|
188
|
+
setupInstructions Json? // flexible storage for config steps
|
|
189
|
+
status Status @default(active)
|
|
182
190
|
|
|
183
191
|
createdAt DateTime @default(now())
|
|
184
192
|
updatedAt DateTime @updatedAt
|
|
@@ -187,6 +195,7 @@ model IntegrationCatalog {
|
|
|
187
195
|
@@map("integration_catalog")
|
|
188
196
|
}
|
|
189
197
|
|
|
198
|
+
|
|
190
199
|
/// Log of sync activity for integrations
|
|
191
200
|
model IntegrationSyncLog {
|
|
192
201
|
id String @id @default(uuid())
|
|
@@ -257,8 +266,8 @@ model Subscription {
|
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
model WaitList {
|
|
260
|
-
id String
|
|
261
|
-
email String
|
|
269
|
+
id String @id @default(uuid())
|
|
270
|
+
email String @unique
|
|
262
271
|
name String?
|
|
263
272
|
company String?
|
|
264
273
|
role String?
|
|
@@ -266,9 +275,166 @@ model WaitList {
|
|
|
266
275
|
useCase String?
|
|
267
276
|
consentToUpdates Boolean
|
|
268
277
|
|
|
269
|
-
referralCode
|
|
270
|
-
referredBy
|
|
278
|
+
referralCode String? @unique // the code this user can share
|
|
279
|
+
referredBy String? // stores the referral code of the person who invited them
|
|
280
|
+
|
|
281
|
+
createdAt DateTime @default(now())
|
|
282
|
+
updatedAt DateTime @updatedAt
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/// Represents a queued job for async processing
|
|
286
|
+
model Job {
|
|
287
|
+
id String @id @default(uuid())
|
|
288
|
+
type String // e.g. "email", "workflow_step", "ai_generation"
|
|
289
|
+
status String @default("pending") // pending, processing, success, failed, canceled
|
|
290
|
+
payload Json // arbitrary job data
|
|
291
|
+
retries Int @default(0)
|
|
292
|
+
maxRetries Int @default(3)
|
|
293
|
+
error String?
|
|
294
|
+
scheduledAt DateTime? // optional delayed job
|
|
295
|
+
startedAt DateTime?
|
|
296
|
+
finishedAt DateTime?
|
|
297
|
+
|
|
298
|
+
createdAt DateTime @default(now())
|
|
299
|
+
updatedAt DateTime @updatedAt
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/// Represents a user-created workflow (automation, pipeline, etc.)
|
|
303
|
+
model Workflow {
|
|
304
|
+
id String @id @default(uuid())
|
|
305
|
+
name String
|
|
306
|
+
description String?
|
|
307
|
+
status String @default("active") // draft, active, paused, archived
|
|
308
|
+
userId String // owner
|
|
309
|
+
workspaceId String? // optional workspace context
|
|
310
|
+
|
|
311
|
+
user User @relation(fields: [userId], references: [id])
|
|
312
|
+
workspace Workspace? @relation(fields: [workspaceId], references: [id])
|
|
313
|
+
steps WorkflowStep[]
|
|
314
|
+
|
|
315
|
+
createdAt DateTime @default(now())
|
|
316
|
+
updatedAt DateTime @updatedAt
|
|
317
|
+
WorkflowRun WorkflowRun[]
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/// Individual step inside a workflow
|
|
321
|
+
model WorkflowStep {
|
|
322
|
+
id String @id @default(uuid())
|
|
323
|
+
workflowId String
|
|
324
|
+
type String // e.g. "ai_agent", "http_request", "email", "integration_action"
|
|
325
|
+
config Json // JSON definition of the step (inputs, outputs, etc.)
|
|
326
|
+
order Int
|
|
327
|
+
status String @default("active")
|
|
328
|
+
|
|
329
|
+
workflow Workflow @relation(fields: [workflowId], references: [id])
|
|
330
|
+
|
|
331
|
+
createdAt DateTime @default(now())
|
|
332
|
+
updatedAt DateTime @updatedAt
|
|
333
|
+
WorkflowStepRun WorkflowStepRun[]
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/// Execution of a workflow instance
|
|
337
|
+
model WorkflowRun {
|
|
338
|
+
id String @id @default(uuid())
|
|
339
|
+
workflowId String
|
|
340
|
+
status String @default("running") // running, success, failed, canceled
|
|
341
|
+
input Json?
|
|
342
|
+
output Json?
|
|
343
|
+
error String?
|
|
344
|
+
|
|
345
|
+
startedAt DateTime @default(now())
|
|
346
|
+
finishedAt DateTime?
|
|
347
|
+
|
|
348
|
+
workflow Workflow @relation(fields: [workflowId], references: [id])
|
|
349
|
+
steps WorkflowStepRun[]
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/// Execution log for a specific workflow step
|
|
353
|
+
model WorkflowStepRun {
|
|
354
|
+
id String @id @default(uuid())
|
|
355
|
+
workflowRunId String
|
|
356
|
+
workflowStepId String
|
|
357
|
+
status String @default("pending")
|
|
358
|
+
input Json?
|
|
359
|
+
output Json?
|
|
360
|
+
error String?
|
|
361
|
+
|
|
362
|
+
startedAt DateTime?
|
|
363
|
+
finishedAt DateTime?
|
|
364
|
+
|
|
365
|
+
workflowRun WorkflowRun @relation(fields: [workflowRunId], references: [id])
|
|
366
|
+
workflowStep WorkflowStep @relation(fields: [workflowStepId], references: [id])
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
model Notification {
|
|
370
|
+
id String @id @default(uuid())
|
|
371
|
+
userId String?
|
|
372
|
+
type String // e.g. "workflow_failed", "subscription_updated"
|
|
373
|
+
title String
|
|
374
|
+
body String?
|
|
375
|
+
read Boolean @default(false)
|
|
376
|
+
|
|
377
|
+
createdAt DateTime @default(now())
|
|
378
|
+
|
|
379
|
+
user User? @relation(fields: [userId], references: [id])
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/// Tracks user onboarding flow & preferences
|
|
383
|
+
model Onboarding {
|
|
384
|
+
id String @id @default(uuid())
|
|
385
|
+
userId String @unique
|
|
386
|
+
persona String? // startup_founder, freelancer, etc.
|
|
387
|
+
setupType String? // quick_start_template | build_from_scratch
|
|
388
|
+
progress Json? // flexible: store answers, intermediate selections
|
|
389
|
+
completed Boolean @default(false)
|
|
390
|
+
|
|
391
|
+
createdAt DateTime @default(now())
|
|
392
|
+
updatedAt DateTime @updatedAt
|
|
393
|
+
|
|
394
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
/// Predefined workflow templates shown during onboarding
|
|
399
|
+
model WorkflowTemplate {
|
|
400
|
+
id String @id @default(uuid())
|
|
401
|
+
name String
|
|
402
|
+
description String?
|
|
403
|
+
category String? // e.g. "content_creation", "sales", "marketing"
|
|
404
|
+
recommended Boolean @default(false)
|
|
405
|
+
iconUrl String?
|
|
406
|
+
estimatedSetupTime Int? // minutes
|
|
407
|
+
status Status @default(active)
|
|
408
|
+
|
|
409
|
+
createdAt DateTime @default(now())
|
|
410
|
+
updatedAt DateTime @updatedAt
|
|
411
|
+
|
|
412
|
+
steps WorkflowStepTemplate[]
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/// Template version of workflow steps
|
|
416
|
+
model WorkflowStepTemplate {
|
|
417
|
+
id String @id @default(uuid())
|
|
418
|
+
templateId String
|
|
419
|
+
type String // ai_agent, http_request, email, integration_action
|
|
420
|
+
config Json // inputs, defaults, etc.
|
|
421
|
+
order Int
|
|
422
|
+
status String @default("active")
|
|
423
|
+
|
|
424
|
+
template WorkflowTemplate @relation(fields: [templateId], references: [id])
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
/// Catalog of onboarding personas/roles
|
|
429
|
+
model OnboardingPersona {
|
|
430
|
+
id String @id @default(uuid())
|
|
431
|
+
key String @unique // e.g. "startup_founder"
|
|
432
|
+
title String
|
|
433
|
+
description String?
|
|
434
|
+
iconUrl String?
|
|
435
|
+
recommended Boolean @default(false)
|
|
436
|
+
status Status @default(active)
|
|
271
437
|
|
|
272
438
|
createdAt DateTime @default(now())
|
|
273
439
|
updatedAt DateTime @updatedAt
|
|
274
|
-
}
|
|
440
|
+
}
|