test: spread embed includes junction cols
This commit is contained in:
committed by
Steve Chavez
parent
25f65065f4
commit
315b01ebf7
+2
-1
@@ -9,8 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
- #1414, Add related orders - @steve-chavez
|
||||
+ On a many-to-one or one-to-one relationship, you can order a parent by a child column `/projects?select=*,clients(*)&order=clients(name).desc.nullsfirst`
|
||||
- #1233, #1907, Allow spreading embedded resources - @steve-chavez
|
||||
- #1233, #1907, #2566, Allow spreading embedded resources - @steve-chavez
|
||||
+ On a many-to-one or one-to-one relationship, you can unnest a json object with `/projects?select=*,..clients(client_name:name)`
|
||||
+ Allows including the join table columns when resource embedding
|
||||
+ Allows disambiguating a recursive m2m embed
|
||||
+ Allows disambiguating an embed that has a many-to-many relationship using two foreign keys on a junction
|
||||
|
||||
|
||||
@@ -84,3 +84,31 @@ spec =
|
||||
{ matchStatus = 400
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "can include or exclude attributes of the junction on a m2m" $ do
|
||||
get "/users?select=*,tasks:users_tasks(*,..tasks(*))&limit=1" `shouldRespondWith`
|
||||
[json|[{
|
||||
"id":1,"name":"Angela Martin",
|
||||
"tasks": [
|
||||
{"user_id":1,"task_id":1,"id":1,"name":"Design w7","project_id":1},
|
||||
{"user_id":1,"task_id":2,"id":2,"name":"Code w7","project_id":1},
|
||||
{"user_id":1,"task_id":3,"id":3,"name":"Design w10","project_id":2},
|
||||
{"user_id":1,"task_id":4,"id":4,"name":"Code w10","project_id":2}
|
||||
]
|
||||
}]|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
get "/users?select=*,tasks:users_tasks(..tasks(*))&limit=1" `shouldRespondWith`
|
||||
[json|[{
|
||||
"id":1,"name":"Angela Martin",
|
||||
"tasks":[
|
||||
{"id":1,"name":"Design w7","project_id":1},
|
||||
{"id":2,"name":"Code w7","project_id":1},
|
||||
{"id":3,"name":"Design w10","project_id":2},
|
||||
{"id":4,"name":"Code w10","project_id":2}
|
||||
]
|
||||
}]|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user