added resolvers, updated model, updated navbar

This commit is contained in:
lnn0q 2025-05-17 21:41:07 +03:00
parent a8375b99c2
commit 1d40d7e15f
23 changed files with 439 additions and 301 deletions

View file

@ -21,37 +21,12 @@ model User {
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?
books Book[]
reviews Review[]
ratings Rating[]
}
enum WorkingType {
book
notepad
}
enum WorkingProgressStatus {
inProgress
frozen
@ -64,12 +39,18 @@ model Book {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
wordsTotal Int @default(0)
title String @db.VarChar(255)
description String @db.MediumText
progressStatus WorkingProgressStatus @default(inProgress)
working Working @relation(fields: [workingId], references: [id])
workingId String @unique @db.VarChar(255)
author User @relation(fields: [authorId], references: [id])
authorId String
chapters BookChapter[]
wordsTotal Int @default(0)
chapters BookChapter[]
reviews Review[]
ratings Rating[]
}
model BookChapter {
@ -82,6 +63,8 @@ model BookChapter {
foreword String @db.MediumText
footnote String @db.MediumText
wordsTotal Int @default(0)
book Book @relation(fields: [bookId], references: [id])
bookId String @db.VarChar(255)
@ -100,11 +83,11 @@ model Review {
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)
book Book? @relation(fields: [bookId], references: [id])
bookId String?
}
enum RatingType {
@ -123,9 +106,9 @@ model Rating {
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)
book Book? @relation(fields: [bookId], references: [id])
bookId String?
}