Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: split getUpdateStatements into smaller methods #288

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions spec/regression/logistics/tests/update-many-optimized.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
fragment Request on Delivery {
deliveryNumber
consignee {
city
country {
isoCode
description {
languageIsoCode
translation
}
}
street
}
contentInfo {
translation
languageIsoCode
}
destinationCountry {
isoCode
}
dgInfo {
flashpoint
unNumber
notices
}
serialNumbers
items {
itemNumber
}
handlingUnits(orderBy: huNumber_ASC) {
huNumber
}
}

# triggers a different code path (because there are no relations)
mutation update {
updateDeliveries(
input: [
{
id: "@{ids/Delivery/1}"
consignee: { city: "Saint Nowhere", country: "DE", street: "Sunrise Avenue 1" }
contentInfo: [
{ languageIsoCode: "de", translation: "für dich" }
{ languageIsoCode: "en", translation: "for you" }
]
destinationCountry: "GB"
dgInfo: {
flashpoint: "37 °C"
unNumber: "123"
notices: ["handle with care", "do not throw"]
}
serialNumbers: ["456", "424242"]
addItems: [{ itemNumber: "44" }, { itemNumber: "45" }]
}
{
id: "@{ids/Delivery/2}"
consignee: { city: "Saint Nowhere", country: "DE", street: "Sunrise Avenue 2" }
contentInfo: [
{ languageIsoCode: "de", translation: "für dich" }
{ languageIsoCode: "en", translation: "for you" }
]
destinationCountry: "GB"
dgInfo: {
flashpoint: "37 °C"
unNumber: "123"
notices: ["do not care", "throw with handle"]
}
serialNumbers: ["456", "424242"]
addItems: [{ itemNumber: "44" }, { itemNumber: "45" }]
}
]
) {
...Request
}
}

query query {
allDeliveries(orderBy: [deliveryNumber_ASC], first: 1) {
...Request
}
}

mutation notFound {
updateDeliveries(input: [{ id: "not-found" }, { id: "also-not-found" }]) {
deliveryNumber
}
}
194 changes: 194 additions & 0 deletions spec/regression/logistics/tests/update-many-optimized.result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
{
"update": {
"data": {
"updateDeliveries": [
{
"deliveryNumber": "1000173",
"consignee": {
"city": "Saint Nowhere",
"country": {
"isoCode": "DE",
"description": [
{
"languageIsoCode": "DE",
"translation": "Deutschland"
},
{
"languageIsoCode": "EN",
"translation": "Germany"
}
]
},
"street": "Sunrise Avenue 1"
},
"contentInfo": [
{
"translation": "für dich",
"languageIsoCode": "de"
},
{
"translation": "for you",
"languageIsoCode": "en"
}
],
"destinationCountry": {
"isoCode": "GB"
},
"dgInfo": {
"flashpoint": "37 °C",
"unNumber": "123",
"notices": [
"handle with care",
"do not throw"
]
},
"serialNumbers": [
"456",
"424242"
],
"items": [
{
"itemNumber": "1001"
},
{
"itemNumber": "1002"
},
{
"itemNumber": "44"
},
{
"itemNumber": "45"
}
],
"handlingUnits": []
},
{
"deliveryNumber": "1000521",
"consignee": {
"city": "Saint Nowhere",
"country": {
"isoCode": "DE",
"description": [
{
"languageIsoCode": "DE",
"translation": "Deutschland"
},
{
"languageIsoCode": "EN",
"translation": "Germany"
}
]
},
"street": "Sunrise Avenue 2"
},
"contentInfo": [
{
"translation": "für dich",
"languageIsoCode": "de"
},
{
"translation": "for you",
"languageIsoCode": "en"
}
],
"destinationCountry": {
"isoCode": "GB"
},
"dgInfo": {
"flashpoint": "37 °C",
"unNumber": "123",
"notices": [
"do not care",
"throw with handle"
]
},
"serialNumbers": [
"456",
"424242"
],
"items": [
{
"itemNumber": "2001"
},
{
"itemNumber": "2002"
},
{
"itemNumber": "44"
},
{
"itemNumber": "45"
}
],
"handlingUnits": []
}
]
}
},
"query": {
"data": {
"allDeliveries": [
{
"deliveryNumber": "1000173",
"consignee": {
"city": "Saint Nowhere",
"country": {
"isoCode": "DE",
"description": [
{
"languageIsoCode": "DE",
"translation": "Deutschland"
},
{
"languageIsoCode": "EN",
"translation": "Germany"
}
]
},
"street": "Sunrise Avenue 1"
},
"contentInfo": [
{
"translation": "für dich",
"languageIsoCode": "de"
},
{
"translation": "for you",
"languageIsoCode": "en"
}
],
"destinationCountry": {
"isoCode": "GB"
},
"dgInfo": {
"flashpoint": "37 °C",
"unNumber": "123",
"notices": [
"handle with care",
"do not throw"
]
},
"serialNumbers": [
"456",
"424242"
],
"items": [
{
"itemNumber": "1001"
},
{
"itemNumber": "1002"
},
{
"itemNumber": "44"
},
{
"itemNumber": "45"
}
],
"handlingUnits": []
}
]
}
}
}
8 changes: 7 additions & 1 deletion spec/regression/logistics/tests/update-many.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fragment Request on Delivery {
}
}

mutation create {
mutation update {
updateDeliveries(
input: [
{
Expand Down Expand Up @@ -82,3 +82,9 @@ query query {
...Request
}
}

mutation notFound {
updateDeliveries(input: [{ id: "not-found" }, { id: "also-not-found" }]) {
deliveryNumber
}
}
2 changes: 1 addition & 1 deletion spec/regression/logistics/tests/update-many.result.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"create": {
"update": {
"data": {
"updateDeliveries": [
{
Expand Down
Loading