mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-10 09: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
34
server/objects/files/EBookFile.js
Normal file
34
server/objects/files/EBookFile.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const FileMetadata = require('../metadata/FileMetadata')
|
||||
|
||||
class EBookFile {
|
||||
constructor(file) {
|
||||
this.ino = null
|
||||
this.metadata = null
|
||||
this.ebookFormat = null
|
||||
this.addedAt = null
|
||||
this.lastUpdate = null
|
||||
|
||||
if (file) {
|
||||
this.construct(file)
|
||||
}
|
||||
}
|
||||
|
||||
construct(file) {
|
||||
this.ino = file.ino
|
||||
this.metadata = new FileMetadata(file)
|
||||
this.ebookFormat = file.ebookFormat
|
||||
this.addedAt = file.addedAt
|
||||
this.lastUpdate = file.lastUpdate
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
ino: this.ino,
|
||||
metadata: this.metadata.toJSON(),
|
||||
ebookFormat: this.ebookFormat,
|
||||
addedAt: this.addedAt,
|
||||
lastUpdate: this.lastUpdate
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = EBookFile
|
Loading…
Add table
Add a link
Reference in a new issue