mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-16 12:24:56 +02:00
Start of new data model
This commit is contained in:
parent
2b7f53b0a7
commit
65793f7109
18 changed files with 672 additions and 8 deletions
45
server/objects/entities/Author.js
Normal file
45
server/objects/entities/Author.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
class Author {
|
||||
constructor(author) {
|
||||
this.id = null
|
||||
this.asin = null
|
||||
this.name = null
|
||||
this.imagePath = null
|
||||
this.imageFullPath = null
|
||||
this.addedAt = null
|
||||
this.updatedAt = null
|
||||
|
||||
if (author) {
|
||||
this.construct(author)
|
||||
}
|
||||
}
|
||||
|
||||
construct(author) {
|
||||
this.id = author.id
|
||||
this.asin = author.asin
|
||||
this.name = author.name
|
||||
this.imagePath = author.imagePath
|
||||
this.imageFullPath = author.imageFullPath
|
||||
this.addedAt = author.addedAt
|
||||
this.updatedAt = author.updatedAt
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
asin: this.asin,
|
||||
name: this.name,
|
||||
imagePath: this.imagePath,
|
||||
imageFullPath: this.imageFullPath,
|
||||
addedAt: this.addedAt,
|
||||
updatedAt: this.updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
toJSONMinimal() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.name
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = Author
|
Loading…
Add table
Add a link
Reference in a new issue