audiobookshelf/server/objects/files/LibraryFile.js
2022-03-08 19:31:44 -06:00

31 lines
607 B
JavaScript

const FileMetadata = require('../metadata/FileMetadata')
class LibraryFile {
constructor(file) {
this.ino = null
this.metadata = null
this.addedAt = null
this.updatedAt = null
if (file) {
this.construct(file)
}
}
construct(file) {
this.ino = file.ino
this.metadata = new FileMetadata(file.metadata)
this.addedAt = file.addedAt
this.updatedAt = file.updatedAt
}
toJSON() {
return {
ino: this.ino,
metadata: this.metadata.toJSON(),
addedAt: this.addedAt,
updatedAt: this.updatedAt
}
}
}
module.exports = LibraryFile