diff --git a/src/api/job.js b/src/api/job.js index 56dc49bb4..8e576d687 100644 --- a/src/api/job.js +++ b/src/api/job.js @@ -18,7 +18,9 @@ get.params = { } export async function create ({job}) { - job.userId = this.session.get('user_id') + if (!job.userId) { + job.userId = this.session.get('user_id') + } return (await this.createJob(job)).id } @@ -29,6 +31,7 @@ create.params = { job: { type: 'object', properties: { + userId: {type: 'string', optional: true}, name: {type: 'string', optional: true}, type: {type: 'string'}, key: {type: 'string'}, @@ -51,11 +54,7 @@ create.params = { } export async function set ({job}) { - if (!job.userId) { - job.userId = this.session.get('user_id') - } - - return this.updateJob(job) + await this.updateJob(job) } set.permission = 'admin' @@ -65,7 +64,6 @@ set.params = { type: 'object', properties: { id: {type: 'string'}, - userId: {type: 'string', optional: true}, name: {type: 'string', optional: true}, type: {type: 'string'}, key: {type: 'string'},