Class: BookSection
Defined in: Data/Models/Book/BookSection.ts:7
Book section entity from a book module database Represents a section in a book's table of contents with hierarchical structure
Constructors
Constructor
new BookSection(
data):BookSection
Defined in: Data/Models/Book/BookSection.ts:17
Parameters
data
content
string
contentFile?
string
metadata?
parentSectionId?
number
sectionId?
number
sectionNumber?
string
title
string
wordCount?
number
Returns
BookSection
Properties
content
content:
string
Defined in: Data/Models/Book/BookSection.ts:12
contentFile?
optionalcontentFile?:string
Defined in: Data/Models/Book/BookSection.ts:13
metadata?
optionalmetadata?:Metadata
Defined in: Data/Models/Book/BookSection.ts:15
parentSectionId?
optionalparentSectionId?:number
Defined in: Data/Models/Book/BookSection.ts:9
sectionId?
optionalsectionId?:number
Defined in: Data/Models/Book/BookSection.ts:8
sectionNumber?
optionalsectionNumber?:string
Defined in: Data/Models/Book/BookSection.ts:10
title
title:
string
Defined in: Data/Models/Book/BookSection.ts:11
wordCount?
optionalwordCount?:number
Defined in: Data/Models/Book/BookSection.ts:14
Methods
getDepth()
getDepth():
number
Defined in: Data/Models/Book/BookSection.ts:77
Get the depth level based on section number e.g., "1.2.3" has depth 3, "5" has depth 1
Returns
number
getExcerpt()
getExcerpt(
maxLength?):string
Defined in: Data/Models/Book/BookSection.ts:56
Get an excerpt of the content
Parameters
maxLength?
number = 200
Returns
string
getFullHeading()
getFullHeading():
string
Defined in: Data/Models/Book/BookSection.ts:66
Get the full section heading (section number + title)
Returns
string
hasChildren()
hasChildren():
boolean
Defined in: Data/Models/Book/BookSection.ts:48
Check if this section has child sections Note: This requires querying the database to determine
Returns
boolean
isTopLevel()
isTopLevel():
boolean
Defined in: Data/Models/Book/BookSection.ts:40
Check if this is a top-level section (no parent)
Returns
boolean