2024-01-26 18:38:41 -08:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
2024-03-02 18:08:14 -08:00
|
|
|
generator dbml {
|
|
|
|
provider = "prisma-dbml-generator"
|
|
|
|
}
|
|
|
|
|
2024-01-26 18:38:41 -08:00
|
|
|
datasource db {
|
2024-03-11 19:52:51 -07:00
|
|
|
provider = "postgresql"
|
2024-01-26 18:38:41 -08:00
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
2024-05-30 15:34:03 -07:00
|
|
|
model Setting {
|
|
|
|
key String @id
|
|
|
|
value String // this value will be parsed with JSON.parse
|
|
|
|
}
|
|
|
|
|
2024-01-26 18:38:41 -08:00
|
|
|
model User {
|
2024-05-31 13:01:39 -07:00
|
|
|
sub String @id
|
|
|
|
display_name String?
|
|
|
|
picture_url String?
|
|
|
|
profile_url String?
|
|
|
|
|
2024-04-27 21:44:04 -07:00
|
|
|
lastPixelTime DateTime @default(now()) // the time the last pixel was placed at
|
|
|
|
pixelStack Int @default(0) // amount of pixels stacked for this user
|
|
|
|
undoExpires DateTime? // when the undo for the most recent pixel expires at
|
2024-01-26 18:38:41 -08:00
|
|
|
|
2024-05-28 19:34:59 -07:00
|
|
|
isAdmin Boolean @default(false)
|
|
|
|
isModerator Boolean @default(false)
|
|
|
|
|
2024-03-02 18:08:14 -08:00
|
|
|
pixels Pixel[]
|
|
|
|
FactionMember FactionMember[]
|
2024-01-26 18:38:41 -08:00
|
|
|
}
|
|
|
|
|
2024-05-31 13:01:39 -07:00
|
|
|
model Instance {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
hostname String @unique
|
|
|
|
name String?
|
|
|
|
logo_url String?
|
|
|
|
banner_url String?
|
|
|
|
}
|
|
|
|
|
2024-03-11 19:52:51 -07:00
|
|
|
model PaletteColor {
|
2024-01-26 18:38:41 -08:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
hex String @unique
|
|
|
|
|
|
|
|
pixels Pixel[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Pixel {
|
2024-06-26 17:38:46 -07:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
userId String
|
|
|
|
x Int
|
|
|
|
y Int
|
|
|
|
color String
|
|
|
|
isTop Boolean @default(false)
|
|
|
|
isModAction Boolean @default(false)
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
deletedAt DateTime?
|
2024-01-26 18:38:41 -08:00
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [sub])
|
2024-03-11 19:52:51 -07:00
|
|
|
pallete PaletteColor @relation(fields: [color], references: [hex])
|
2024-01-26 18:38:41 -08:00
|
|
|
}
|
2024-03-02 18:08:14 -08:00
|
|
|
|
|
|
|
model Faction {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
name String
|
|
|
|
image String?
|
|
|
|
|
|
|
|
FactionMember FactionMember[]
|
|
|
|
FactionRole FactionRole[]
|
|
|
|
FactionSocial FactionSocial[]
|
|
|
|
FactionSetting FactionSetting[]
|
|
|
|
}
|
|
|
|
|
|
|
|
// people can be apart of multiple factions at once
|
|
|
|
model FactionMember {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
sub String
|
|
|
|
factionId String
|
|
|
|
|
|
|
|
user User @relation(fields: [sub], references: [sub])
|
|
|
|
faction Faction @relation(fields: [factionId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
// future proofing maybe: different roles for the same faction
|
|
|
|
// factions by default should have LEADER, MODERATOR, MEMBER
|
|
|
|
model FactionRole {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
name String
|
|
|
|
level Int // permission level (similar to matrix [0 = member, 100 = leader])
|
|
|
|
factionId String
|
|
|
|
|
|
|
|
faction Faction @relation(fields: [factionId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model FactionSocial {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
factionId String
|
|
|
|
title String? // display name for the link
|
|
|
|
url String // [!] rel=nofollow [!]
|
|
|
|
position Int
|
|
|
|
|
|
|
|
faction Faction @relation(fields: [factionId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model FactionSetting {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
factionId String
|
|
|
|
key String
|
|
|
|
value String
|
|
|
|
|
|
|
|
definition FactionSettingDefinition @relation(fields: [key], references: [id])
|
|
|
|
faction Faction @relation(fields: [factionId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
// global definition for the faction setting
|
|
|
|
model FactionSettingDefinition {
|
|
|
|
id String @id
|
|
|
|
name String
|
|
|
|
type String // enum of type of setting (eg. text, checkbox)
|
|
|
|
minimumLevel Int // what level is needed to modify this setting (>=)
|
|
|
|
FactionSetting FactionSetting[]
|
|
|
|
}
|