-
-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test updating and omitting the relationship id entirely
- Loading branch information
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
postgraphile/postgraphile/__tests__/mutations/v4/relay.updateLeftArm.withoutPersonId.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
updateLeftArm: { | ||
leftArm: { | ||
id: "WyJsZWZ0X2FybXMiLDQyXQ==", | ||
personByPersonId: { | ||
id: "WyJwZW9wbGUiLDRd", | ||
}, | ||
lengthInMetres: 0.71, | ||
mood: "neutral", | ||
}, | ||
}, | ||
} |
83 changes: 83 additions & 0 deletions
83
postgraphile/postgraphile/__tests__/mutations/v4/relay.updateLeftArm.withoutPersonId.mermaid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
%%{init: {'themeVariables': { 'fontSize': '12px'}}}%% | ||
graph TD | ||
classDef path fill:#eee,stroke:#000,color:#000 | ||
classDef plan fill:#fff,stroke-width:1px,color:#000 | ||
classDef itemplan fill:#fff,stroke-width:2px,color:#000 | ||
classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000 | ||
classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000 | ||
classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left | ||
|
||
|
||
%% plan dependencies | ||
Object20{{"Object[20∈0]<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan | ||
Access18{{"Access[18∈0]<br />ᐸ3.pgSettingsᐳ"}}:::plan | ||
Access19{{"Access[19∈0]<br />ᐸ3.withPgClientᐳ"}}:::plan | ||
Access18 & Access19 --> Object20 | ||
Lambda14{{"Lambda[14∈0]<br />ᐸdecode_LeftArm_base64JSONᐳ"}}:::plan | ||
Constant39{{"Constant[39∈0]<br />ᐸ'WyJsZWZ0X2FybXMiLDQyXQ=='ᐳ"}}:::plan | ||
Constant39 --> Lambda14 | ||
Access15{{"Access[15∈0]<br />ᐸ14.1ᐳ"}}:::plan | ||
Lambda14 --> Access15 | ||
__Value3["__Value[3∈0]<br />ᐸcontextᐳ"]:::plan | ||
__Value3 --> Access18 | ||
__Value3 --> Access19 | ||
__Value0["__Value[0∈0]"]:::plan | ||
__Value5["__Value[5∈0]<br />ᐸrootValueᐳ"]:::plan | ||
Constant40{{"Constant[40∈0]<br />ᐸ0.71ᐳ"}}:::plan | ||
PgUpdateSingle17[["PgUpdateSingle[17∈1]<br />ᐸleft_arm(id;length_in_metres)ᐳ"]]:::sideeffectplan | ||
Object20 -->|rejectNull| PgUpdateSingle17 | ||
Access15 & Constant40 --> PgUpdateSingle17 | ||
Object21{{"Object[21∈1]<br />ᐸ{result}ᐳ"}}:::plan | ||
PgUpdateSingle17 --> Object21 | ||
List24{{"List[24∈3]<br />ᐸ22,23ᐳ"}}:::plan | ||
Constant22{{"Constant[22∈3]<br />ᐸ'left_arms'ᐳ"}}:::plan | ||
PgClassExpression23{{"PgClassExpression[23∈3]<br />ᐸ__left_arm__.”id”ᐳ"}}:::plan | ||
Constant22 & PgClassExpression23 --> List24 | ||
PgSelect27[["PgSelect[27∈3]<br />ᐸpersonᐳ"]]:::plan | ||
PgClassExpression26{{"PgClassExpression[26∈3]<br />ᐸ__left_arm...person_id”ᐳ"}}:::plan | ||
Object20 & PgClassExpression26 --> PgSelect27 | ||
PgUpdateSingle17 --> PgClassExpression23 | ||
Lambda25{{"Lambda[25∈3]<br />ᐸbase64JSONEncodeᐳ"}}:::plan | ||
List24 --> Lambda25 | ||
PgUpdateSingle17 --> PgClassExpression26 | ||
First31{{"First[31∈3]"}}:::plan | ||
PgSelect27 --> First31 | ||
PgSelectSingle32{{"PgSelectSingle[32∈3]<br />ᐸpersonᐳ"}}:::plan | ||
First31 --> PgSelectSingle32 | ||
PgClassExpression37{{"PgClassExpression[37∈3]<br />ᐸ__left_arm...in_metres”ᐳ"}}:::plan | ||
PgUpdateSingle17 --> PgClassExpression37 | ||
PgClassExpression38{{"PgClassExpression[38∈3]<br />ᐸ__left_arm__.”mood”ᐳ"}}:::plan | ||
PgUpdateSingle17 --> PgClassExpression38 | ||
Constant33{{"Constant[33∈3]<br />ᐸ'people'ᐳ"}}:::plan | ||
List35{{"List[35∈4]<br />ᐸ33,34ᐳ"}}:::plan | ||
PgClassExpression34{{"PgClassExpression[34∈4]<br />ᐸ__person__.”id”ᐳ"}}:::plan | ||
Constant33 & PgClassExpression34 --> List35 | ||
PgSelectSingle32 --> PgClassExpression34 | ||
Lambda36{{"Lambda[36∈4]<br />ᐸbase64JSONEncodeᐳ"}}:::plan | ||
List35 --> Lambda36 | ||
|
||
%% define steps | ||
|
||
subgraph "Buckets for mutations/v4/relay.updateLeftArm.withoutPersonId" | ||
Bucket0("Bucket 0 (root)"):::bucket | ||
classDef bucket0 stroke:#696969 | ||
class Bucket0,__Value0,__Value3,__Value5,Lambda14,Access15,Access18,Access19,Object20,Constant39,Constant40 bucket0 | ||
Bucket1("Bucket 1 (mutationField)<br />Deps: 20, 15, 40<br /><br />1: PgUpdateSingle[17]<br />2: <br />ᐳ: Object[21]"):::bucket | ||
classDef bucket1 stroke:#00bfff | ||
class Bucket1,PgUpdateSingle17,Object21 bucket1 | ||
Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 21, 17, 20<br /><br />ROOT Object{1}ᐸ{result}ᐳ[21]"):::bucket | ||
classDef bucket2 stroke:#7f007f | ||
class Bucket2 bucket2 | ||
Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 17, 20<br /><br />ROOT PgUpdateSingle{1}ᐸleft_arm(id;length_in_metres)ᐳ[17]<br />1: <br />ᐳ: 22, 23, 26, 33, 37, 38, 24, 25<br />2: PgSelect[27]<br />ᐳ: First[31], PgSelectSingle[32]"):::bucket | ||
classDef bucket3 stroke:#ffa500 | ||
class Bucket3,Constant22,PgClassExpression23,List24,Lambda25,PgClassExpression26,PgSelect27,First31,PgSelectSingle32,Constant33,PgClassExpression37,PgClassExpression38 bucket3 | ||
Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 32, 33<br /><br />ROOT PgSelectSingle{3}ᐸpersonᐳ[32]"):::bucket | ||
classDef bucket4 stroke:#0000ff | ||
class Bucket4,PgClassExpression34,List35,Lambda36 bucket4 | ||
Bucket0 --> Bucket1 | ||
Bucket1 --> Bucket2 | ||
Bucket2 --> Bucket3 | ||
Bucket3 --> Bucket4 | ||
classDef unary fill:#fafffa,borderWidth:8px | ||
class Object20,Lambda14,Access15,Access18,Access19,__Value0,__Value3,__Value5,Constant39,Constant40,PgUpdateSingle17,Object21,List24,PgSelect27,PgClassExpression23,Lambda25,PgClassExpression26,First31,PgSelectSingle32,PgClassExpression37,PgClassExpression38,Constant22,Constant33,List35,PgClassExpression34,Lambda36 unary | ||
end |
17 changes: 17 additions & 0 deletions
17
postgraphile/postgraphile/__tests__/mutations/v4/relay.updateLeftArm.withoutPersonId.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
update "c"."left_arm" as __left_arm__ set "length_in_metres" = $1::"float8" where (__left_arm__."id" = $2::"int4") returning | ||
__left_arm__."id"::text as "0", | ||
__left_arm__."person_id"::text as "1", | ||
__left_arm__."length_in_metres"::text as "2", | ||
__left_arm__."mood" as "3"; | ||
|
||
select __person_result__.* | ||
from (select 0 as idx, $1::"int4" as "id0") as __person_identifiers__, | ||
lateral ( | ||
select | ||
__person__."id"::text as "0", | ||
__person_identifiers__.idx as "1" | ||
from "c"."person" as __person__ | ||
where ( | ||
__person__."id" = __person_identifiers__."id0" | ||
) | ||
) as __person_result__; |
20 changes: 20 additions & 0 deletions
20
...hile/postgraphile/__tests__/mutations/v4/relay.updateLeftArm.withoutPersonId.test.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## expect(errors).toBeFalsy(); | ||
#> schema: ["a", "b", "c"] | ||
#> extends: ["postgraphile/presets/relay:PgRelayPreset"] | ||
mutation { | ||
updateLeftArm( | ||
input: { | ||
id: "WyJsZWZ0X2FybXMiLDQyXQ==" | ||
leftArmPatch: { lengthInMetres: 0.71 } | ||
} | ||
) { | ||
leftArm { | ||
id | ||
personByPersonId { | ||
id | ||
} | ||
lengthInMetres | ||
mood | ||
} | ||
} | ||
} |