From 11459bbd5665300fe0d232e3eadc6b92dfa3b7f4 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 8 Nov 2022 08:46:36 +0100 Subject: [PATCH] refactor: change column name --- db/changes/10502-november/00-workerTimeControlMail.sql | 1 + .../worker-time-control/updateWorkerTimeControlMail.js | 10 +++++----- .../worker/back/models/worker-time-control-mail.json | 2 +- modules/worker/front/time-control/index.js | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 db/changes/10502-november/00-workerTimeControlMail.sql diff --git a/db/changes/10502-november/00-workerTimeControlMail.sql b/db/changes/10502-november/00-workerTimeControlMail.sql new file mode 100644 index 000000000..e3d169a83 --- /dev/null +++ b/db/changes/10502-november/00-workerTimeControlMail.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`workerTimeControlMail` CHANGE emailResponse reason text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL; \ No newline at end of file diff --git a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js index 3bb2b9013..a8dc14bb1 100644 --- a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js +++ b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js @@ -24,7 +24,7 @@ module.exports = Self => { required: true }, { - arg: 'emailResponse', + arg: 'reason', type: 'string' }], returns: { @@ -58,13 +58,13 @@ module.exports = Self => { if (!workerTimeControlMail) throw new UserError(`There aren't records for this week`); const oldState = workerTimeControlMail.state; - const oldEmailResponse = workerTimeControlMail.emailResponse; + const oldReason = workerTimeControlMail.reason; if (oldState == args.state) throw new UserError('Already has this status'); await workerTimeControlMail.updateAttributes({ state: args.state, - emailResponse: args.emailResponse || null + reason: args.reason || null }, myOptions); const logRecord = { @@ -74,11 +74,11 @@ module.exports = Self => { changedModel: 'WorkerTimeControlMail', oldInstance: { state: oldState, - emailResponse: oldEmailResponse + reason: oldReason }, newInstance: { state: args.state, - emailResponse: args.emailResponse + reason: args.reason } }; diff --git a/modules/worker/back/models/worker-time-control-mail.json b/modules/worker/back/models/worker-time-control-mail.json index 0a0c2bf9a..78b99881d 100644 --- a/modules/worker/back/models/worker-time-control-mail.json +++ b/modules/worker/back/models/worker-time-control-mail.json @@ -26,7 +26,7 @@ "updated": { "type": "date" }, - "emailResponse": { + "reason": { "type": "string" } }, diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 9bd9bb571..c3d3e5eab 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -322,7 +322,7 @@ class Controller extends Section { year: this.date.getFullYear(), week: weekNumber, state: 'REVISE', - emailResponse: this.reason + reason: this.reason }; const query = `WorkerTimeControls/updateWorkerTimeControlMail`; this.$http.post(query, params).then(() => {