|
|
|
// Refer to the Prisma schema docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Necessary for NextAuth.
|
|
|
|
model Account {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
type String
|
|
|
|
provider String
|
|
|
|
providerAccountId String
|
|
|
|
refresh_token String? @db.Text
|
|
|
|
access_token String? @db.Text
|
|
|
|
expires_at Int?
|
|
|
|
token_type String?
|
|
|
|
scope String?
|
|
|
|
id_token String? @db.Text
|
|
|
|
session_state String?
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
sessionToken String @unique
|
|
|
|
userId String
|
|
|
|
expires DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
name String?
|
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime?
|
|
|
|
image String?
|
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
|
|
|
todos Todo[]
|
|
|
|
resumesResumes ResumesResume[]
|
|
|
|
resumesStars ResumesStar[]
|
|
|
|
resumesComments ResumesComment[]
|
|
|
|
resumesCommentVotes ResumesCommentVote[]
|
|
|
|
questionsQuestions QuestionsQuestion[]
|
|
|
|
questionsQuestionEncounters QuestionsQuestionEncounter[]
|
|
|
|
questionsQuestionVotes QuestionsQuestionVote[]
|
|
|
|
questionsQuestionComments QuestionsQuestionComment[]
|
|
|
|
questionsQuestionCommentVotes QuestionsQuestionCommentVote[]
|
|
|
|
questionsAnswers QuestionsAnswer[]
|
|
|
|
questionsAnswerVotes QuestionsAnswerVote[]
|
|
|
|
questionsAnswerComments QuestionsAnswerComment[]
|
|
|
|
questionsAnswerCommentVotes QuestionsAnswerCommentVote[]
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Vote {
|
|
|
|
UPVOTE
|
|
|
|
DOWNVOTE
|
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationToken {
|
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
|
|
|
|
@@unique([identifier, token])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Todo {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
text String @db.Text
|
|
|
|
status TodoStatus @default(INCOMPLETE)
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
|
|
|
|
|
|
|
enum TodoStatus {
|
|
|
|
INCOMPLETE
|
|
|
|
COMPLETE
|
|
|
|
}
|
|
|
|
|
|
|
|
model Company {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
name String @db.Text
|
|
|
|
slug String @unique
|
|
|
|
description String? @db.Text
|
|
|
|
logoUrl String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start of Resumes project models.
|
|
|
|
// Add Resumes project models here, prefix all models with "Resumes",
|
|
|
|
// use camelCase for field names, and try to name them consistently
|
|
|
|
// across all models in this file.
|
|
|
|
model ResumesResume {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
title String @db.Text
|
|
|
|
// TODO: Update role, experience, location to use Enums
|
|
|
|
role String @db.Text
|
|
|
|
experience String @db.Text
|
|
|
|
location String @db.Text
|
|
|
|
url String
|
|
|
|
additionalInfo String? @db.Text
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
stars ResumesStar[]
|
|
|
|
comments ResumesComment[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model ResumesStar {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
resumeId String
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
resume ResumesResume @relation(fields: [resumeId], references: [id], onDelete: Cascade)
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([userId, resumeId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model ResumesComment {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
resumeId String
|
|
|
|
description String @db.Text
|
|
|
|
section ResumesSection
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
resume ResumesResume @relation(fields: [resumeId], references: [id], onDelete: Cascade)
|
|
|
|
votes ResumesCommentVote[]
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
|
|
|
|
|
|
|
enum ResumesSection {
|
|
|
|
GENERAL
|
|
|
|
EDUCATION
|
|
|
|
EXPERIENCE
|
|
|
|
PROJECTS
|
|
|
|
SKILLS
|
|
|
|
}
|
|
|
|
|
|
|
|
model ResumesCommentVote {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
commentId String
|
|
|
|
value Int
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
comment ResumesComment @relation(fields: [commentId], references: [id], onDelete: Cascade)
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([userId, commentId])
|
|
|
|
}
|
|
|
|
|
|
|
|
// End of Resumes project models.
|
|
|
|
|
|
|
|
// Start of Offers project models.
|
|
|
|
// Add Offers project models here, prefix all models with "Offer",
|
|
|
|
// use camelCase for field names, and try to name them consistently
|
|
|
|
// across all models in this file.
|
|
|
|
// End of Offers project models.
|
|
|
|
|
|
|
|
// Start of Questions project models.
|
|
|
|
// Add Questions project models here, prefix all models with "Questions",
|
|
|
|
// use camelCase for field names, and try to name them consistently
|
|
|
|
// across all models in this file.
|
|
|
|
|
|
|
|
enum QuestionsQuestionType {
|
|
|
|
CODING
|
|
|
|
SYSTEM_DESIGN
|
|
|
|
BEHAVIORAL
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsQuestion {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String?
|
|
|
|
content String @db.Text
|
|
|
|
questionType QuestionsQuestionType
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
encounters QuestionsQuestionEncounter[]
|
|
|
|
votes QuestionsQuestionVote[]
|
|
|
|
comments QuestionsQuestionComment[]
|
|
|
|
answers QuestionsAnswer[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsQuestionEncounter {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
questionId String
|
|
|
|
userId String?
|
|
|
|
// TODO: sync with models
|
|
|
|
company String @db.Text
|
|
|
|
location String @db.Text
|
|
|
|
role String @db.Text
|
|
|
|
seenAt DateTime
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsQuestionVote {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
questionId String
|
|
|
|
userId String?
|
|
|
|
vote Vote
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([questionId, userId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsQuestionComment {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
questionId String
|
|
|
|
userId String?
|
|
|
|
content String @db.Text
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
|
|
|
|
votes QuestionsQuestionCommentVote[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsQuestionCommentVote {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
questionCommentId String
|
|
|
|
userId String?
|
|
|
|
vote Vote
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
comment QuestionsQuestionComment @relation(fields: [questionCommentId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([questionCommentId, userId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsAnswer {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
questionId String
|
|
|
|
userId String?
|
|
|
|
content String @db.Text
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
|
|
|
|
votes QuestionsAnswerVote[]
|
|
|
|
comments QuestionsAnswerComment[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsAnswerVote {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
answerId String
|
|
|
|
userId String?
|
|
|
|
vote Vote
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
answer QuestionsAnswer @relation(fields: [answerId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([answerId, userId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsAnswerComment {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
answerId String
|
|
|
|
userId String?
|
|
|
|
content String @db.Text
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
answer QuestionsAnswer @relation(fields: [answerId], references: [id], onDelete: Cascade)
|
|
|
|
votes QuestionsAnswerCommentVote[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model QuestionsAnswerCommentVote {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
answerCommentId String
|
|
|
|
userId String?
|
|
|
|
vote Vote
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
comment QuestionsAnswerComment @relation(fields: [answerCommentId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([answerCommentId, userId])
|
|
|
|
}
|
|
|
|
|
|
|
|
// End of Questions project models.
|