New data model save covers, scanner, new api routes

This commit is contained in:
advplyr 2022-03-12 17:45:32 -06:00
parent 5f4e5cd3d8
commit 73257188f6
37 changed files with 1649 additions and 672 deletions

View file

@ -12,6 +12,9 @@ class FileMetadata {
if (metadata) {
this.construct(metadata)
}
// Temp flag used in scans
this.wasModified = false
}
construct(metadata) {
@ -46,5 +49,24 @@ class FileMetadata {
if (!this.ext) return ''
return this.ext.slice(1)
}
update(payload) {
var hasUpdates = false
for (const key in payload) {
if (this[key] !== undefined && this[key] !== payload[key]) {
this[key] = payload[key]
hasUpdates = true
}
}
return hasUpdates
}
setData(payload) {
for (const key in payload) {
if (this[key] !== undefined) {
this[key] = payload[key]
}
}
}
}
module.exports = FileMetadata