refactor: refs #7895 workerDocument to workerDms #2953
|
@ -2488,7 +2488,7 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
|
|||
(1104, 2),
|
||||
(1104, 3);
|
||||
|
||||
INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`)
|
||||
INSERT INTO `vn`.`workerDms`(`id`, `workerFk`, `dmsFk`,`isReadableByWorker`)
|
||||
VALUES
|
||||
(1, 1106, 4, TRUE),
|
||||
(2, 1107, 3, FALSE);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_afterDelete`
|
||||
AFTER DELETE ON `workerDocument`
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_afterDelete`
|
||||
AFTER DELETE ON `workerDms`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO workerLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'WorkerDocument',
|
||||
`changedModel` = 'WorkerDms',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = account.myUser_getId();
|
||||
END$$
|
|
@ -1,6 +1,6 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_beforeInsert`
|
||||
BEFORE INSERT ON `workerDocument`
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeInsert`
|
||||
BEFORE INSERT ON `workerDms`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
|
@ -1,6 +1,6 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDocument_beforeUpdate`
|
||||
BEFORE UPDATE ON `workerDocument`
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeUpdate`
|
||||
BEFORE UPDATE ON `workerDms`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.workerDocument CHANGE worker workerFk int(10) unsigned DEFAULT NULL NULL;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.workerDocument CHANGE document dmsFk int(11) DEFAULT NULL NULL;
|
|
@ -0,0 +1 @@
|
|||
RENAME TABLE vn.workerDocument TO vn.workerDms;
|
|
@ -38,10 +38,11 @@ module.exports = Self => {
|
|||
const account = await models.VnUser.findById(userId);
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT d.id, d.id dmsFk
|
||||
FROM workerDocument wd
|
||||
JOIN dms d ON d.id = wd.document
|
||||
FROM workerDms wd
|
||||
JOIN dms d ON d.id = wd.dmsFk
|
||||
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]
|
||||
);
|
||||
const yourOwnDms = {and: [{isReadableByWorker: true}, {worker: userId}]};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "workerDocument"
|
||||
"table": "workerDms"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
@ -16,17 +16,11 @@
|
|||
},
|
||||
"dmsFk": {
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"mysql": {
|
||||
"columnName": "document"
|
||||
}
|
||||
"required": true
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"mysql": {
|
||||
"columnName": "worker"
|
||||
}
|
||||
"required": true
|
||||
},
|
||||
"isReadableByWorker": {
|
||||
"type": "boolean"
|
||||
|
|
|
@ -375,7 +375,7 @@ localFixtures:
|
|||
- workerBosses
|
||||
- workerBusinessType
|
||||
- workerConfig
|
||||
- workerDocument
|
||||
- workerDms
|
||||
- workerLog
|
||||
- workerMana
|
||||
- workerManaExcluded
|
||||
|
|
Loading…
Reference in New Issue