commit
75e03b42f7
99 files changed
+12285
No files matched your search
@@ -0,0 +1,185 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
username String @unique
|
||||
passwordHash String
|
||||
role String // "dm" | "player"
|
||||
createdAt DateTime @default(now())
|
||||
campaigns CampaignMember[]
|
||||
usedInvites InviteCode[] @relation("UsedInvites")
|
||||
}
|
||||
|
||||
model World {
|
||||
id Int @id @default(1)
|
||||
name String @default("My World")
|
||||
tagline String @default("")
|
||||
era String @default("")
|
||||
theme String @default("midnight")
|
||||
accent String @default("#d9b46a")
|
||||
showFog Boolean @default(true)
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Entry {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique
|
||||
kind String // location | npc | pc | faction | item | lore | session | beast | deity | rule | quest | culture
|
||||
title String
|
||||
subtitle String @default("")
|
||||
summary String @default("")
|
||||
body String @default("") // markdown-like, supports [[wikilinks]] and ::secret blocks
|
||||
fields String @default("{}") // JSON object {key:value}
|
||||
tags String @default("[]") // JSON array
|
||||
isPublic Boolean @default(false)
|
||||
// Bestiary-specific (JSON-encoded)
|
||||
stats String @default("{}") // JSON object
|
||||
abilities String @default("[]") // JSON array of {name,text}
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
outgoing Link[] @relation("from")
|
||||
incoming Link[] @relation("to")
|
||||
pin MapPin?
|
||||
beats SessionBeat[]
|
||||
timelineEvents TimelineEvent[]
|
||||
reveals EntryReveal[]
|
||||
}
|
||||
|
||||
model Link {
|
||||
id String @id @default(cuid())
|
||||
fromId String
|
||||
toId String
|
||||
from Entry @relation("from", fields: [fromId], references: [id], onDelete: Cascade)
|
||||
to Entry @relation("to", fields: [toId], references: [id], onDelete: Cascade)
|
||||
@@unique([fromId, toId])
|
||||
}
|
||||
|
||||
model TimelineEvent {
|
||||
id String @id @default(cuid())
|
||||
year Int
|
||||
era String @default("") // "Pre-Concord" / "Concord" etc.
|
||||
label String
|
||||
text String @default("")
|
||||
kind String @default("lore")
|
||||
entryId String?
|
||||
entry Entry? @relation(fields: [entryId], references: [id], onDelete: SetNull)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model MapPin {
|
||||
id String @id @default(cuid())
|
||||
x Float
|
||||
y Float
|
||||
label String
|
||||
kind String @default("location")
|
||||
entryId String? @unique
|
||||
entry Entry? @relation(fields: [entryId], references: [id], onDelete: SetNull)
|
||||
layerId String?
|
||||
layer MapLayer? @relation(fields: [layerId], references: [id], onDelete: SetNull)
|
||||
}
|
||||
|
||||
model MapLayer {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
imageData String @default("") // data: URL of an uploaded background, or "" for the procedural canvas
|
||||
width Int @default(1000)
|
||||
height Int @default(700)
|
||||
isDefault Boolean @default(false)
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
pins MapPin[]
|
||||
}
|
||||
|
||||
model Quest {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
meta String @default("")
|
||||
priority String @default("normal") // critical | normal
|
||||
status String @default("active") // active | completed
|
||||
isPublic Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model PartyMember {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
klass String @default("")
|
||||
hpCur Int @default(0)
|
||||
hpMax Int @default(0)
|
||||
color String @default("#d9b46a")
|
||||
order Int @default(0)
|
||||
}
|
||||
|
||||
model JournalEntry {
|
||||
id String @id @default(cuid())
|
||||
who String
|
||||
color String @default("#d9b46a")
|
||||
text String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model SessionBeat {
|
||||
id String @id @default(cuid())
|
||||
entryId String
|
||||
entry Entry @relation(fields: [entryId], references: [id], onDelete: Cascade)
|
||||
time String @default("")
|
||||
title String
|
||||
text String @default("")
|
||||
flag String @default("") // "" | rp | key | fight
|
||||
order Int @default(0)
|
||||
}
|
||||
|
||||
model Thread {
|
||||
id String @id @default(cuid())
|
||||
text String
|
||||
who String @default("")
|
||||
primary Boolean @default(false)
|
||||
resolved Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Campaign {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
members CampaignMember[]
|
||||
reveals EntryReveal[]
|
||||
invites InviteCode[]
|
||||
}
|
||||
|
||||
model CampaignMember {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
campaignId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
@@unique([userId, campaignId])
|
||||
}
|
||||
|
||||
model EntryReveal {
|
||||
id String @id @default(cuid())
|
||||
entryId String
|
||||
campaignId String
|
||||
entry Entry @relation(fields: [entryId], references: [id], onDelete: Cascade)
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
@@unique([entryId, campaignId])
|
||||
}
|
||||
|
||||
model InviteCode {
|
||||
id String @id @default(cuid())
|
||||
code String @unique @default(cuid())
|
||||
campaignId String?
|
||||
role String @default("player")
|
||||
usedById String?
|
||||
expiresAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
campaign Campaign? @relation(fields: [campaignId], references: [id], onDelete: SetNull)
|
||||
usedBy User? @relation("UsedInvites", fields: [usedById], references: [id], onDelete: SetNull)
|
||||
}
|
||||
Reference in new issue
Block a user