'Restaurant' description 'A place of business serving food in New York City' global_id_field :id field :name, !types.String, 'The doing-business-as value.' field :camis, !types.String, 'The unique identifier.' field :buildingNumber, types.String, 'The street number.', property: :building_number field :street, types.String, 'The street name.' field :zipcode, types.String, 'The zip code.' field :cuisine, types.String, 'The cuisine.' field :grade, types.String, 'The latest grade of an inspection.' end end end
'Inspection' description 'A NYC health inspection.' global_id_field :id field :type, types.String, 'The type of inspection.' field :violationDescription, types.String, 'The violation description.', property: :violation_description field :violationCode, types.String, 'The violation code cited.', property: :violation_code field :grade, types.String, 'The grade received.' field :score, types.Int, 'The numeric score received.' field :inspectedAt, !types.String, 'The inspection timestamp.', property: :inspected_at field :gradedAt, types.String, 'The issued grade timestamp.', property: :graded_at end end end
"RootQuery" description "The query root." field :restaurant do type -> { Types::Restaurant } description "Perform a search for one restaurant." argument :name, types.String resolve -> (object, arguments, context) do ::Restaurant.find_by(name: arguments['name']) end end end end end
'Restaurant' description 'A place of business serving food in New York City' connection :inspections, -> { Types::Inspection.connection_type } do description 'List the inspections.' resolve -> (object, arguments, context) do object.inspections end end end end end