Merge pull request '6078_workerActivty' (!2130) from 6078_workerActivty into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2130
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Sergio De la torre 2024-03-14 05:58:13 +00:00
commit 1a2bda7e18
5 changed files with 109 additions and 7 deletions

View File

@ -16,7 +16,7 @@
"Accounting": {
"dataSource": "vn"
},
"Buyer": {
"Buyer": {
"dataSource": "vn"
},
"Campaign": {
@ -94,6 +94,9 @@
"Module": {
"dataSource": "vn"
},
"MrwConfig": {
"dataSource": "vn"
},
"Notification": {
"dataSource": "vn"
},
@ -166,10 +169,10 @@
"VnRole": {
"dataSource": "vn"
},
"MrwConfig": {
"WorkerActivity": {
"dataSource": "vn"
},
"WorkerActivityType": {
"dataSource": "vn"
}
}
}

View File

@ -0,0 +1,39 @@
{
"name": "WorkerActivity",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerActivity"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"created": {
"type": "date"
},
"model": {
"type": "string"
},
"event": {
"type": "string"
},
"description": {
"type": "string"
},
"relations": {
"workerFk": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"workerActivityTypeFk": {
"type": "belongsTo",
"model": "WorkerActivityType",
"foreignKey": "workerActivityTypeFk"
}
}
}
}

View File

@ -0,0 +1,19 @@
{
"name": "WorkerActivityType",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerActivityType"
}
},
"properties": {
"code": {
"id": true,
"type": "string"
},
"description": {
"type": "string",
"required": false
}
}
}

View File

@ -0,0 +1,36 @@
USE vn;
CREATE OR REPLACE TABLE vn.workerActivityType (
`code` varchar(20) NOT NULL,
`description` varchar(45) NOT NULL,
PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.department ADD workerActivityTypeFk varchar(20) NULL COMMENT 'Indica la actitividad que desempeña por defecto ese departamento';
ALTER TABLE vn.department ADD CONSTRAINT department_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
INSERT INTO vn.workerActivityType (code, description) VALUES('ON_CHECKING', 'REVISION');
INSERT INTO vn.workerActivityType (code, description) VALUES('PREVIOUS_CAM', 'CAMARA');
INSERT INTO vn.workerActivityType (code, description) VALUES('PREVIOUS_ART', 'ARTIFICIAL');
INSERT INTO vn.workerActivityType (code, description) VALUES('ON_PREPARATION', 'SACADO');
INSERT INTO vn.workerActivityType (code, description) VALUES('PACKING', 'ENCAJADO');
INSERT INTO vn.workerActivityType (code, description) VALUES('FIELD', 'CAMPOS');
INSERT INTO vn.workerActivityType (code, description) VALUES('DELIVERY', 'REPARTO');
INSERT INTO vn.workerActivityType (code, description) VALUES('STORAGE', 'ALMACENAJE');
INSERT INTO vn.workerActivityType (code, description) VALUES('PALLETIZING', 'PALETIZADO');
INSERT INTO vn.workerActivityType (code, description) VALUES('STOP', 'PARADA');
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivityType', '*', 'READ', 'ALLOW', 'ROLE', 'production');
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivity', '*', '*', 'ALLOW', 'ROLE', 'production');
ALTER TABLE vn.workerActivity MODIFY COLUMN event enum('open','close','insert','delete','update','refresh') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL;
ALTER TABLE vn.workerActivity MODIFY COLUMN model enum('COM','ENT','TPV','ENC','LAB','ETI','APP') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
ALTER TABLE vn.workerActivity ADD workerActivityTypeFk varchar(20) NULL;
ALTER TABLE vn.workerActivity ADD CONSTRAINT workerActivity_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -62,6 +62,11 @@
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"workerActivity": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerActivityTypeFk"
}
}
}
}