#996, new model personDepartment

This commit is contained in:
Bernat 2019-01-28 09:52:53 +01:00
parent 9b1a52e47d
commit 7a879f5431
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`