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 required: true
}, },
{ {
arg: 'emailResponse', arg: 'reason',
type: 'string' type: 'string'
}], }],
returns: { returns: {
@ -58,13 +58,13 @@ module.exports = Self => {
if (!workerTimeControlMail) throw new UserError(`There aren't records for this week`); if (!workerTimeControlMail) throw new UserError(`There aren't records for this week`);
const oldState = workerTimeControlMail.state; const oldState = workerTimeControlMail.state;
const oldEmailResponse = workerTimeControlMail.emailResponse; const oldReason = workerTimeControlMail.reason;
if (oldState == args.state) throw new UserError('Already has this status'); if (oldState == args.state) throw new UserError('Already has this status');
await workerTimeControlMail.updateAttributes({ await workerTimeControlMail.updateAttributes({
state: args.state, state: args.state,
emailResponse: args.emailResponse || null reason: args.reason || null
}, myOptions); }, myOptions);
const logRecord = { const logRecord = {
@ -74,11 +74,11 @@ module.exports = Self => {
changedModel: 'WorkerTimeControlMail', changedModel: 'WorkerTimeControlMail',
oldInstance: { oldInstance: {
state: oldState, state: oldState,
emailResponse: oldEmailResponse reason: oldReason
}, },
newInstance: { newInstance: {
state: args.state, state: args.state,
emailResponse: args.emailResponse reason: args.reason
} }
}; };

View File

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

View File

@ -322,7 +322,7 @@ class Controller extends Section {
year: this.date.getFullYear(), year: this.date.getFullYear(),
week: weekNumber, week: weekNumber,
state: 'REVISE', state: 'REVISE',
emailResponse: this.reason reason: this.reason
}; };
const query = `WorkerTimeControls/updateWorkerTimeControlMail`; const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
this.$http.post(query, params).then(() => { this.$http.post(query, params).then(() => {