From 976b18203eefa619c1db80ba38f8ba94e520dc04 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 16 Apr 2024 10:49:17 +0200 Subject: [PATCH 01/20] feat: refs #7187 check if is freelancer on insert & update --- .../deviceProductionUser_beforeInsert.sql | 16 +++++++++++++++- .../deviceProductionUser_beforeUpdate.sql | 16 +++++++++++++++- .../10993-brownAsparagus/00-dropUniqueKey.sql | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 db/versions/10993-brownAsparagus/00-dropUniqueKey.sql diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql index b392cf5a1..e81238748 100644 --- a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql +++ b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql @@ -3,6 +3,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_ BEFORE INSERT ON `deviceProductionUser` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); + DECLARE vHasPda BOOLEAN; + DECLARE visFreelancer BOOLEAN; + DECLARE vUserName VARCHAR(50); + + SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = NEW.userFk; + + SELECT name INTO vUserName FROM account.user WHERE id = NEW.userFk; + + SELECT account.user_hasRoleId(vUserName, (SELECT id FROM role WHERE name = 'freelancer')) INTO vIsFreelancer; + + IF NOT vIsFreelancer AND vHasPda THEN + CALL util.throw('You can only have one PDA'); + ELSE + SET NEW.editorFk = account.myUser_getId(); + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql b/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql index 055f81790..903541894 100644 --- a/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql +++ b/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql @@ -3,6 +3,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_ BEFORE UPDATE ON `deviceProductionUser` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); + DECLARE vHasPda BOOLEAN; + DECLARE visFreelancer BOOLEAN; + DECLARE vUserName VARCHAR(50); + + SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = NEW.userFk; + + SELECT name INTO vUserName FROM account.user WHERE id = NEW.userFk; + + SELECT account.user_hasRoleId(vUserName, (SELECT id FROM role WHERE name = 'freelancer')) INTO vIsFreelancer; + + IF NOT vIsFreelancer AND vHasPda THEN + CALL util.throw('You can only have one PDA'); + ELSE + SET NEW.editorFk = account.myUser_getId(); + END IF; END$$ DELIMITER ; diff --git a/db/versions/10993-brownAsparagus/00-dropUniqueKey.sql b/db/versions/10993-brownAsparagus/00-dropUniqueKey.sql new file mode 100644 index 000000000..39bac8652 --- /dev/null +++ b/db/versions/10993-brownAsparagus/00-dropUniqueKey.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.deviceProductionUser DROP INDEX IF EXISTS deviceProductionUser_UN; + From bab2ee78c428aba027764a5106fbc76a333dd676 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 19 Apr 2024 13:13:57 +0200 Subject: [PATCH 02/20] feat: refs #6428 auto-changelog with bash --- CHANGELOG.md | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 6 ++++ changelog.sh | 34 +++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 changelog.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index b2be92faa..04a40cd20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,96 @@ +# Version XX.XX - XXXX-XX-XX (TEXTO DE PRUEBA CREADO APARTIR DE DEV → TEST) + +### Added 🆕 + +- feat: #7130 added "served" field to RouteList table(Salix). by:Jon +- feat(binlog): refs #4409 New function for binlog queue monitoring by:Juan Ferrer Toribio +- feat: bloquear facturas recibidas contabilizadas refs #7173 by:Carlos Andrés +- feat: commit by:pablone +- feat(delay): refs #6005 add new restriction by:pablone +- feat(git): add commit lint refs #6130 by:pablone +- feat(git): add commit lint refs#6130 by:pablone +- feat(githook) add reference by:pablone +- feat(noSpam): refs #6005 check if exists a previous notification by:pablone +- feat(notify): refs #6005 add restriction on created notification time by:pablone +- feat(operator.spec): refs #6005 add spec for delay and fix spec for spam by:pablone +- feat: permissions to vn.entry.isBooked refs#6724 by:Carlos Andrés +- feat: refs #12 peter by:pablone +- feat: refs #6005 move logic from report to hook by:pablone +- feat: refs #6005 mover sql a la ultima carpeta by:pablone +- feat: refs #6021 fix proc by:pablone +- feat: refs #6021 order_put refactor by:pablone +- feat: refs #6130 add commit by:pablone +- feat: refs #6130 handle branch without task by:pablone +- feat: refs #6130 test commitLint (6130-commitLint) by:alexm +- feat: refs #6500 by:robert +- feat: refs #6500 cambios solicitados by:robert +- feat: refs #6500 delete procedure by:robert +- feat: refs #6500 procRefactor8 by:robert +- feat: refs #6724 Added admon acl to vn-check by:guillermo +- feat: refs #6724 Grant changes by:guillermo +- feat: refs #6724 hook added by:jorgep +- feat: refs #6938 add scope & acls by:jorgep +- feat: refs #6968 Changed groupingMode to enum by:guillermo +- feat: refs #6968 Requested changes by:guillermo +- feat: refs #6968 Transactioned and isTriggerDisabled by:guillermo +- feat: refs #7173 Added restrictions in invoiceIn structure by:guillermo +- feat: refs #7173 Added traduction by:guillermo +- feat(salix): refs #6930 Undo rollback salix-back by:Javier Segarra +- feat(salix): refs #6930 Undo rollback salix-front by:Javier Segarra +- feat: sin concatenar en el nombre by:jgallego +- feat(spec): refs #6005 add spec by:pablone +- feat(spec): refs #6005 add spec to backup Notify by:pablone +- feat: test by:pablone +- refs #7190 feat: renewToken for multimedia by:Javier Segarra + +### Changed 📦 + +- feat: refs #6021 order_put refactor by:pablone +- refactor(main-labeler): refs #6005 refactor de mainLabeler a backupPrinterFk by:pablone +- refactor(printer-notification): refs #6005 refactor de la notificación by:pablone +- refactor: refs #6005 delay on productionConfig by:pablone +- refactor: refs #6005 move the logic to the report by:pablone +- refactor: refs #6005 refactor spec by:pablone +- refactor: refs #6724 Minor change by:guillermo +- refactor: refs #7139 replace warehouse with ticket by:Jon +- refactor: refs #7181 Added grant by:guillermo +- refactor: refs #7181 Minor change by:guillermo +- refactor: refs #7181 Requested changes by:guillermo +- refactor: refs #7181 vn2008.Deleted risk_vs_client_list by:guillermo + +### Fixed 🛠️ + +- feat(operator.spec): refs #6005 add spec for delay and fix spec for spam by:pablone +- feat: refs #6021 fix proc by:pablone +- fix(binlog): refs #4409 Fixtures for binlogQueue by:Juan Ferrer Toribio +- fix(changes): refs #6005 remove changes files by:pablone +- fix(claim): remove blank space refs #6130 by:pablone +- fix commit code by:pablone +- fix: husky by:alexm +- fix(notification): refs #6005 notification changes by:pablone +- fix: refs #6005 add fixtures for a spec by:pablone +- fix: refs #6005 move logic to hook by:pablone +- fix: refs #6021 catalogue_findById by:pablone +- fix: refs #6021 proc by:pablone +- fix: refs #6130 code by:pablone +- fix:refs #6130 code by:pablone +- fix: refs #6130 code:code by:pablone +- fix: refs #6130 code remove console.log by:pablone +- fix: refs #6130 test by:pablone +- fix: refs #6938 acls & scope by:jorgep +- fix: refs #6938 e2e tests by:jorgep +- fix: refs #6938 filters & scope by:jorgep +- fix: refs #6938 front tests by:jorgep +- fix: refs #6938 scope by:jorgep +- fix: remove logs (testHusky_deleteme) by:alexm +- fix(spec): refs #6005 backupLabeler spec by:pablone +- fix(sql): refs #6005 fix fk formation by:pablone +- fix(yml): refs #6005 backUpLabeler yml fix by:pablone +- refs #6641 fix PR changes by:jcasado +- refs #6641 fix test by:jcasado +- refs #6641 test fixtures by:jcasado +- refs #6835 fix: issue by:Javier Segarra + # Changelog All notable changes to this project will be documented in this file. diff --git a/README.md b/README.md index b420bc44f..53478f425 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,12 @@ For end-to-end tests run from project's root. $ npm run test:e2e ``` +## Generate changeLog test → master +``` +$ bash changelog.sh +``` + + ## Visual Studio Code extensions Open Visual Studio Code, press Ctrl+P and paste the following commands. diff --git a/changelog.sh b/changelog.sh new file mode 100644 index 000000000..8cd7b4716 --- /dev/null +++ b/changelog.sh @@ -0,0 +1,34 @@ +features_types=(chore feat style) +changes_types=(refactor perf) +fix_types=(fix revert) +file="CHANGELOG.md" +file_tmp="temp_log.txt" +file_current_tmp="temp_current_log.txt" + +setType(){ + echo "### $1" >> $file_tmp + arr=("$@") + echo "" > $file_current_tmp + for i in "${arr[@]}" + do + git log --grep="$i" --oneline --no-merges --format="- %s %d by:%an" master..test >> $file_current_tmp + done + # remove duplicates + sort -o $file_current_tmp -u $file_current_tmp + cat $file_current_tmp >> $file_tmp + echo "" >> $file_tmp + # remove tmp current file + [ -e $file_current_tmp ] && rm $file_current_tmp +} + +echo "# Version XX.XX - XXXX-XX-XX" >> $file_tmp +echo "" >> $file_tmp + +setType "Added 🆕" "${features_types[@]}" +setType "Changed 📦" "${changes_types[@]}" +setType "Fixed 🛠️" "${fix_types[@]}" + +cat $file >> $file_tmp +mv $file_tmp $file + + From 71a9aed1bb64acfc8bbadda6541c1145845964f5 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 22 Apr 2024 18:03:17 +0200 Subject: [PATCH 03/20] fix: refs #7187 check for multiple device on freelancer --- .../procedures/worker_checkMultipleDevice.sql | 22 +++++++++++++++++++ .../deviceProductionUser_beforeInsert.sql | 17 ++------------ .../deviceProductionUser_beforeUpdate.sql | 16 ++------------ 3 files changed, 26 insertions(+), 29 deletions(-) create mode 100644 db/routines/vn/procedures/worker_checkMultipleDevice.sql diff --git a/db/routines/vn/procedures/worker_checkMultipleDevice.sql b/db/routines/vn/procedures/worker_checkMultipleDevice.sql new file mode 100644 index 000000000..ecc485c9d --- /dev/null +++ b/db/routines/vn/procedures/worker_checkMultipleDevice.sql @@ -0,0 +1,22 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_checkMultipleDevice`( + vSelf INT +) +BEGIN +/** + * Verify if a worker has multiple assigned devices, + * except for freelancers. + * + * @param vUserFk worker id. + */ + DECLARE vHasPda BOOLEAN; + DECLARE vIsFreelance BOOLEAN; + + SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = vSelf; + SELECT isFreelance INTO vIsFreelance FROM worker WHERE id = vSelf; + + IF NOT vIsFreelance AND vHasPda > 1 THEN + CALL util.throw('You can only have one PDA'); + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql index e81238748..ccef618a4 100644 --- a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql +++ b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql @@ -3,20 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_ BEFORE INSERT ON `deviceProductionUser` FOR EACH ROW BEGIN - DECLARE vHasPda BOOLEAN; - DECLARE visFreelancer BOOLEAN; - DECLARE vUserName VARCHAR(50); - - SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = NEW.userFk; - - SELECT name INTO vUserName FROM account.user WHERE id = NEW.userFk; - - SELECT account.user_hasRoleId(vUserName, (SELECT id FROM role WHERE name = 'freelancer')) INTO vIsFreelancer; - - IF NOT vIsFreelancer AND vHasPda THEN - CALL util.throw('You can only have one PDA'); - ELSE - SET NEW.editorFk = account.myUser_getId(); - END IF; + CALL worker_checkMultipleDevice(NEW.userFk); + SET NEW.editorFk = account.myUser_getId(); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql b/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql index 903541894..7318bd99b 100644 --- a/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql +++ b/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql @@ -3,20 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_ BEFORE UPDATE ON `deviceProductionUser` FOR EACH ROW BEGIN - DECLARE vHasPda BOOLEAN; - DECLARE visFreelancer BOOLEAN; - DECLARE vUserName VARCHAR(50); - SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = NEW.userFk; - - SELECT name INTO vUserName FROM account.user WHERE id = NEW.userFk; - - SELECT account.user_hasRoleId(vUserName, (SELECT id FROM role WHERE name = 'freelancer')) INTO vIsFreelancer; - - IF NOT vIsFreelancer AND vHasPda THEN - CALL util.throw('You can only have one PDA'); - ELSE - SET NEW.editorFk = account.myUser_getId(); - END IF; + CALL worker_checkMultipleDevice(NEW.userFk); + SET NEW.editorFk = account.myUser_getId(); END$$ DELIMITER ; From fbc1614132bbe5474b02b2b55d052f1cf9bc00f1 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 23 Apr 2024 18:50:28 +0200 Subject: [PATCH 04/20] fix: refs #7187 sql creation for deviceProductionUser --- db/versions/11010-blackChrysanthemum/00-firstScript.sql | 6 ++++++ db/versions/11011-pinkMoss/00-firstScript.sql | 1 + 2 files changed, 7 insertions(+) create mode 100644 db/versions/11010-blackChrysanthemum/00-firstScript.sql create mode 100644 db/versions/11011-pinkMoss/00-firstScript.sql diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql new file mode 100644 index 000000000..79751d095 --- /dev/null +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -0,0 +1,6 @@ +-- Place your SQL code here +ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY deviceProductionUser_FK; + +ALTER TABLE vn.deviceProductionUser DROP PRIMARY KEY; + +ALTER TABLE vn.deviceProductionUser ADD id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; diff --git a/db/versions/11011-pinkMoss/00-firstScript.sql b/db/versions/11011-pinkMoss/00-firstScript.sql new file mode 100644 index 000000000..371c2c358 --- /dev/null +++ b/db/versions/11011-pinkMoss/00-firstScript.sql @@ -0,0 +1 @@ +-- Place your SQL code here From a15970c95ff32917af1853b6e83261bb35c43580 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 24 Apr 2024 11:08:57 +0200 Subject: [PATCH 05/20] fix: refs #7187 sql for pdaFreelancer --- .../vn/triggers/deviceProductionUser_afterInsert.sql | 8 ++++++++ .../vn/triggers/deviceProductionUser_beforeInsert.sql | 1 - db/versions/11010-blackChrysanthemum/00-firstScript.sql | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/routines/vn/triggers/deviceProductionUser_afterInsert.sql diff --git a/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql b/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql new file mode 100644 index 000000000..3c8a9a51d --- /dev/null +++ b/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_afterInsert` + AFTER INSERT ON `deviceProductionUser` + FOR EACH ROW +BEGIN + CALL worker_checkMultipleDevice(NEW.userFk); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql index ccef618a4..b392cf5a1 100644 --- a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql +++ b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql @@ -3,7 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_ BEFORE INSERT ON `deviceProductionUser` FOR EACH ROW BEGIN - CALL worker_checkMultipleDevice(NEW.userFk); SET NEW.editorFk = account.myUser_getId(); END$$ DELIMITER ; diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql index 79751d095..483df99d0 100644 --- a/db/versions/11010-blackChrysanthemum/00-firstScript.sql +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -4,3 +4,7 @@ ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY deviceProductionUser_FK; ALTER TABLE vn.deviceProductionUser DROP PRIMARY KEY; ALTER TABLE vn.deviceProductionUser ADD id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; + +ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_deviceProduction_FK FOREIGN KEY (deviceProductionFk) REFERENCES vn.deviceProduction(id); + +ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique UNIQUE KEY (deviceProductionFk); From 88ef12032b463274187dd131212669e86981971d Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 24 Apr 2024 14:05:18 +0200 Subject: [PATCH 06/20] feat: refs #7187 serialNumber new column --- db/versions/11010-blackChrysanthemum/00-firstScript.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql index 483df99d0..dcf7585c2 100644 --- a/db/versions/11010-blackChrysanthemum/00-firstScript.sql +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -8,3 +8,6 @@ ALTER TABLE vn.deviceProductionUser ADD id INT UNSIGNED AUTO_INCREMENT NOT NULL ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_deviceProduction_FK FOREIGN KEY (deviceProductionFk) REFERENCES vn.deviceProduction(id); ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique UNIQUE KEY (deviceProductionFk); + +ALTER TABLE vn.deviceProduction ADD simSerialNumber TEXT NULL; + From 008b6f6f416ed6c8faa57f023fbb14f1f5c8fcec Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 24 Apr 2024 14:08:26 +0200 Subject: [PATCH 07/20] fix: refs #7187 unify versions --- db/versions/10993-brownAsparagus/00-dropUniqueKey.sql | 2 -- db/versions/11010-blackChrysanthemum/00-firstScript.sql | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 db/versions/10993-brownAsparagus/00-dropUniqueKey.sql diff --git a/db/versions/10993-brownAsparagus/00-dropUniqueKey.sql b/db/versions/10993-brownAsparagus/00-dropUniqueKey.sql deleted file mode 100644 index 39bac8652..000000000 --- a/db/versions/10993-brownAsparagus/00-dropUniqueKey.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE vn.deviceProductionUser DROP INDEX IF EXISTS deviceProductionUser_UN; - diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql index dcf7585c2..c274d1c71 100644 --- a/db/versions/11010-blackChrysanthemum/00-firstScript.sql +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -1,4 +1,5 @@ --- Place your SQL code here +ALTER TABLE vn.deviceProductionUser DROP INDEX IF EXISTS deviceProductionUser_UN; + ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY deviceProductionUser_FK; ALTER TABLE vn.deviceProductionUser DROP PRIMARY KEY; From e8a32d8e13ebd1878d2ddb6cc3d35b66b5b48231 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 24 Apr 2024 14:09:42 +0200 Subject: [PATCH 08/20] fix: refs #7187 db version --- db/versions/11011-pinkMoss/00-firstScript.sql | 1 - 1 file changed, 1 deletion(-) delete mode 100644 db/versions/11011-pinkMoss/00-firstScript.sql diff --git a/db/versions/11011-pinkMoss/00-firstScript.sql b/db/versions/11011-pinkMoss/00-firstScript.sql deleted file mode 100644 index 371c2c358..000000000 --- a/db/versions/11011-pinkMoss/00-firstScript.sql +++ /dev/null @@ -1 +0,0 @@ --- Place your SQL code here From f2d4283304d50a3420c232ac987662392d46e872 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 24 Apr 2024 14:29:57 +0200 Subject: [PATCH 09/20] fix: refs #7187 number on de code --- db/routines/vn/procedures/worker_checkMultipleDevice.sql | 6 ++++-- db/versions/11010-blackChrysanthemum/00-firstScript.sql | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/worker_checkMultipleDevice.sql b/db/routines/vn/procedures/worker_checkMultipleDevice.sql index ecc485c9d..00df08d49 100644 --- a/db/routines/vn/procedures/worker_checkMultipleDevice.sql +++ b/db/routines/vn/procedures/worker_checkMultipleDevice.sql @@ -11,11 +11,13 @@ BEGIN */ DECLARE vHasPda BOOLEAN; DECLARE vIsFreelance BOOLEAN; + DECLARE vMaxDevicesPerUser INT; SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = vSelf; - SELECT isFreelance INTO vIsFreelance FROM worker WHERE id = vSelf; + SELECT IFNULL(isFreelance, FALSE) INTO vIsFreelance FROM worker WHERE id = vSelf; + SELECT IFNULL(maxDevicesPerUser, FALSE) INTO vMaxDevicesPerUser FROM deviceProductionConfig LIMIT 1; - IF NOT vIsFreelance AND vHasPda > 1 THEN + IF NOT vIsFreelance AND vHasPda > vMaxDevicesPerUser THEN CALL util.throw('You can only have one PDA'); END IF; END$$ diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql index c274d1c71..556ddfc1b 100644 --- a/db/versions/11010-blackChrysanthemum/00-firstScript.sql +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -12,3 +12,6 @@ ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique U ALTER TABLE vn.deviceProduction ADD simSerialNumber TEXT NULL; +ALTER TABLE vn.deviceProductionConfig ADD maxDevicesPerUser INT UNSIGNED NULL; + +UPDATE vn.deviceProductionConfig SET maxDevicesPerUser=1 WHERE id=1; From 133b862dc0d0fc9660dc44ac0f11fbf1acc269ca Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 3 May 2024 14:20:16 +0200 Subject: [PATCH 10/20] fix: refs #7187 move column sim to deviceProductionUser --- .../11010-blackChrysanthemum/00-firstScript.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql index 556ddfc1b..a0d10891c 100644 --- a/db/versions/11010-blackChrysanthemum/00-firstScript.sql +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -1,17 +1,17 @@ ALTER TABLE vn.deviceProductionUser DROP INDEX IF EXISTS deviceProductionUser_UN; -ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY deviceProductionUser_FK; +ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY IF EXISTS deviceProductionUser_FK; ALTER TABLE vn.deviceProductionUser DROP PRIMARY KEY; -ALTER TABLE vn.deviceProductionUser ADD id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; +ALTER TABLE vn.deviceProductionUser ADD IF NOT EXISTS id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; -ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_deviceProduction_FK FOREIGN KEY (deviceProductionFk) REFERENCES vn.deviceProduction(id); +ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_deviceProduction_FK FOREIGN KEY IF NOT EXISTS (deviceProductionFk) REFERENCES vn.deviceProduction(id); -ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique UNIQUE KEY (deviceProductionFk); +ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique UNIQUE KEY IF NOT EXISTS (deviceProductionFk); -ALTER TABLE vn.deviceProduction ADD simSerialNumber TEXT NULL; +ALTER TABLE vn.deviceProductionUser ADD IF NOT EXISTS simSerialNumber TEXT NULL; -ALTER TABLE vn.deviceProductionConfig ADD maxDevicesPerUser INT UNSIGNED NULL; +ALTER TABLE vn.deviceProductionConfig ADD IF NOT EXISTS maxDevicesPerUser INT UNSIGNED NULL; UPDATE vn.deviceProductionConfig SET maxDevicesPerUser=1 WHERE id=1; From 699684bd656342b816d63f7410c02c98f41fb997 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 3 May 2024 14:22:48 +0200 Subject: [PATCH 11/20] feat: refs #7187 add sim column to the model and id --- modules/worker/back/models/device-production-user.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/worker/back/models/device-production-user.json b/modules/worker/back/models/device-production-user.json index 35a90fb50..f11fd240c 100644 --- a/modules/worker/back/models/device-production-user.json +++ b/modules/worker/back/models/device-production-user.json @@ -14,6 +14,10 @@ } }, "properties": { + "id": { + "type": "number", + "id": true + }, "deviceProductionFk": { "type": "number", "id": true @@ -21,6 +25,9 @@ "userFk": { "type": "number" }, + "simSerialNumber": { + "type": "string" + }, "created": { "type": "date" } From a797fca2ddfb42f31ad0265de0ac43e55ce49187 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 13 May 2024 08:30:20 +0200 Subject: [PATCH 12/20] feat: refs #7187 merge dev --- modules/worker/back/models/device-production-user.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/worker/back/models/device-production-user.json b/modules/worker/back/models/device-production-user.json index f11fd240c..d63fe0148 100644 --- a/modules/worker/back/models/device-production-user.json +++ b/modules/worker/back/models/device-production-user.json @@ -43,5 +43,10 @@ "model": "User", "foreignKey": "userFk" } + }, + "scope": { + "include":{ + "relation": "deviceProduction" + } } } From a8299383b9dcf889bef75bef3d4f8f649186f13f Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 13 May 2024 16:28:29 +0200 Subject: [PATCH 13/20] refs #6428 remove sh --- changelog.sh | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 changelog.sh diff --git a/changelog.sh b/changelog.sh deleted file mode 100644 index 8cd7b4716..000000000 --- a/changelog.sh +++ /dev/null @@ -1,34 +0,0 @@ -features_types=(chore feat style) -changes_types=(refactor perf) -fix_types=(fix revert) -file="CHANGELOG.md" -file_tmp="temp_log.txt" -file_current_tmp="temp_current_log.txt" - -setType(){ - echo "### $1" >> $file_tmp - arr=("$@") - echo "" > $file_current_tmp - for i in "${arr[@]}" - do - git log --grep="$i" --oneline --no-merges --format="- %s %d by:%an" master..test >> $file_current_tmp - done - # remove duplicates - sort -o $file_current_tmp -u $file_current_tmp - cat $file_current_tmp >> $file_tmp - echo "" >> $file_tmp - # remove tmp current file - [ -e $file_current_tmp ] && rm $file_current_tmp -} - -echo "# Version XX.XX - XXXX-XX-XX" >> $file_tmp -echo "" >> $file_tmp - -setType "Added 🆕" "${features_types[@]}" -setType "Changed 📦" "${changes_types[@]}" -setType "Fixed 🛠️" "${fix_types[@]}" - -cat $file >> $file_tmp -mv $file_tmp $file - - From ebcf8e2927b8246b609b29efb7c3e2e6cf1e8cff Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 14 May 2024 08:30:22 +0200 Subject: [PATCH 14/20] refs #6428 change file --- CHANGELOG.md | 92 ---------------------------------------------------- changelog.sh | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 92 deletions(-) create mode 100644 changelog.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a40cd20..e11a5a6ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,95 +1,3 @@ -# Version XX.XX - XXXX-XX-XX (TEXTO DE PRUEBA CREADO APARTIR DE DEV → TEST) - -### Added 🆕 - -- feat: #7130 added "served" field to RouteList table(Salix). by:Jon -- feat(binlog): refs #4409 New function for binlog queue monitoring by:Juan Ferrer Toribio -- feat: bloquear facturas recibidas contabilizadas refs #7173 by:Carlos Andrés -- feat: commit by:pablone -- feat(delay): refs #6005 add new restriction by:pablone -- feat(git): add commit lint refs #6130 by:pablone -- feat(git): add commit lint refs#6130 by:pablone -- feat(githook) add reference by:pablone -- feat(noSpam): refs #6005 check if exists a previous notification by:pablone -- feat(notify): refs #6005 add restriction on created notification time by:pablone -- feat(operator.spec): refs #6005 add spec for delay and fix spec for spam by:pablone -- feat: permissions to vn.entry.isBooked refs#6724 by:Carlos Andrés -- feat: refs #12 peter by:pablone -- feat: refs #6005 move logic from report to hook by:pablone -- feat: refs #6005 mover sql a la ultima carpeta by:pablone -- feat: refs #6021 fix proc by:pablone -- feat: refs #6021 order_put refactor by:pablone -- feat: refs #6130 add commit by:pablone -- feat: refs #6130 handle branch without task by:pablone -- feat: refs #6130 test commitLint (6130-commitLint) by:alexm -- feat: refs #6500 by:robert -- feat: refs #6500 cambios solicitados by:robert -- feat: refs #6500 delete procedure by:robert -- feat: refs #6500 procRefactor8 by:robert -- feat: refs #6724 Added admon acl to vn-check by:guillermo -- feat: refs #6724 Grant changes by:guillermo -- feat: refs #6724 hook added by:jorgep -- feat: refs #6938 add scope & acls by:jorgep -- feat: refs #6968 Changed groupingMode to enum by:guillermo -- feat: refs #6968 Requested changes by:guillermo -- feat: refs #6968 Transactioned and isTriggerDisabled by:guillermo -- feat: refs #7173 Added restrictions in invoiceIn structure by:guillermo -- feat: refs #7173 Added traduction by:guillermo -- feat(salix): refs #6930 Undo rollback salix-back by:Javier Segarra -- feat(salix): refs #6930 Undo rollback salix-front by:Javier Segarra -- feat: sin concatenar en el nombre by:jgallego -- feat(spec): refs #6005 add spec by:pablone -- feat(spec): refs #6005 add spec to backup Notify by:pablone -- feat: test by:pablone -- refs #7190 feat: renewToken for multimedia by:Javier Segarra - -### Changed 📦 - -- feat: refs #6021 order_put refactor by:pablone -- refactor(main-labeler): refs #6005 refactor de mainLabeler a backupPrinterFk by:pablone -- refactor(printer-notification): refs #6005 refactor de la notificación by:pablone -- refactor: refs #6005 delay on productionConfig by:pablone -- refactor: refs #6005 move the logic to the report by:pablone -- refactor: refs #6005 refactor spec by:pablone -- refactor: refs #6724 Minor change by:guillermo -- refactor: refs #7139 replace warehouse with ticket by:Jon -- refactor: refs #7181 Added grant by:guillermo -- refactor: refs #7181 Minor change by:guillermo -- refactor: refs #7181 Requested changes by:guillermo -- refactor: refs #7181 vn2008.Deleted risk_vs_client_list by:guillermo - -### Fixed 🛠️ - -- feat(operator.spec): refs #6005 add spec for delay and fix spec for spam by:pablone -- feat: refs #6021 fix proc by:pablone -- fix(binlog): refs #4409 Fixtures for binlogQueue by:Juan Ferrer Toribio -- fix(changes): refs #6005 remove changes files by:pablone -- fix(claim): remove blank space refs #6130 by:pablone -- fix commit code by:pablone -- fix: husky by:alexm -- fix(notification): refs #6005 notification changes by:pablone -- fix: refs #6005 add fixtures for a spec by:pablone -- fix: refs #6005 move logic to hook by:pablone -- fix: refs #6021 catalogue_findById by:pablone -- fix: refs #6021 proc by:pablone -- fix: refs #6130 code by:pablone -- fix:refs #6130 code by:pablone -- fix: refs #6130 code:code by:pablone -- fix: refs #6130 code remove console.log by:pablone -- fix: refs #6130 test by:pablone -- fix: refs #6938 acls & scope by:jorgep -- fix: refs #6938 e2e tests by:jorgep -- fix: refs #6938 filters & scope by:jorgep -- fix: refs #6938 front tests by:jorgep -- fix: refs #6938 scope by:jorgep -- fix: remove logs (testHusky_deleteme) by:alexm -- fix(spec): refs #6005 backupLabeler spec by:pablone -- fix(sql): refs #6005 fix fk formation by:pablone -- fix(yml): refs #6005 backUpLabeler yml fix by:pablone -- refs #6641 fix PR changes by:jcasado -- refs #6641 fix test by:jcasado -- refs #6641 test fixtures by:jcasado -- refs #6835 fix: issue by:Javier Segarra # Changelog diff --git a/changelog.sh b/changelog.sh new file mode 100644 index 000000000..8cd7b4716 --- /dev/null +++ b/changelog.sh @@ -0,0 +1,34 @@ +features_types=(chore feat style) +changes_types=(refactor perf) +fix_types=(fix revert) +file="CHANGELOG.md" +file_tmp="temp_log.txt" +file_current_tmp="temp_current_log.txt" + +setType(){ + echo "### $1" >> $file_tmp + arr=("$@") + echo "" > $file_current_tmp + for i in "${arr[@]}" + do + git log --grep="$i" --oneline --no-merges --format="- %s %d by:%an" master..test >> $file_current_tmp + done + # remove duplicates + sort -o $file_current_tmp -u $file_current_tmp + cat $file_current_tmp >> $file_tmp + echo "" >> $file_tmp + # remove tmp current file + [ -e $file_current_tmp ] && rm $file_current_tmp +} + +echo "# Version XX.XX - XXXX-XX-XX" >> $file_tmp +echo "" >> $file_tmp + +setType "Added 🆕" "${features_types[@]}" +setType "Changed 📦" "${changes_types[@]}" +setType "Fixed 🛠️" "${fix_types[@]}" + +cat $file >> $file_tmp +mv $file_tmp $file + + From bcb3ea48372aea93a01e50de2bfbabfa5f7500d7 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 16 May 2024 10:23:33 +0200 Subject: [PATCH 15/20] feat: refs #7187 new method available pda --- .../00-firstScript.sql | 4 +++ loopback/locale/en.json | 9 ++++--- loopback/locale/es.json | 7 +++--- .../back/methods/worker/getAvailablePda.js | 25 +++++++++++++++++++ .../worker/specs/getAvailablePda.spec.js | 13 ++++++++++ .../back/models/device-production-user.js | 8 ++++++ .../back/models/device-production-user.json | 4 +-- .../worker/back/models/device-production.json | 5 ++++ modules/worker/back/models/worker.js | 1 + 9 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 modules/worker/back/methods/worker/getAvailablePda.js create mode 100644 modules/worker/back/methods/worker/specs/getAvailablePda.spec.js create mode 100644 modules/worker/back/models/device-production-user.js diff --git a/db/versions/11010-blackChrysanthemum/00-firstScript.sql b/db/versions/11010-blackChrysanthemum/00-firstScript.sql index a0d10891c..c8dce54b2 100644 --- a/db/versions/11010-blackChrysanthemum/00-firstScript.sql +++ b/db/versions/11010-blackChrysanthemum/00-firstScript.sql @@ -15,3 +15,7 @@ ALTER TABLE vn.deviceProductionUser ADD IF NOT EXISTS simSerialNumber TEXT NULL; ALTER TABLE vn.deviceProductionConfig ADD IF NOT EXISTS maxDevicesPerUser INT UNSIGNED NULL; UPDATE vn.deviceProductionConfig SET maxDevicesPerUser=1 WHERE id=1; + +INSERT IGNORE INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Worker','getAvailablePda','READ','ALLOW','ROLE','hr'); + diff --git a/loopback/locale/en.json b/loopback/locale/en.json index ca76eae42..601a26f5b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -223,7 +223,8 @@ "printerNotExists": "The printer does not exist", "There are not picking tickets": "There are not picking tickets", "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", - "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", - "They're not your subordinate": "They're not your subordinate", - "InvoiceIn is already booked": "InvoiceIn is already booked" -} + "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", + "They're not your subordinate": "They're not your subordinate", + "InvoiceIn is already booked": "InvoiceIn is already booked", + "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" +} \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f1c57455e..c67f7ecd6 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -355,6 +355,7 @@ "No results found": "No se han encontrado resultados", "InvoiceIn is already booked": "La factura recibida está contabilizada", "This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia", - "Select ticket or client": "Elija un ticket o un client", - "It was not able to create the invoice": "No se pudo crear la factura" -} + "Select ticket or client": "Elija un ticket o un client", + "It was not able to create the invoice": "No se pudo crear la factura", + "This PDA is already assigned to another user": "This PDA is already assigned to another user" +} \ No newline at end of file diff --git a/modules/worker/back/methods/worker/getAvailablePda.js b/modules/worker/back/methods/worker/getAvailablePda.js new file mode 100644 index 000000000..5c97e15e1 --- /dev/null +++ b/modules/worker/back/methods/worker/getAvailablePda.js @@ -0,0 +1,25 @@ +module.exports = Self => { + Self.remoteMethod('getAvailablePda', { + description: 'returns devices without user', + accessType: 'READ', + accepts: [], + returns: { + type: 'array', + root: true + }, + http: { + path: `/getAvailablePda`, + verb: 'GET' + } + }); + Self.getAvailablePda = async() => { + const models = Self.app.models; + + return models.DeviceProduction.rawSql( + `SELECT d.* + FROM deviceProduction d + LEFT JOIN deviceProductionUser du ON du.deviceProductionFk = d.id + WHERE du.deviceProductionFk IS NULL` + ); + }; +}; diff --git a/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js b/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js new file mode 100644 index 000000000..7649225f1 --- /dev/null +++ b/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js @@ -0,0 +1,13 @@ +const models = require('vn-loopback/server/server').models; + +describe('worker getAvailablePda()', () => { + fit('should return a Pda that has no user assigned', async() => { + const [{id}] = await models.Worker.getAvailablePda(); + + const deviceProductionUser = await models.DeviceProductionUser.findOne({ + where: {deviceProductionFk: id} + }); + + expect(!deviceProductionUser).toBeTruthy(); + }); +}); diff --git a/modules/worker/back/models/device-production-user.js b/modules/worker/back/models/device-production-user.js new file mode 100644 index 000000000..81af484d3 --- /dev/null +++ b/modules/worker/back/models/device-production-user.js @@ -0,0 +1,8 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.rewriteDbError(function(err) { + if (err.code === 'ER_DUP_ENTRY') + return new UserError(`This PDA is already assigned to another user`); + return err; + }); +}; diff --git a/modules/worker/back/models/device-production-user.json b/modules/worker/back/models/device-production-user.json index d63fe0148..37955ab76 100644 --- a/modules/worker/back/models/device-production-user.json +++ b/modules/worker/back/models/device-production-user.json @@ -34,9 +34,9 @@ }, "relations": { "deviceProduction": { - "type": "belongsTo", + "type": "hasOne", "model": "DeviceProduction", - "foreignKey": "deviceProductionFk" + "foreignKey": "id" }, "user": { "type": "belongsTo", diff --git a/modules/worker/back/models/device-production.json b/modules/worker/back/models/device-production.json index f6e5105ad..91b05eb85 100644 --- a/modules/worker/back/models/device-production.json +++ b/modules/worker/back/models/device-production.json @@ -55,6 +55,11 @@ "type": "belongsTo", "model": "DeviceProductionState", "foreignKey": "stateFk" + }, + "deviceProductionUser": { + "type": "hasMany", + "model": "DeviceProductionUser", + "foreignKey": "deviceProductionFk" } } } diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js index b475bf26e..7128f973c 100644 --- a/modules/worker/back/models/worker.js +++ b/modules/worker/back/models/worker.js @@ -20,6 +20,7 @@ module.exports = Self => { require('../methods/worker/search')(Self); require('../methods/worker/isAuthorized')(Self); require('../methods/worker/setPassword')(Self); + require('../methods/worker/getAvailablePda')(Self); Self.validatesUniquenessOf('locker', { message: 'This locker has already been assigned' From 1abacdc42b76a65a7096bea23d36838c87697da6 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 16 May 2024 14:00:42 +0200 Subject: [PATCH 16/20] fix: refs #7187 method --- modules/worker/back/methods/worker/getAvailablePda.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/worker/back/methods/worker/getAvailablePda.js b/modules/worker/back/methods/worker/getAvailablePda.js index 5c97e15e1..65641a9e6 100644 --- a/modules/worker/back/methods/worker/getAvailablePda.js +++ b/modules/worker/back/methods/worker/getAvailablePda.js @@ -13,9 +13,7 @@ module.exports = Self => { } }); Self.getAvailablePda = async() => { - const models = Self.app.models; - - return models.DeviceProduction.rawSql( + return Self.app.models.DeviceProduction.rawSql( `SELECT d.* FROM deviceProduction d LEFT JOIN deviceProductionUser du ON du.deviceProductionFk = d.id From 4cf5457690309837dbb5cb69d2a96260472dd238 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 16 May 2024 14:01:41 +0200 Subject: [PATCH 17/20] fix: refs #7187 remove focus on spec --- .../worker/back/methods/worker/specs/getAvailablePda.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js b/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js index 7649225f1..c7051f0b4 100644 --- a/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js +++ b/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('worker getAvailablePda()', () => { - fit('should return a Pda that has no user assigned', async() => { + it('should return a Pda that has no user assigned', async() => { const [{id}] = await models.Worker.getAvailablePda(); const deviceProductionUser = await models.DeviceProductionUser.findOne({ From b299e842b944e43ab13d3ba04c427de9e6a8c106 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 16 May 2024 14:04:21 +0200 Subject: [PATCH 18/20] fix: refs #7187 model foreignKey --- modules/worker/back/models/device-production-user.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/worker/back/models/device-production-user.json b/modules/worker/back/models/device-production-user.json index 37955ab76..a024cc94c 100644 --- a/modules/worker/back/models/device-production-user.json +++ b/modules/worker/back/models/device-production-user.json @@ -34,9 +34,9 @@ }, "relations": { "deviceProduction": { - "type": "hasOne", - "model": "DeviceProduction", - "foreignKey": "id" + "type": "belongsTo", + "model": "DeviceProduction", + "foreignKey": "deviceProductionFk" }, "user": { "type": "belongsTo", From 1372f817bdb852bb83741fe6c96a4e71ba561aab Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 16 May 2024 14:05:22 +0200 Subject: [PATCH 19/20] fix: refs #7187 model --- modules/worker/back/models/device-production.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/worker/back/models/device-production.json b/modules/worker/back/models/device-production.json index 91b05eb85..f6e5105ad 100644 --- a/modules/worker/back/models/device-production.json +++ b/modules/worker/back/models/device-production.json @@ -55,11 +55,6 @@ "type": "belongsTo", "model": "DeviceProductionState", "foreignKey": "stateFk" - }, - "deviceProductionUser": { - "type": "hasMany", - "model": "DeviceProductionUser", - "foreignKey": "deviceProductionFk" } } } From a99554c773c5b6dfd0383e3d03017629eb190d48 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 17 May 2024 09:50:53 +0200 Subject: [PATCH 20/20] fix: Occasionally saleVolume bad index --- db/routines/vn/views/saleVolume.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/views/saleVolume.sql b/db/routines/vn/views/saleVolume.sql index aec739678..ffc6714c6 100644 --- a/db/routines/vn/views/saleVolume.sql +++ b/db/routines/vn/views/saleVolume.sql @@ -37,7 +37,7 @@ FROM ( ) JOIN `vn`.`volumeConfig` `vc` ) - JOIN `vn`.`itemCost` `ic` ON( + JOIN `vn`.`itemCost` `ic` FORCE INDEX (`PRIMARY`) ON( `ic`.`itemFk` = `s`.`itemFk` AND `ic`.`warehouseFk` = `t`.`warehouseFk` )