Spaces:
Runtime error
Runtime error
File size: 2,771 Bytes
c7fbc2e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
email String @unique
image String? // Profile picture from Facebook
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
instagramAccounts InstagramAccount[]
}
model InstagramAccount {
id String @id @default(uuid())
instagramUserId String @unique // The Instagram Business Account ID
username String?
profilePictureUrl String? // Instagram Profile Picture
accessToken String // Long-lived access token (encrypt in prod)
tokenExpiresAt DateTime?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
posts Post[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Post {
id String @id @default(uuid())
caption String?
mediaUrl String
coverUrl String? // For Video/Reel covers
mediaType String // IMAGE, VIDEO, CAROUSEL (SQLite treats enums as strings basically, keeping simple)
scheduledAt DateTime?
status String @default("DRAFT") // DRAFT, SCHEDULED, PUBLISHED, FAILED
instagramAccountId String
instagramAccount InstagramAccount @relation(fields: [instagramAccountId], references: [id], onDelete: Cascade)
instagramMediaId String? // ID returned by Instagram after publishing
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
automations Automation[]
}
model Automation {
id String @id @default(uuid())
isActive Boolean @default(false)
postId String
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
keywords AutomationKeyword[]
replies AutomationReply[]
triggerType String @default("COMMENTS") // For future scalability (e.g. DMs)
// DM Configuration
dmMessage String?
dmLinkUrl String?
dmLinkText String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model AutomationKeyword {
id String @id @default(uuid())
keyword String
automationId String
automation Automation @relation(fields: [automationId], references: [id], onDelete: Cascade)
}
model AutomationReply {
id String @id @default(uuid())
replyText String
automationId String
automation Automation @relation(fields: [automationId], references: [id], onDelete: Cascade)
}
|