feat : Init Project
This commit is contained in:
233
nest-backend/prisma/schema.prisma
Normal file
233
nest-backend/prisma/schema.prisma
Normal file
@@ -0,0 +1,233 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
// ── Enums ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
enum UserRole {
|
||||
user
|
||||
dev
|
||||
com
|
||||
}
|
||||
|
||||
enum BugSeverity {
|
||||
low
|
||||
medium
|
||||
high
|
||||
critical
|
||||
}
|
||||
|
||||
enum BugStatus {
|
||||
open
|
||||
in_progress
|
||||
resolved
|
||||
closed
|
||||
}
|
||||
|
||||
enum EventType {
|
||||
announcement
|
||||
update
|
||||
milestone
|
||||
poll
|
||||
}
|
||||
|
||||
// ── Users ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
username String @unique
|
||||
email String @unique
|
||||
password String
|
||||
role UserRole @default(user)
|
||||
isAdmin Boolean @default(false)
|
||||
isBanned Boolean @default(false)
|
||||
avatarUrl String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
// Relations
|
||||
forumThreads ForumThread[]
|
||||
forumReplies ForumReply[]
|
||||
bugReports BugReport[] @relation("SubmittedBugs")
|
||||
assignedBugs BugReport[] @relation("AssignedBugs")
|
||||
bugComments BugComment[]
|
||||
bugNotes BugReportNote[]
|
||||
meTooBugs MeTooBug[]
|
||||
staffPosts StaffPost[]
|
||||
eventPosts EventPost[]
|
||||
pollVotes PollVote[]
|
||||
}
|
||||
|
||||
// ── Forum ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
model ForumCategory {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
description String
|
||||
icon String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
threads ForumThread[]
|
||||
}
|
||||
|
||||
model ForumThread {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
content String
|
||||
isPinned Boolean @default(false)
|
||||
isLocked Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
categoryId String
|
||||
category ForumCategory @relation(fields: [categoryId], references: [id])
|
||||
|
||||
replies ForumReply[]
|
||||
}
|
||||
|
||||
model ForumReply {
|
||||
id String @id @default(cuid())
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
threadId String
|
||||
thread ForumThread @relation(fields: [threadId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
// ── Bug Reports ────────────────────────────────────────────────────────────────
|
||||
|
||||
model BugReport {
|
||||
id String @id @default(cuid())
|
||||
uniqueCode String @unique
|
||||
title String
|
||||
description String
|
||||
stepsToReproduce String
|
||||
severity BugSeverity
|
||||
gameVersion String
|
||||
screenshotUrl String?
|
||||
status BugStatus @default(open)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
submittedById String
|
||||
submittedBy User @relation("SubmittedBugs", fields: [submittedById], references: [id])
|
||||
assignedToId String?
|
||||
assignedTo User? @relation("AssignedBugs", fields: [assignedToId], references: [id])
|
||||
|
||||
comments BugComment[]
|
||||
notes BugReportNote[]
|
||||
meTooBugs MeTooBug[]
|
||||
}
|
||||
|
||||
model BugComment {
|
||||
id String @id @default(cuid())
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
bugReportId String
|
||||
bugReport BugReport @relation(fields: [bugReportId], references: [id], onDelete: Cascade)
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
}
|
||||
|
||||
model BugReportNote {
|
||||
id String @id @default(cuid())
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
bugReportId String
|
||||
bugReport BugReport @relation(fields: [bugReportId], references: [id], onDelete: Cascade)
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
}
|
||||
|
||||
model MeTooBug {
|
||||
userId String
|
||||
bugReportId String
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
bugReport BugReport @relation(fields: [bugReportId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([userId, bugReportId])
|
||||
}
|
||||
|
||||
// ── Staff Feed ─────────────────────────────────────────────────────────────────
|
||||
|
||||
model StaffPost {
|
||||
id String @id @default(cuid())
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
}
|
||||
|
||||
// ── Events & Polls ─────────────────────────────────────────────────────────────
|
||||
|
||||
model EventPost {
|
||||
id String @id @default(cuid())
|
||||
type EventType
|
||||
title String
|
||||
content String
|
||||
isPublic Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
poll Poll?
|
||||
}
|
||||
|
||||
model Poll {
|
||||
id String @id @default(cuid())
|
||||
question String
|
||||
isActive Boolean @default(true)
|
||||
endsAt DateTime?
|
||||
allowMultipleVotes Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
eventId String @unique
|
||||
event EventPost @relation(fields: [eventId], references: [id], onDelete: Cascade)
|
||||
|
||||
options PollOption[]
|
||||
}
|
||||
|
||||
model PollOption {
|
||||
id String @id @default(cuid())
|
||||
text String
|
||||
|
||||
pollId String
|
||||
poll Poll @relation(fields: [pollId], references: [id], onDelete: Cascade)
|
||||
|
||||
votes PollVote[]
|
||||
}
|
||||
|
||||
model PollVote {
|
||||
userId String
|
||||
pollOptionId String
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
pollOption PollOption @relation(fields: [pollOptionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([userId, pollOptionId])
|
||||
}
|
||||
|
||||
// ── Team Members ───────────────────────────────────────────────────────────────
|
||||
|
||||
model TeamMember {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
role String
|
||||
bio String?
|
||||
avatarInitials String
|
||||
twitterHandle String?
|
||||
githubHandle String?
|
||||
}
|
||||
Reference in New Issue
Block a user