fix: bad M2M embed on RPC

This commit is contained in:
steve-chavez
2022-11-18 17:49:24 -05:00
committed by Steve Chavez
parent cca0b5ae66
commit cb99270a8f
7 changed files with 39 additions and 18 deletions
+5 -1
View File
@@ -246,13 +246,17 @@ spec actualPgVersion =
`shouldRespondWith`
[json|{"id": 2, "articleStars": [{"userId": 3}]}|]
it "can embed an M2M relationship table" $
it "can embed an M2M relationship table" $ do
get "/rpc/getallusers?select=name,tasks(name)&id=gt.1"
`shouldRespondWith` [json|[
{"name":"Michael Scott", "tasks":[{"name":"Design IOS"}, {"name":"Code IOS"}, {"name":"Design OSX"}]},
{"name":"Dwight Schrute","tasks":[{"name":"Design w7"}, {"name":"Design IOS"}]}
]|]
{ matchHeaders = [matchContentTypeJson] }
-- https://github.com/PostgREST/postgrest/issues/2565
get "/rpc/get_yards?select=groups(*)"
`shouldRespondWith` [json|[]|]
{ matchHeaders = [matchContentTypeJson] }
it "can embed an M2M relationship table that has a parent relationship table" $
get "/rpc/getallusers?select=name,tasks(name,project:projects(name))&id=gt.1"