Add db migration file to change audiobooks to library items with new data model

This commit is contained in:
advplyr 2022-03-09 19:23:17 -06:00
parent 65793f7109
commit b97ed953f7
17 changed files with 719 additions and 127 deletions

View file

@ -1,10 +1,12 @@
const { getId } = require('../../utils/index')
class Author {
constructor(author) {
this.id = null
this.asin = null
this.name = null
this.imagePath = null
this.imageFullPath = null
this.relImagePath = null
this.addedAt = null
this.updatedAt = null
@ -18,7 +20,7 @@ class Author {
this.asin = author.asin
this.name = author.name
this.imagePath = author.imagePath
this.imageFullPath = author.imageFullPath
this.relImagePath = author.relImagePath
this.addedAt = author.addedAt
this.updatedAt = author.updatedAt
}
@ -29,9 +31,9 @@ class Author {
asin: this.asin,
name: this.name,
imagePath: this.imagePath,
imageFullPath: this.imageFullPath,
relImagePath: this.relImagePath,
addedAt: this.addedAt,
updatedAt: this.updatedAt
lastUpdate: this.updatedAt
}
}
@ -41,5 +43,15 @@ class Author {
name: this.name
}
}
setData(data) {
this.id = getId('aut')
this.name = data.name
this.asin = data.asin || null
this.imagePath = data.imagePath || null
this.relImagePath = data.relImagePath || null
this.addedAt = Date.now()
this.updatedAt = Date.now()
}
}
module.exports = Author