From d60f2a7f88f44906f300e9c5c060ed4b5ec82f1e Mon Sep 17 00:00:00 2001 From: davidd Date: Tue, 19 Dec 2023 09:43:09 +0100 Subject: [PATCH 1/2] fix: refs #6398 Changed alias of views --- db/changes/235201/02-views.sql | 4 ++-- modules/ticket/back/methods/ticket/state.js | 4 ++-- modules/ticket/back/models/ticket-state.json | 8 ++++---- modules/ticket/back/models/ticket-tracking.json | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/db/changes/235201/02-views.sql b/db/changes/235201/02-views.sql index a0f41594d..af190f596 100644 --- a/db/changes/235201/02-views.sql +++ b/db/changes/235201/02-views.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `vn`.`ticketState` AS SELECT `tt`.`created` AS `updated`, `tt`.`stateFk` AS `stateFk`, - `tt`.`userFk` AS `userFk`, + `tt`.`userFk` AS `workerFk`, `tls`.`ticketFk` AS `ticketFk`, `s`.`id` AS `state`, `s`.`order` AS `productionOrder`, @@ -40,7 +40,7 @@ SELECT `ts`.`state` AS `state`, `ts`.`productionOrder` AS `productionOrder`, `ts`.`alertLevel` AS `alertLevel`, - `ts`.`userFk` AS `userFk`, + `ts`.`userFk` AS `worker`, `ts`.`code` AS `code`, `ts`.`updated` AS `updated`, `ts`.`isPicked` AS `isPicked` diff --git a/modules/ticket/back/methods/ticket/state.js b/modules/ticket/back/methods/ticket/state.js index adac2e42f..01bfbba20 100644 --- a/modules/ticket/back/methods/ticket/state.js +++ b/modules/ticket/back/methods/ticket/state.js @@ -51,12 +51,12 @@ module.exports = Self => { params.stateFk = state.id; } - if (!params.userFk) { + if (!params.workerFk) { const worker = await models.Worker.findOne({ where: {id: userId} }, myOptions); - params.userFk = worker.id; + params.workerFk = worker.id; } const ticketState = await models.TicketState.findById(params.ticketFk, { diff --git a/modules/ticket/back/models/ticket-state.json b/modules/ticket/back/models/ticket-state.json index 3ee50fac0..3dd322939 100644 --- a/modules/ticket/back/models/ticket-state.json +++ b/modules/ticket/back/models/ticket-state.json @@ -34,9 +34,9 @@ "foreignKey": "stateFk" }, "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "workerFk" + } } } diff --git a/modules/ticket/back/models/ticket-tracking.json b/modules/ticket/back/models/ticket-tracking.json index 8b0617145..4b5a4d473 100644 --- a/modules/ticket/back/models/ticket-tracking.json +++ b/modules/ticket/back/models/ticket-tracking.json @@ -37,9 +37,9 @@ "foreignKey": "stateFk" }, "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "userFk" + } } } -- 2.40.1 From 17e177b7888adf882683876d75f20d6d79b64799 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 19 Dec 2023 10:12:03 +0100 Subject: [PATCH 2/2] fix: refs #6398 Fix tests back --- modules/ticket/back/methods/ticket/state.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/state.js b/modules/ticket/back/methods/ticket/state.js index 01bfbba20..adac2e42f 100644 --- a/modules/ticket/back/methods/ticket/state.js +++ b/modules/ticket/back/methods/ticket/state.js @@ -51,12 +51,12 @@ module.exports = Self => { params.stateFk = state.id; } - if (!params.workerFk) { + if (!params.userFk) { const worker = await models.Worker.findOne({ where: {id: userId} }, myOptions); - params.workerFk = worker.id; + params.userFk = worker.id; } const ticketState = await models.TicketState.findById(params.ticketFk, { -- 2.40.1