Spaces:
Paused
Paused
File size: 4,209 Bytes
eda9b8d 08caca4 eda9b8d 1667ecb 3d52d95 eda9b8d 7853dfb eda9b8d 0ccfbbc 80917de eda9b8d 3d52d95 5134e36 7853dfb 5134e36 80917de 5134e36 | 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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
model User {
id String @id @default(uuid())
name String
email String @unique
hashedPassword String?
role String @default("CLIENT") // ADMIN | CLIENT
createdAt DateTime @default(now())
teamMemberships TeamMember[]
sentMessages ChatMessage[]
}
model Workspace {
id String @id @default(uuid())
domain String @unique
websiteName String
description String
niche String?
country String?
language String?
monthlyTraffic Int?
createdAt DateTime @default(now())
teamMembers TeamMember[]
giverThreads ExchangeThread[] @relation("GiverWorkspace")
receiverThreads ExchangeThread[] @relation("ReceiverWorkspace")
giverLinkPlacements LinkPlacement[] @relation("GiverLinkPlacements")
receiverLinkPlacements LinkPlacement[] @relation("ReceiverLinkPlacements")
notifications Notification[]
}
model TeamMember {
id String @id @default(uuid())
userId String
workspaceId String
role String // OWNER | EDITOR | VIEWER
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
@@unique([userId, workspaceId])
}
model ExchangeThread {
id String @id @default(uuid())
giverWorkspaceId String
receiverWorkspaceId String
stage String @default("NEW") // NEW | CHAT | PLACED
status String @default("PENDING") // PENDING | ACCEPTED | REJECTED
giverAccepted Boolean @default(false)
receiverAccepted Boolean @default(false)
rejectedByWorkspaceId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
giverWorkspace Workspace @relation("GiverWorkspace", fields: [giverWorkspaceId], references: [id])
receiverWorkspace Workspace @relation("ReceiverWorkspace", fields: [receiverWorkspaceId], references: [id])
messages ChatMessage[]
linkPlacement LinkPlacement?
}
model ChatMessage {
id String @id @default(uuid())
threadId String
senderUserId String
messageText String
timestamp DateTime @default(now())
thread ExchangeThread @relation(fields: [threadId], references: [id], onDelete: Cascade)
sender User @relation(fields: [senderUserId], references: [id])
}
model LinkPlacement {
id String @id @default(uuid())
threadId String? @unique
giverWorkspaceId String
receiverWorkspaceId String
sourceUrl String
targetUrl String
anchorText String
linkType String // GUEST_POST | NICHE_EDIT | IMAGE | OTHER
status String @default("LIVE") // LIVE | REMOVED | DEPARTED
datePlaced DateTime @default(now())
thread ExchangeThread? @relation(fields: [threadId], references: [id])
giverWorkspace Workspace @relation("GiverLinkPlacements", fields: [giverWorkspaceId], references: [id])
receiverWorkspace Workspace @relation("ReceiverLinkPlacements", fields: [receiverWorkspaceId], references: [id])
}
model AdminNotification {
id String @id @default(uuid())
title String
description String
createdAt DateTime @default(now())
}
model Notification {
id String @id @default(uuid())
workspaceId String
type String
title String?
body String?
link String?
read Boolean @default(false)
createdAt DateTime @default(now())
payload String?
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
}
model SystemSettings {
id String @id @default("singleton")
cronExpression String @default("*/10 * * * *")
matchAmount Int @default(2)
rejectLimit Int @default(5)
updatedAt DateTime @updatedAt
}
|