mirror of
https://github.com/aljazceru/landscape-template.git
synced 2025-12-30 12:34:19 +01:00
362 lines
8.1 KiB
Plaintext
362 lines
8.1 KiB
Plaintext
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
// -----------------
|
|
// Shared
|
|
// -----------------
|
|
|
|
model Tag {
|
|
id Int @id @default(autoincrement())
|
|
title String @unique
|
|
icon String?
|
|
description String?
|
|
isOfficial Boolean @default(false)
|
|
|
|
project Project[]
|
|
stories Story[]
|
|
questions Question[]
|
|
hackathons Hackathon[]
|
|
}
|
|
|
|
model Vote {
|
|
id Int @id @default(autoincrement())
|
|
item_id Int
|
|
item_type String
|
|
amount_in_sat Int
|
|
payment_request String?
|
|
payment_hash String?
|
|
preimage String?
|
|
paid Boolean @default(false)
|
|
}
|
|
|
|
// -----------------
|
|
// Users
|
|
// -----------------
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
pubKey String? @unique
|
|
name String?
|
|
avatar String?
|
|
role String @default("user")
|
|
|
|
email String?
|
|
jobTitle String?
|
|
lightning_address String?
|
|
website String?
|
|
twitter String?
|
|
github String?
|
|
linkedin String?
|
|
bio String?
|
|
location String?
|
|
nostr_prv_key String?
|
|
nostr_pub_key String?
|
|
|
|
join_date DateTime @default(now())
|
|
|
|
stories Story[]
|
|
questions Question[]
|
|
posts_comments PostComment[]
|
|
donations Donation[]
|
|
userKeys UserKey[]
|
|
skills Skill[]
|
|
roles UsersOnWorkRoles[]
|
|
|
|
tournaments TournamentParticipant[]
|
|
}
|
|
|
|
model UserKey {
|
|
key String @id
|
|
name String @default("My new wallet key")
|
|
|
|
user User? @relation(fields: [user_id], references: [id])
|
|
user_id Int?
|
|
}
|
|
|
|
model UsersOnWorkRoles {
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
role WorkRole @relation(fields: [roleId], references: [id])
|
|
roleId Int
|
|
|
|
level Int
|
|
|
|
@@id([userId, roleId])
|
|
}
|
|
|
|
model WorkRole {
|
|
id Int @id @default(autoincrement())
|
|
title String @unique
|
|
icon String
|
|
users UsersOnWorkRoles[]
|
|
projects ProjectRecruitRoles[]
|
|
}
|
|
|
|
model Skill {
|
|
id Int @id @default(autoincrement())
|
|
title String @unique
|
|
|
|
users User[]
|
|
}
|
|
|
|
// -----------------
|
|
// Projects
|
|
// -----------------
|
|
|
|
model Category {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
cover_image String?
|
|
icon String?
|
|
|
|
project Project[]
|
|
}
|
|
|
|
model Project {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
description String
|
|
screenshots String[]
|
|
website String
|
|
thumbnail_image String?
|
|
cover_image String?
|
|
lightning_address String?
|
|
lnurl_callback_url String?
|
|
|
|
category Category @relation(fields: [category_id], references: [id])
|
|
category_id Int
|
|
votes_count Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
|
|
awards Award[]
|
|
tags Tag[]
|
|
|
|
recruit_roles ProjectRecruitRoles[]
|
|
tournaments TournamentProject[]
|
|
}
|
|
|
|
model ProjectRecruitRoles {
|
|
project Project @relation(fields: [projectId], references: [id])
|
|
projectId Int
|
|
role WorkRole @relation(fields: [roleId], references: [id])
|
|
roleId Int
|
|
|
|
level Int
|
|
|
|
@@id([projectId, roleId])
|
|
}
|
|
|
|
model Award {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
image String
|
|
url String
|
|
|
|
project Project @relation(fields: [project_id], references: [id])
|
|
project_id Int
|
|
}
|
|
|
|
// -----------------
|
|
// Posts
|
|
// -----------------
|
|
|
|
model Story {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
body String
|
|
excerpt String
|
|
cover_image String?
|
|
votes_count Int @default(0)
|
|
is_published Boolean @default(true)
|
|
|
|
tags Tag[]
|
|
|
|
user User? @relation(fields: [user_id], references: [id])
|
|
user_id Int?
|
|
|
|
comments PostComment[] @relation("StoryComment")
|
|
}
|
|
|
|
model Question {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
body String
|
|
excerpt String
|
|
votes_count Int @default(0)
|
|
is_published Boolean @default(true)
|
|
|
|
tags Tag[]
|
|
|
|
user User? @relation(fields: [user_id], references: [id])
|
|
user_id Int?
|
|
|
|
comments PostComment[] @relation("QuestionComment")
|
|
}
|
|
|
|
model PostComment {
|
|
id Int @id @default(autoincrement())
|
|
nostr_id String?
|
|
body String
|
|
created_at DateTime @default(now())
|
|
votes_count Int @default(0)
|
|
|
|
replies PostComment[] @relation("PostComment_Replies")
|
|
parent_comment_id Int?
|
|
parent_comment PostComment? @relation("PostComment_Replies", fields: [parent_comment_id], references: [id])
|
|
|
|
user User? @relation(fields: [user_id], references: [id])
|
|
user_id Int?
|
|
|
|
story Story? @relation("StoryComment", fields: [story_id], references: [id])
|
|
story_id Int?
|
|
|
|
question Question? @relation("QuestionComment", fields: [question_id], references: [id])
|
|
question_id Int?
|
|
}
|
|
|
|
// -----------------
|
|
// Hackathons
|
|
// -----------------
|
|
model Hackathon {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
start_date DateTime @db.Date
|
|
end_date DateTime @db.Date
|
|
cover_image String
|
|
description String
|
|
location String
|
|
website String
|
|
votes_count Int @default(0)
|
|
|
|
tags Tag[]
|
|
}
|
|
|
|
// -----------------
|
|
// Donations
|
|
// -----------------
|
|
model Donation {
|
|
id Int @id @default(autoincrement())
|
|
amount Int
|
|
createdAt DateTime @default(now()) @db.Date
|
|
payment_request String?
|
|
payment_hash String?
|
|
preimage String?
|
|
paid Boolean @default(false)
|
|
|
|
donor User? @relation(fields: [donor_id], references: [id])
|
|
donor_id Int?
|
|
}
|
|
|
|
// -----------------
|
|
// Auth
|
|
// -----------------
|
|
model GeneratedK1 {
|
|
value String @id
|
|
sid String?
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
// -----------------
|
|
// Hosted Image
|
|
// -----------------
|
|
model HostedImage {
|
|
id String @id
|
|
filename String
|
|
createdAt DateTime @default(now())
|
|
is_used Boolean @default(false)
|
|
}
|
|
|
|
// -----------------
|
|
// Tournament
|
|
// -----------------
|
|
model Tournament {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
description String
|
|
thumbnail_image String
|
|
cover_image String
|
|
start_date DateTime @db.Date
|
|
end_date DateTime @db.Date
|
|
location String
|
|
website String
|
|
votes_count Int @default(0)
|
|
|
|
prizes TournamentPrize[]
|
|
judges TournamentJudge[]
|
|
faqs TournamentFAQ[]
|
|
events TournamentEvent[]
|
|
participants TournamentParticipant[]
|
|
projects TournamentProject[]
|
|
}
|
|
|
|
model TournamentPrize {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
amount String
|
|
image String
|
|
|
|
tournament Tournament @relation(fields: [tournament_id], references: [id])
|
|
tournament_id Int
|
|
}
|
|
|
|
model TournamentJudge {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
company String
|
|
twitter String?
|
|
|
|
tournament Tournament @relation(fields: [tournament_id], references: [id])
|
|
tournament_id Int
|
|
}
|
|
|
|
model TournamentFAQ {
|
|
id Int @id @default(autoincrement())
|
|
question String
|
|
answer String
|
|
|
|
tournament Tournament @relation(fields: [tournament_id], references: [id])
|
|
tournament_id Int
|
|
}
|
|
|
|
model TournamentEvent {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
image String
|
|
description String
|
|
date DateTime @db.Date
|
|
location String
|
|
website String
|
|
type Int
|
|
|
|
tournament Tournament @relation(fields: [tournament_id], references: [id])
|
|
tournament_id Int
|
|
}
|
|
|
|
model TournamentParticipant {
|
|
tournament Tournament @relation(fields: [tournament_id], references: [id])
|
|
tournament_id Int
|
|
user User @relation(fields: [user_id], references: [id])
|
|
user_id Int
|
|
|
|
@@id([tournament_id, user_id])
|
|
}
|
|
|
|
model TournamentProject {
|
|
tournament Tournament @relation(fields: [tournament_id], references: [id])
|
|
tournament_id Int
|
|
project Project @relation(fields: [project_id], references: [id])
|
|
project_id Int
|
|
|
|
@@id([tournament_id, project_id])
|
|
}
|