feat: migrate Canvas and Groups API to Prisma ORM

This commit is contained in:
2026-04-26 14:37:12 +05:00
parent f9e35cb9e7
commit e040d8cacd
14 changed files with 183 additions and 223 deletions
+5 -40
View File
@@ -5,6 +5,7 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
@@ -44,49 +45,13 @@ model Canvas {
ownerId String
groupId String?
isPublic Boolean @default(false)
nodes Json @default("[]")
edges Json @default("[]")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
nodes CanvasNode[]
edges CanvasEdge[]
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
group Group? @relation(fields: [groupId], references: [id], onDelete: SetNull)
}
model CanvasNode {
id String @id
canvasId String
type String
x Float
y Float
width Float
height Float
text String?
file String?
state String?
label String?
assignedTo String?
alarm String?
scriptId String?
prompt String?
url String?
method String?
repo String?
branch String?
styleJson String?
canvas Canvas @relation(fields: [canvasId], references: [id], onDelete: Cascade)
}
model CanvasEdge {
id String @id
canvasId String
fromNode String
fromSide String
toNode String
toSide String
canvas Canvas @relation(fields: [canvasId], references: [id], onDelete: Cascade)
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
group Group? @relation(fields: [groupId], references: [id], onDelete: SetNull)
}
model Group {