This commit is contained in:
Juan Ferrer 2019-01-28 10:04:20 +01:00
commit cb85610c5d
3 changed files with 40 additions and 3 deletions

View File

@ -43,5 +43,11 @@
}, },
"PersonMedia": { "PersonMedia": {
"dataSource": "vn" "dataSource": "vn"
},
"PersonDepartment": {
"dataSource": "vn"
} }
} }

View File

@ -0,0 +1,31 @@
{
"name": "PersonDepartment",
"base": "VnModel",
"options": {
"mysql": {
"table": "personDepartment"
}
},
"properties": {
"name": {
"type": "String"
},
"firstName": {
"type": "String"
},
"workerFk": {
"id": true,
"type": "Number"
},
"department": {
"type": "Number"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
}
}
}

View File

@ -5,7 +5,7 @@ CREATE
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `vn`.`personDepartment` AS VIEW `vn`.`personDepartment` AS
SELECT SELECT
`p`.`id_trabajador` AS `id_trabajador`, `p`.`id_trabajador` AS `workerFk`,
`p`.`name` AS `name`, `p`.`name` AS `name`,
`p`.`firstname` AS `firstname`, `p`.`firstname` AS `firstname`,
`d`.`name` AS `department` `d`.`name` AS `department`