File: query.rb

package info (click to toggle)
ruby-graphlient 0.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,648 kB
  • sloc: ruby: 1,288; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require_relative '../types/invoice_type'
class Query < GraphQL::Schema::Object
  field :invoice, InvoiceType, null: true do
    description 'Find invoice'
    argument :id, Integer, required: false
  end

  field :not_null_invoice, InvoiceType, null: false do
    description 'Find invoice'
    argument :id, Integer, required: false
  end

  def invoice(id: nil)
    return nil if id.nil?
    OpenStruct.new(
      id: id,
      fee_in_cents: 20_000
    )
  end

  def not_null_invoice(*)
    nil
  end
end