Add Graph draft
This commit is contained in:
@ -1,25 +1,47 @@
|
||||
import { Typebot as TypebotFromPrisma } from 'db'
|
||||
|
||||
export type Typebot = TypebotFromPrisma & { blocks: Block[] }
|
||||
export type Typebot = TypebotFromPrisma & {
|
||||
blocks: Block[]
|
||||
startBlock: StartBlock
|
||||
}
|
||||
|
||||
export type StartBlock = {
|
||||
id: `start-block`
|
||||
graphCoordinates: {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
title: string
|
||||
steps: [StartStep]
|
||||
}
|
||||
|
||||
export type StartStep = {
|
||||
id: 'start-step'
|
||||
blockId: 'start-block'
|
||||
target?: Target
|
||||
type: StepType.START
|
||||
label: string
|
||||
}
|
||||
|
||||
export type Block = {
|
||||
id: string
|
||||
title: string
|
||||
steps: Step[]
|
||||
boardCoordinates: {
|
||||
graphCoordinates: {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
}
|
||||
|
||||
export enum StepType {
|
||||
START = 'start',
|
||||
TEXT = 'text',
|
||||
IMAGE = 'image',
|
||||
BUTTONS = 'buttons',
|
||||
DATE_PICKER = 'date picker',
|
||||
}
|
||||
|
||||
type Target = { blockId: string; stepId?: string }
|
||||
export type Target = { blockId: string; stepId?: string }
|
||||
|
||||
export type Step = { id: string; blockId: string; target?: Target } & (
|
||||
| TextStep
|
||||
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `startBlock` to the `PublicTypebot` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `startBlock` to the `Typebot` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "PublicTypebot" ADD COLUMN "blocks" JSONB[],
|
||||
ADD COLUMN "startBlock" JSONB NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Typebot" ADD COLUMN "blocks" JSONB[],
|
||||
ADD COLUMN "startBlock" JSONB NOT NULL;
|
@ -87,16 +87,18 @@ model Typebot {
|
||||
results Result[]
|
||||
folderId String?
|
||||
folder DashboardFolder? @relation(fields: [folderId], references: [id])
|
||||
blocks Json[]
|
||||
blocks Json[]
|
||||
startBlock Json
|
||||
}
|
||||
|
||||
model PublicTypebot {
|
||||
id String @id @default(cuid())
|
||||
typebotId String @unique
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
steps Json[]
|
||||
name String
|
||||
blocks Json[]
|
||||
id String @id @default(cuid())
|
||||
typebotId String @unique
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
steps Json[]
|
||||
name String
|
||||
blocks Json[]
|
||||
startBlock Json
|
||||
}
|
||||
|
||||
model Result {
|
||||
|
Reference in New Issue
Block a user