Sha256: aa129fc0fe8be8740b78f8fe0e815969d73a8b3ed61719873b236a4767a72575
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true module Platform module Interfaces module Starrable include Platform::Interfaces::Base description "Things that can be starred." global_id_field :id field :viewer_has_starred, Boolean, description: "Returns a boolean indicating whether the viewing user has starred this starrable.", null: false do argument :preceeds_connection_method, Boolean, required: false end def viewer_has_starred(**arguments) if @context[:viewer] ->(test_inner_proc) do @context[:viewer].starred?(@object) end else false end end field :stargazers, Connections::Stargazer, description: "A list of users who have starred this starrable.", null: false, connection: true do argument :order_by, Inputs::StarOrder, "Order for connection", required: false end def stargazers(**arguments) scope = case @object when Repository @object.stars when Gist GistStar.where(gist_id: @object.id) end table = scope.table_name if order_by = arguments[:order_by] scope = scope.order("#{table}.#{order_by["field"]} #{order_by["direction"]}") end scope end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql-1.8.0 | spec/fixtures/upgrader/starrable.transformed.rb |
graphql-1.8.0.pre11 | spec/fixtures/upgrader/starrable.transformed.rb |