Class: Ecoportal::API::GraphQL::Mutation::Template::UpdateRelatedPage
- Inherits:
-
Logic::Mutation
- Object
- Logic::BaseQuery
- Logic::Mutation
- Ecoportal::API::GraphQL::Mutation::Template::UpdateRelatedPage
- Defined in:
- lib/ecoportal/api/graphql/mutation/template/update_related_page.rb
Overview
updateRelatedPage(input: UpdateRelatedPageInput!) — edits an existing related-pages
CONFIG entry on a template (title / target register / filters).
★ The worklog long carried this as an "ecoportal backend gap — the only genuine structural template omission". That note is STALE: the mutation exists in the live schema (verified 20260731), so the gap was ours. Without it, related-pages entries could be created and destroyed but never edited — every title or filter change meant destroy + recreate, which loses the entry id.
Note the argument name asymmetry, which is the schema's: create/destroy are
createTemplateRelatedPage/destroyTemplateRelatedPage, but update is plain
updateRelatedPage (no Template infix).
Constant Summary collapse
- SCHEMA_VERSION =
'20260731'.freeze
Class Method Summary collapse
-
.build_input(template_id:, id:, patch_ver:, title: nil, register_id: nil, filters: nil) ⇒ Object
Extracted so the partial-update rule is testable without a client or a network stub.
Instance Method Summary collapse
Methods inherited from Logic::Mutation
Class Method Details
.build_input(template_id:, id:, patch_ver:, title: nil, register_id: nil, filters: nil) ⇒ Object
Extracted so the partial-update rule is testable without a client or a network stub. A nil optional key is OMITTED, not serialised as an explicit null — the server reads an absent key as "leave alone", so sending null would blank the stored value.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ecoportal/api/graphql/mutation/template/update_related_page.rb', line 45 def self.build_input(template_id:, id:, patch_ver:, title: nil, register_id: nil, filters: nil) { templateId: template_id, id: id, patchVer: patch_ver }.tap do |input| input[:title] = title unless title.nil? input[:registerId] = register_id unless register_id.nil? input[:filters] = filters unless filters.nil? end end |
Instance Method Details
#query(template_id:, id:, patch_ver:, title: nil, register_id: nil, filters: nil, **kargs, &block) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/ecoportal/api/graphql/mutation/template/update_related_page.rb', line 34 def query(template_id:, id:, patch_ver:, title: nil, register_id: nil, filters: nil, **kargs, &block) input = self.class.build_input( template_id: template_id, id: id, patch_ver: patch_ver, title: title, register_id: register_id, filters: filters ) super(input: input, **kargs, &block) end |