added chapter view, fixes, added ratings, added chapter updates/deletions

This commit is contained in:
lnn0q 2025-06-01 00:37:26 +03:00
parent 029b7e9353
commit 4801cf3a13
34 changed files with 1345 additions and 191 deletions

View file

@ -19,6 +19,8 @@ model User {
refreshToken String? @unique @db.VarChar(255)
description String? @db.VarChar(500)
isDarkMode Boolean @default(true)
books Book[]
@ -46,8 +48,10 @@ model Book {
author User @relation(fields: [authorId], references: [id])
authorId String
wordsTotal Int @default(0)
chapters BookChapter[]
wordsTotal Int @default(0)
chaptersTotal Int @default(0)
chapters BookChapter[]
reviews Review[]
ratings Rating[]
@ -59,11 +63,14 @@ model BookChapter {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sequenceNumber Int @default(1)
sequenceNumber Int
title String @db.VarChar(255)
foreword String @db.MediumText
footnote String @db.MediumText
title String @db.VarChar(255)
foreword String? @db.MediumText
footnote String? @db.MediumText
content Json @db.Json
wordsTotal Int @default(0)
@ -72,6 +79,8 @@ model BookChapter {
reviews Review[]
ratings Rating[]
@@unique([bookId, sequenceNumber])
}
model Review {
@ -113,4 +122,7 @@ model Rating {
book Book? @relation(fields: [bookId], references: [id])
bookId String?
@@unique([userId, bookId])
@@unique([userId, bookChapterId])
}