fix: embedding computed with normal relationship

This commit is contained in:
steve-chavez
2022-10-27 13:49:53 -05:00
committed by Steve Chavez
parent 5d126bf0a3
commit 45e7aac218
5 changed files with 34 additions and 9 deletions
@@ -136,3 +136,18 @@ spec = describe "computed relationships" $ do
get "/fee?select=*,jsbaz(*,johnsmith(*, fee(*)))"
`shouldRespondWith`
[json|[]|] { matchHeaders = [matchContentTypeJson] }
it "creates queries with the right aliasing when following a normal embed" $ do
get "/projects?select=name,clients(name,computed_projects(name))&limit=1"
`shouldRespondWith`
[json|
[{"name":"Windows 7","clients":{"name":"Microsoft","computed_projects":{"name":"Windows 7"}}}]
|] { matchHeaders = [matchContentTypeJson] }
get "/clients?select=name,projects(name,computed_clients(name))&limit=1"
`shouldRespondWith`
[json|[
{"name":"Microsoft","projects":[
{"name":"Windows 7","computed_clients":{"name":"Microsoft"}},
{"name":"Windows 10","computed_clients":{"name":"Microsoft"}}
]}
]|] { matchHeaders = [matchContentTypeJson] }