Spaces:
Running
Running
File size: 8,805 Bytes
60e766b 4d0f530 60e766b d438808 ae601ea d438808 60e766b d438808 ae601ea 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b d438808 60e766b ae601ea | 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
accounts Account[]
sessions Session[]
developerProfile DeveloperProfile?
ideas Idea[] @relation("IdeaCreatorUser")
taskClaims Task[] @relation("TaskClaimUser")
taskLinks TaskLink[] @relation("TaskLinkCreatorUser")
comments Comment[] @relation("CommentCreatorUser")
ideaVotes IdeaUserVote[]
ideaWorkVotes IdeaWorkVote[]
taskWorkVotes TaskWorkVote[]
solutions Solution[] @relation("SolutionCreatorUser")
approvedSolutions Solution[] @relation("SolutionApprovedByUser")
solutionVotes SolutionUserVote[]
solutionComments SolutionComment[] @relation("SolutionCommentUser")
ideaMerges IdeaMerge[]
}
model Account {
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([provider, providerAccountId])
}
model Session {
sessionToken String @id
userId String
expires DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@id([identifier, token])
}
model DeveloperProfile {
id String @id @default(cuid())
userId String @unique
displayName String
headline String?
bio String?
githubUrl String?
websiteUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model Idea {
id String @id @default(uuid())
createdAt DateTime @default(now())
createdByAnonId String?
createdByUserId String?
isAnonymous Boolean @default(true)
submitterVisibleName String?
rawInputText String
targetUsers String?
platform String?
constraints String?
title String
problemStatement String
tags String
features String
openQuestions String
upvotesCount Int @default(0)
commentsCount Int @default(0)
createdByUser User? @relation("IdeaCreatorUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
tasks Task[]
comments Comment[]
votes Vote[]
userVotes IdeaUserVote[]
workVotes IdeaWorkVote[]
solutions Solution[]
merges IdeaMerge[]
}
model Task {
id String @id @default(uuid())
createdAt DateTime @default(now())
ideaId String
title String
description String?
acceptance String
effort String?
status String @default("OPEN")
claimedByAnonId String?
claimedByUserId String?
claimedAt DateTime?
updatedAt DateTime @updatedAt
idea Idea @relation(fields: [ideaId], references: [id], onDelete: Cascade)
claimedByUser User? @relation("TaskClaimUser", fields: [claimedByUserId], references: [id], onDelete: SetNull)
links TaskLink[]
workVotes TaskWorkVote[]
solutions Solution[]
}
model TaskLink {
id String @id @default(uuid())
taskId String
url String
label String?
createdByAnonId String?
createdByUserId String?
createdAt DateTime @default(now())
task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
createdByUser User? @relation("TaskLinkCreatorUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
}
model Comment {
id String @id @default(uuid())
ideaId String
body String
createdByAnonId String?
createdByUserId String?
createdAt DateTime @default(now())
idea Idea @relation(fields: [ideaId], references: [id], onDelete: Cascade)
createdByUser User? @relation("CommentCreatorUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
}
model Vote {
ideaId String
anonId String
createdAt DateTime @default(now())
idea Idea @relation(fields: [ideaId], references: [id], onDelete: Cascade)
@@id([ideaId, anonId])
}
model IdeaUserVote {
ideaId String
userId String
createdAt DateTime @default(now())
idea Idea @relation(fields: [ideaId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([ideaId, userId])
}
model IdeaWorkVote {
ideaId String
userId String
createdAt DateTime @default(now())
idea Idea @relation(fields: [ideaId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([ideaId, userId])
}
model TaskWorkVote {
taskId String
userId String
createdAt DateTime @default(now())
task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([taskId, userId])
}
enum SolutionType {
APP_URL
GITHUB_REPO
OTHER
}
model Solution {
id String @id @default(uuid())
ideaId String
taskId String?
createdByUserId String
url String
label String?
description String?
type SolutionType @default(OTHER)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
approvedAt DateTime?
approvedBySubmitterAnonId String?
approvedBySubmitterUserId String?
idea Idea @relation(fields: [ideaId], references: [id], onDelete: Cascade)
task Task? @relation(fields: [taskId], references: [id], onDelete: SetNull)
createdByUser User @relation("SolutionCreatorUser", fields: [createdByUserId], references: [id], onDelete: Cascade)
approvedByUser User? @relation("SolutionApprovedByUser", fields: [approvedBySubmitterUserId], references: [id], onDelete: SetNull)
userVotes SolutionUserVote[]
anonVotes SolutionAnonVote[]
comments SolutionComment[]
}
model SolutionUserVote {
solutionId String
userId String
value Int
createdAt DateTime @default(now())
solution Solution @relation(fields: [solutionId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([solutionId, userId])
}
model SolutionAnonVote {
solutionId String
anonId String
value Int
createdAt DateTime @default(now())
solution Solution @relation(fields: [solutionId], references: [id], onDelete: Cascade)
@@id([solutionId, anonId])
}
model SolutionComment {
id String @id @default(uuid())
solutionId String
body String
createdByUserId String?
createdByAnonId String?
createdAt DateTime @default(now())
solution Solution @relation(fields: [solutionId], references: [id], onDelete: Cascade)
createdByUser User? @relation("SolutionCommentUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
}
model Nickname {
anonId String @id
nickname String
updatedAt DateTime @updatedAt
}
model SubmissionRateLimit {
id String @id @default(uuid())
anonId String
ipAddress String
windowStart String
count Int @default(0)
@@unique([anonId, ipAddress, windowStart])
}
model IdeaMerge {
id String @id @default(cuid())
targetIdeaId String
mergedByAnonId String?
mergedByUserId String?
rawInputText String
targetUsers String?
platform String?
constraints String?
reason String
similarityScore Float
createdAt DateTime @default(now())
targetIdea Idea @relation(fields: [targetIdeaId], references: [id], onDelete: Cascade)
mergedByUser User? @relation(fields: [mergedByUserId], references: [id], onDelete: SetNull)
@@index([targetIdeaId, createdAt])
}
|