Class: Ecoportal::API::GraphQL::Mutation::AiSummary::SubmitFeedback

Inherits:
Logic::Mutation
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/mutation/ai_summary/submit_feedback.rb

Overview

Submit a rating on an AI summary version.

★ Corrected 2026-07-30 against the live schema — the previous wiring could never run: the mutation is submitPageAiSummaryFeedback(input: SubmitFeedbackInput!), the enum is SentimentEnum (there is no AiSummarySentimentEnum), and its values are positive / negative — not the "THUMBS_UP"/"THUMBS_DOWN" this used to document.

ai_summary_version_id comes from generatePageSummary's item.id.

Constant Summary collapse

SENTIMENTS =
%w[positive negative].freeze

Instance Method Summary collapse

Methods inherited from Logic::Mutation

#response_class

Instance Method Details

#query(ai_summary_version_id:, sentiment:, **kargs, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ecoportal/api/graphql/mutation/ai_summary/submit_feedback.rb', line 21

def query(ai_summary_version_id:, sentiment:, **kargs, &block)
  unless SENTIMENTS.include?(sentiment.to_s)
    raise ArgumentError, "sentiment must be one of #{SENTIMENTS.join(' / ')}; got #{sentiment.inspect}"
  end

  super(
    input: { aiSummaryVersionId: ai_summary_version_id, sentiment: sentiment.to_s },
    **kargs,
    &block
  )
end