refactor: change column name

This commit is contained in:
Vicent Llopis 2022-11-08 08:46:36 +01:00
parent 1bc8cf52d5
commit 11459bbd56
4 changed files with 8 additions and 7 deletions

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`workerTimeControlMail` CHANGE emailResponse reason text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;

View File

@ -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
}
};

View File

@ -26,7 +26,7 @@
"updated": {
"type": "date"
},
"emailResponse": {
"reason": {
"type": "string"
}
},

View File

@ -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(() => {