Allow specifying source column in embed, fix #1078

This commit is contained in:
steve-chavez
2018-04-02 11:09:45 -05:00
committed by Steve Chávez
parent 50512e1117
commit 062a5581f5
6 changed files with 80 additions and 16 deletions
+17 -3
View File
@@ -169,18 +169,32 @@ findRelation schema allRelations nodeTableName parentNodeTableName relationDetai
Just rd ->
-- (request) => clients { ..., project.client_id{...} }
-- (request) => clients { ..., projects.client_id{...} }
-- will match
-- (relation type) => parent
-- (relation type) => child
-- (entity) => clients {id}
-- (foriegn entity) => projects {client_id}
(
relType == Child &&
nodeTableName == tableName relTable && -- match relation table name
parentNodeTableName == tableName relFTable && -- && -- match relation foreign table name
parentNodeTableName == tableName relFTable && -- match relation foreign table name
length relColumns == 1 &&
rd == colName (unsafeHead relColumns)
) ||
-- (request) => message { ..., person_detail.sender{...} }
-- will match
-- (relation type) => parent
-- (entity) => message {sender}
-- (foriegn entity) => person_detail {id}
(
relType == Parent &&
nodeTableName == tableName relTable && -- match relation table name
parentNodeTableName == tableName relFTable && -- match relation foreign table name
length relFColumns == 1 &&
rd == colName (unsafeHead relFColumns)
) ||
-- (request) => tasks { ..., users.tasks_users{...} }
-- will match
-- (relation type) => many