diff --git a/db/versions/11094-maroonCyca/00-firstScript.sql b/db/versions/11094-maroonCyca/00-firstScript.sql deleted file mode 100644 index dfaf5b79e..000000000 --- a/db/versions/11094-maroonCyca/00-firstScript.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Place your SQL code here --- Auto-generated SQL script #202406101036 -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) - VALUES ('Worker','workerRelatives','*','ALLOW','ROLE','hr'); -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) - VALUES ('Worker','workerIrpf','*','ALLOW','ROLE','hr'); -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) - VALUES ('Worker','disabilityGrade','*','ALLOW','ROLE','hr'); diff --git a/db/versions/11245-turquoiseAnthurium/00-firstScript.sql b/db/versions/11245-turquoiseAnthurium/00-firstScript.sql new file mode 100644 index 000000000..6381f5db4 --- /dev/null +++ b/db/versions/11245-turquoiseAnthurium/00-firstScript.sql @@ -0,0 +1,15 @@ +ALTER TABLE vn.workerRelatives DROP FOREIGN KEY workerRelatives_disabilityGradeFk; +ALTER TABLE vn.workerRelatives DROP FOREIGN KEY workerRelatives_workerFk; + +RENAME TABLE `vn`.`workerRelatives` TO `vn`.`workerRelative`; + +ALTER TABLE vn.workerRelative ADD CONSTRAINT `workerRelatives_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE; +ALTER TABLE vn.workerRelative ADD CONSTRAINT `workerRelatives_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `workerIrpf` (`workerFk`) ON DELETE CASCADE ON UPDATE CASCADE; + + +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES + ('Worker','workerRelative','*','ALLOW','ROLE','hr'), + ('Worker','workerIrpf','*','ALLOW','ROLE','hr'), + ('Worker','disabilityGrade','*','ALLOW','ROLE','hr'); + diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index eb3e573e1..dc078f4d0 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -131,7 +131,7 @@ "DisabilityGrade": { "dataSource": "vn" }, - "WorkerRelatives": { + "WorkerRelative": { "dataSource": "vn" }, "MedicalReview": { diff --git a/modules/worker/back/models/worker-irpf.json b/modules/worker/back/models/worker-irpf.json index 034bed368..44bd9713c 100644 --- a/modules/worker/back/models/worker-irpf.json +++ b/modules/worker/back/models/worker-irpf.json @@ -22,7 +22,7 @@ "disabilityGradeFk": { "type" : "number" }, - "isDependent": { + "isDependend": { "type" : "number" }, "familySituation": { diff --git a/modules/worker/back/models/worker-relatives.json b/modules/worker/back/models/worker-relatives.json index 2429a2f1c..0815f7330 100644 --- a/modules/worker/back/models/worker-relatives.json +++ b/modules/worker/back/models/worker-relatives.json @@ -1,10 +1,10 @@ { - "name": "WorkerRelatives", + "name": "WorkerRelative", "description": "Model 145 IRPF", "base": "VnModel", "options": { "mysql": { - "table": "workerRelatives" + "table": "workerRelative" } }, "properties": { @@ -31,7 +31,7 @@ "isDependend": { "type" : "boolean" }, - "islointCustody": { + "isJointCustody": { "type" : "boolean" }, "updated": { @@ -46,7 +46,7 @@ }, "worker": { "type": "belongsTo", - "model": "WorkerIrpf", + "model": "VnUser", "foreignKey": "workerFK" } } diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 21c5bd10f..568d23b91 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -135,6 +135,16 @@ "type": "hasMany", "model": "WorkerTimeControlMail", "foreignKey": "workerFk" + }, + "irpf": { + "type": "hasMany", + "model": "WorkerIrpf", + "foreignKey": "workerFk" + }, + "workerRelative": { + "type": "hasMany", + "model": "WorkerRelative", + "foreignKey": "workerFK" } }, "acls": [ @@ -207,4 +217,4 @@ ] } } -} \ No newline at end of file +}