8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
10 changed files with 19 additions and 21 deletions
Showing only changes of commit d36ce6bf99 - Show all commits

View File

@ -2488,7 +2488,7 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
(1104, 2), (1104, 2),
(1104, 3); (1104, 3);
INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`) INSERT INTO `vn`.`workerDms`(`id`, `workerFk`, `dmsFk`,`isReadableByWorker`)
VALUES VALUES
(1, 1106, 4, TRUE), (1, 1106, 4, TRUE),
(2, 1107, 3, FALSE); (2, 1107, 3, FALSE);

View File

@ -1,11 +1,11 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_afterDelete` CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_afterDelete`
AFTER DELETE ON `workerDocument` AFTER DELETE ON `workerDms`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
INSERT INTO workerLog INSERT INTO workerLog
SET `action` = 'delete', SET `action` = 'delete',
`changedModel` = 'WorkerDocument', `changedModel` = 'WorkerDms',
`changedModelId` = OLD.id, `changedModelId` = OLD.id,
`userFk` = account.myUser_getId(); `userFk` = account.myUser_getId();
END$$ END$$

View File

@ -1,6 +1,6 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_beforeInsert` CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeInsert`
BEFORE INSERT ON `workerDocument` BEFORE INSERT ON `workerDms`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();

View File

@ -1,6 +1,6 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_beforeUpdate` CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeUpdate`
BEFORE UPDATE ON `workerDocument` BEFORE UPDATE ON `workerDms`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();

View File

@ -0,0 +1 @@
ALTER TABLE vn.workerDocument CHANGE worker workerFk int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1 @@
ALTER TABLE vn.workerDocument CHANGE document dmsFk int(11) DEFAULT NULL NULL;

View File

@ -0,0 +1 @@
RENAME TABLE vn.workerDocument TO vn.workerDms;

View File

@ -38,10 +38,11 @@ module.exports = Self => {
const account = await models.VnUser.findById(userId); const account = await models.VnUser.findById(userId);
const stmt = new ParameterizedSQL( const stmt = new ParameterizedSQL(
`SELECT d.id, d.id dmsFk `SELECT d.id, d.id dmsFk
FROM workerDocument wd FROM workerDms wd
JOIN dms d ON d.id = wd.document JOIN dms d ON d.id = wd.dmsFk
JOIN dmsType dt ON dt.id = d.dmsTypeFk JOIN dmsType dt ON dt.id = d.dmsTypeFk
LEFT JOIN account.roleRole rr ON rr.inheritsFrom = dt.readRoleFk AND rr.role = ? LEFT JOIN account.roleRole rr ON rr.inheritsFrom = dt.readRoleFk
AND rr.role = ?
`, [account.roleFk] `, [account.roleFk]
); );
const yourOwnDms = {and: [{isReadableByWorker: true}, {worker: userId}]}; const yourOwnDms = {and: [{isReadableByWorker: true}, {worker: userId}]};

View File

@ -6,7 +6,7 @@
}, },
"options": { "options": {
"mysql": { "mysql": {
"table": "workerDocument" "table": "workerDms"
} }
}, },
"properties": { "properties": {
@ -16,17 +16,11 @@
}, },
"dmsFk": { "dmsFk": {
"type": "number", "type": "number",
"required": true, "required": true
"mysql": {
"columnName": "document"
}
}, },
"workerFk": { "workerFk": {
"type": "number", "type": "number",
"required": true, "required": true
"mysql": {
"columnName": "worker"
}
}, },
"isReadableByWorker": { "isReadableByWorker": {
"type": "boolean" "type": "boolean"

View File

@ -375,7 +375,7 @@ localFixtures:
- workerBosses - workerBosses
- workerBusinessType - workerBusinessType
- workerConfig - workerConfig
- workerDocument - workerDms
- workerLog - workerLog
- workerMana - workerMana
- workerManaExcluded - workerManaExcluded