Files
spsays-training/prisma/schema.prisma
T

399 lines
14 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
// ---------------------------------------------------------------------------
// Synonym — embedded document inside Verse
// ---------------------------------------------------------------------------
type Synonym {
word String
meanings String[]
}
// ---------------------------------------------------------------------------
// Verse — unified model for BG, SB, and CC verses
//
// book: "bg" | "sb" | "cc"
// division: null for BG, canto number string for SB ("1"-"10"),
// līlā key for CC ("adi", "madhya", "antya")
// chapter: chapter number
// verse: verse number (first verse number for multi-verse entries)
// verseEnd: last verse number for multi-verse entries (e.g. 18 for "16-18")
// reference: display reference string (e.g. "Bg 1.1", "SB 1.1.1", "Cc Ādi 1.1")
// ---------------------------------------------------------------------------
model Verse {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String // "bg" | "sb" | "cc"
division String? // null for BG; canto for SB; lila for CC
chapter Int
verse Int
verseEnd Int?
reference String
bookTitle String
devanagari String
bengali String? // only CC has Bengali
transliteration String
synonyms Synonym[]
translation String
purport String[]
@@unique([book, division, chapter, verse])
@@index([book])
@@index([book, division])
@@index([book, division, chapter])
@@map("verses")
}
// ---------------------------------------------------------------------------
// BookMeta — stores the intro.json data for each book
//
// The `data` field stores the entire intro JSON as a flexible JSON blob,
// since BG/SB/CC each have different structures (chapters vs cantos vs lilas).
// ---------------------------------------------------------------------------
model BookMeta {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String @unique // "bg" | "sb" | "cc"
data Json
@@map("book_meta")
}
// ---------------------------------------------------------------------------
// ProseChapter — for prose books like Kṛṣṇa Book (no verse structure)
//
// book: "kb"
// volume: volume number (1 or 2 for KB)
// chapter: chapter number within the volume
// title: chapter title
// type: "chapter" | "intro-segment"
// slug: URL-friendly identifier (e.g. "01", "preface", "words-from-apple")
// order: sort order (chapter number for chapters, custom for intro segments)
// paragraphs: array of HTML paragraph strings
// ---------------------------------------------------------------------------
model ProseChapter {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String // "kb"
volume Int
chapter Int? // null for intro segments
title String
type String // "chapter" | "intro-segment"
slug String
order Int
paragraphs String[]
@@unique([book, volume, slug])
@@index([book])
@@index([book, volume])
@@index([book, volume, type])
@@map("prose_chapters")
}
// ---------------------------------------------------------------------------
// Essay — standalone essays (not part of any book's chapter structure)
//
// slug: URL-friendly identifier (e.g. "krishna-reservoir-of-pleasure")
// title: essay title
// author: author name
// year: publication year
// group: optional grouping key (e.g. "two-essays" for essays published together)
// order: sort order within a group
// paragraphs: array of HTML paragraph strings
// ---------------------------------------------------------------------------
model Essay {
id String @id @default(auto()) @map("_id") @db.ObjectId
slug String @unique
title String
author String
year Int?
group String?
order Int
paragraphs String[]
@@index([group])
@@map("essays")
}
// ---------------------------------------------------------------------------
// OtherDocumentMeta — metadata for miscellaneous documents
//
// book: slug identifier (e.g. "analysis-bg", "real-peace-formula")
// data: JSON blob containing title, author, year, description, chapters list
// ---------------------------------------------------------------------------
model OtherDocumentMeta {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String @unique
data Json
@@map("other_document_meta")
}
// ---------------------------------------------------------------------------
// OtherDocumentChapter — chapters within other documents
//
// book: slug identifier matching OtherDocumentMeta.book
// chapter: chapter number
// title: chapter title
// type: "chapter"
// slug: URL-friendly identifier (chapter number as string)
// order: sort order
// paragraphs: array of HTML paragraph strings
// ---------------------------------------------------------------------------
model OtherDocumentChapter {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String
chapter Int
title String
type String
slug String
order Int
paragraphs String[]
@@unique([book, slug])
@@index([book])
@@map("other_document_chapters")
}
// ---------------------------------------------------------------------------
// JournalMeta — metadata for journals (Jaladuta Diary, The Beginning, etc.)
//
// book: slug identifier (e.g. "jaladuta-diary", "the-beginning")
// data: JSON blob containing title, author, year, description, chapters list
// ---------------------------------------------------------------------------
model JournalMeta {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String @unique
data Json
@@map("journal_meta")
}
// ---------------------------------------------------------------------------
// JournalChapter — chapters within journals
//
// book: slug identifier matching JournalMeta.book
// chapter: chapter number
// title: chapter title
// type: "chapter" | "preface" | "introduction"
// slug: URL-friendly identifier (chapter number as string)
// order: sort order
// paragraphs: array of HTML paragraph strings
// ---------------------------------------------------------------------------
model JournalChapter {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String
chapter Int
title String
type String
slug String
order Int
paragraphs String[]
@@unique([book, slug])
@@index([book])
@@map("journal_chapters")
}
// ---------------------------------------------------------------------------
// MagazineMeta — metadata for magazines (Back to Godhead, etc.)
//
// book: slug identifier (e.g. "btg")
// data: JSON blob containing title, author, description, volumes/issues list
// ---------------------------------------------------------------------------
model MagazineMeta {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String @unique
data Json
@@map("magazine_meta")
}
// ---------------------------------------------------------------------------
// MagazineIssue — individual issues within a magazine
//
// book: slug identifier matching MagazineMeta.book
// volume: volume number
// part: part/issue number within the volume
// title: display title (e.g. "Volume 3, Part 5, May 5, 1956")
// slug: URL-friendly identifier (e.g. "v3-p5")
// order: sort order
// paragraphs: array of HTML paragraph strings (all articles concatenated)
// ---------------------------------------------------------------------------
model MagazineIssue {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String
volume Int?
part Int
title String
slug String
order Int
paragraphs String[]
@@unique([book, slug])
@@index([book])
@@index([book, volume])
@@map("magazine_issues")
}
// ---------------------------------------------------------------------------
// GlossaryEntry — individual glossary term + definition
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Letter — individual letters written by Śrīla Prabhupāda
//
// slug: unique identifier (e.g. "47-07-12-mahatma-gandhi", "68-01-15-hayagriva")
// recipients: array of individual recipient names (split from comma-separated)
// recipientDisplay: original recipient string for display (e.g. "Mukunda, Janaki")
// date: date string as written (e.g. "12 July, 1947")
// dateRef: reference code (e.g. "47-07-12")
// year: extracted year number for filtering/grouping
// month: extracted month number (1-12) for filtering
// day: extracted day number for filtering
// location: city/place where the letter was written
// salutation: the "Dear..." line
// paragraphs: array of HTML paragraph strings (letter body)
// ---------------------------------------------------------------------------
model Letter {
id String @id @default(auto()) @map("_id") @db.ObjectId
slug String @unique
recipients String[]
recipientDisplay String
date String?
dateRef String?
year Int?
month Int?
day Int?
location String?
salutation String?
paragraphs String[]
@@index([year])
@@index([recipients])
@@index([location])
@@index([year, month])
@@map("letters")
}
model GlossaryEntry {
id String @id @default(auto()) @map("_id") @db.ObjectId
term String
definition String
definitionHtml String
@@unique([term])
@@map("glossary")
}
// ---------------------------------------------------------------------------
// Disciple — disciples initiated by Śrīla Prabhupāda
//
// initiatedName: spiritual name given at initiation (e.g. "Acyutananda")
// suffix: initiation suffix (e.g. "Dasa", "Devi Dasi", "Sw")
// initiationDate: date of initiation (set to 1st of the month when exact day unknown)
// initiationPlace: place of initiation (e.g. "New York", "London")
// karmiName: pre-initiation (birth) name, if known
// avatar: URL to profile photo, if available
// about: biographical notes
// tags: array of tags for categorization
// isVerified: whether the profile has been manually verified with exact dates etc.
// notes: internal notes (not shown in UI)
// verifiedBy: name/identifier of who verified this profile (not shown in UI)
// ---------------------------------------------------------------------------
model Disciple {
id String @id @default(auto()) @map("_id") @db.ObjectId
initiatedName String
suffix String
initiationDate DateTime?
initiationPlace String?
karmiName String?
avatar String?
about String?
tags String[]
isVerified Boolean @default(false)
notes String?
verifiedBy String?
@@index([initiatedName])
@@index([initiationPlace])
@@index([initiationDate])
@@index([suffix])
@@index([tags])
@@map("disciples")
}
// ---------------------------------------------------------------------------
// ContentBlock — embedded document for rich text content within transcriptions
//
// text: the actual text content (may contain inline HTML for bold/italic)
// format: formatting hint — "paragraph" | "heading" | "quote" | "verse" | "note"
// alignment: text alignment — "left" | "center" | "right" (default: left)
// speaker: who is speaking this block (for dialogues — e.g., "Prabhupāda", "Devotee")
// ---------------------------------------------------------------------------
type ContentBlock {
text String
format String @default("paragraph")
alignment String @default("left")
speaker String?
}
// ---------------------------------------------------------------------------
// Transcription — lectures and conversations of Śrīla Prabhupāda
//
// slug: URL-friendly unique identifier (e.g., "720911-lecture-los-angeles")
// name: display title (e.g., "Lecture on Bhagavad-gītā 2.13")
// type: "lecture" | "conversation"
// date: date of the transcription
// year: extracted year for filtering/grouping
// month: extracted month (1-12) for filtering
// day: extracted day for filtering
// place: location where it was delivered (e.g., "Los Angeles", "Vṛndāvana")
// context: additional context (e.g., "Morning Walk", "Room Conversation", "Arrival Address")
// reference: scripture reference if applicable (e.g., "BG 2.13", "SB 1.2.6")
// summary: brief description of the content (for OG images, search results)
// content: array of ContentBlock embedded documents (the actual transcription)
// tags: array of tags for categorization (e.g., ["science", "reincarnation", "guru"])
// participants: array of named participants (e.g., ["Prabhupāda", "Bob Cohen", "Śyāmasundara"])
// language: primary language of the transcription (default: "en")
// source: origin of the transcription (e.g., "Vedabase", "BBT Archives")
// durationMinutes: approximate duration in minutes (if known)
// isPublished: whether the transcription is ready for public display
// notes: internal editorial notes (not shown in UI)
// ---------------------------------------------------------------------------
model Transcription {
id String @id @default(auto()) @map("_id") @db.ObjectId
slug String @unique
name String
type String // "lecture" | "conversation"
date String? // date as written (e.g., "September 11, 1972")
year Int?
month Int?
day Int?
place String?
context String?
reference String?
summary String?
content ContentBlock[]
tags String[]
participants String[]
language String @default("en")
source String?
durationMinutes Int?
audioUrl String?
isPublished Boolean @default(false)
notes String?
@@index([type])
@@index([year])
@@index([year, month])
@@index([place])
@@index([tags])
@@index([reference])
@@index([participants])
@@index([isPublished])
@@map("transcriptions")
}