ไลบรารี Queriesแทนที่โดเมนเก่าด้วยโดเมนใหม่ในทุกโพสต์
แทนที่โดเมนเก่าด้วยโดเมนใหม่ในทุกโพสต์
query นี้จะเริ่มต้นด้วยการกรองโพสต์ทั้งหมดที่มี "https://my-old-domain.com" อยู่ในเนื้อหา แล้วแทนที่สตริงนี้ด้วย "https://my-new-domain.com"
query นี้ต้องการให้ endpoint เปิดใช้งาน Nested Mutations
mutation ReplaceOldWithNewDomainInPosts(
$oldDomain: String!,
$newDomain: String!
) {
posts(
filter: {
search: $oldDomain
},
pagination: {
limit: -1
}
) {
id
rawContent
adaptedRawContent: _strReplace(
search: $oldDomain
replaceWith: $newDomain
in: $__rawContent
)
update(input: {
contentAs: { html: $__adaptedRawContent }
}) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
post {
id
rawContent
}
}
}
}