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

@ -13,12 +13,10 @@ const Logger = require('./Logger')
const Backup = require('./objects/Backup')
class BackupManager {
constructor(Uid, Gid, db) {
constructor(db) {
this.BackupPath = Path.join(global.MetadataPath, 'backups')
this.MetadataBooksPath = Path.join(global.MetadataPath, 'books')
this.Uid = Uid
this.Gid = Gid
this.db = db
this.scheduleTask = null
@ -37,7 +35,7 @@ class BackupManager {
var backupsDirExists = await fs.pathExists(this.BackupPath)
if (!backupsDirExists) {
await fs.ensureDir(this.BackupPath)
await filePerms(this.BackupPath, 0o774, this.Uid, this.Gid)
await filePerms.setDefault(this.BackupPath)
}
await this.loadBackups()
@ -211,7 +209,7 @@ class BackupManager {
})
if (zipResult) {
Logger.info(`[BackupManager] Backup successful ${newBackup.id}`)
await filePerms(newBackup.fullPath, 0o774, this.Uid, this.Gid)
await filePerms.setDefault(newBackup.fullPath)
newBackup.fileSize = await getFileSize(newBackup.fullPath)
var existingIndex = this.backups.findIndex(b => b.id === newBackup.id)
if (existingIndex >= 0) {