added mappers, updated models
This commit is contained in:
parent
6ada519e06
commit
a8375b99c2
11 changed files with 306 additions and 120 deletions
|
|
@ -20,4 +20,112 @@ model User {
|
|||
refreshToken String? @unique @db.VarChar(255)
|
||||
|
||||
isDarkMode Boolean @default(true)
|
||||
|
||||
workings Working[]
|
||||
reviews Review[]
|
||||
ratings Rating[]
|
||||
}
|
||||
|
||||
model Working {
|
||||
id String @id
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
title String @db.VarChar(255)
|
||||
description String @db.MediumText
|
||||
progressStatus WorkingProgressStatus @default(inProgress)
|
||||
|
||||
type WorkingType
|
||||
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
authorId String
|
||||
|
||||
book Book?
|
||||
|
||||
reviews Review[]
|
||||
ratings Rating[]
|
||||
}
|
||||
|
||||
enum WorkingType {
|
||||
book
|
||||
notepad
|
||||
}
|
||||
|
||||
enum WorkingProgressStatus {
|
||||
inProgress
|
||||
frozen
|
||||
complete
|
||||
}
|
||||
|
||||
model Book {
|
||||
id String @id
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
wordsTotal Int @default(0)
|
||||
|
||||
working Working @relation(fields: [workingId], references: [id])
|
||||
workingId String @unique @db.VarChar(255)
|
||||
|
||||
chapters BookChapter[]
|
||||
}
|
||||
|
||||
model BookChapter {
|
||||
id String @id
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
title String @db.VarChar(255)
|
||||
foreword String @db.MediumText
|
||||
footnote String @db.MediumText
|
||||
|
||||
book Book @relation(fields: [bookId], references: [id])
|
||||
bookId String @db.VarChar(255)
|
||||
|
||||
reviews Review[]
|
||||
ratings Rating[]
|
||||
}
|
||||
|
||||
model Review {
|
||||
id String @id
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
text String @db.MediumText
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String @db.VarChar(255)
|
||||
|
||||
working Working? @relation(fields: [workingId], references: [id])
|
||||
workingId String? @db.VarChar(255)
|
||||
|
||||
bookChapter BookChapter? @relation(fields: [bookChapterId], references: [id])
|
||||
bookChapterId String? @db.VarChar(255)
|
||||
}
|
||||
|
||||
enum RatingType {
|
||||
up
|
||||
down
|
||||
}
|
||||
|
||||
model Rating {
|
||||
id String @id
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
type RatingType
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String @db.VarChar(255)
|
||||
|
||||
working Working? @relation(fields: [workingId], references: [id])
|
||||
workingId String? @db.VarChar(255)
|
||||
|
||||
bookChapter BookChapter? @relation(fields: [bookChapterId], references: [id])
|
||||
bookChapterId String? @db.VarChar(255)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue