Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-f authored and fbeauchamp committed May 30, 2023
1 parent baa8c9a commit 3d572c1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions packages/xo-server/src/api/backup-ng.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ const SCHEMA_SETTINGS = {
}

export function createJob({ schedules, ...job }) {
job.userId = this.apiContext.user.id
job.type = 'backup'
return this.createBackupNgJob(job, schedules).then(({ id }) => id)
return this.createBackupNgJob('backup', job, schedules).then(({ id }) => id)
}

createJob.permission = 'admin'
Expand Down Expand Up @@ -85,7 +83,6 @@ deleteJob.params = {
}

export function editJob(props) {
props.type = 'backup'
return this.updateJob(props)
}

Expand Down
5 changes: 1 addition & 4 deletions packages/xo-server/src/api/mirror-backup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ const SCHEMA_SETTINGS = {
}

export function createJob({ schedules, ...job }) {
job.userId = this.apiContext.user.id
job.type = 'mirrorBackup'
return this.createBackupNgJob(job, schedules).then(({ id }) => id)
return this.createBackupNgJob('mirrorBackup', job, schedules).then(({ id }) => id)
}

createJob.permission = 'admin'
Expand Down Expand Up @@ -64,7 +62,6 @@ deleteJob.params = {
}

export function editJob(props) {
props.type = 'mirrorBackup'
return this.updateJob(props)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/xo-server/src/xo-mixins/backups-ng/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ export default class BackupNg {
})
}

async createBackupNgJob(props, schedules) {
async createBackupNgJob(type, props, schedules) {
const app = this._app
const job = await app.createJob(props)
const job = await app.createJob({ ...props, type, userId: this.apiContext?.user?.id })

if (schedules !== undefined) {
const { id, settings } = job
Expand Down

0 comments on commit 3d572c1

Please sign in to comment.