diff --git a/app/graph/types/query_root.rb b/app/graph/types/query_root.rb index 28d1685be..5b8664dc6 100644 --- a/app/graph/types/query_root.rb +++ b/app/graph/types/query_root.rb @@ -10,4 +10,29 @@ QueryRoot = GraphQL::ObjectType.define do Proposal.find(arguments["id"]) } end + + field :proposals do + type types[ProposalType] + description "Find all Proposals" + resolve -> (object, arguments, context) { + Proposal.all + } + end + + field :comment do + type CommentType + description "Find a Comment by id" + argument :id, !types.ID + resolve -> (object, arguments, context) { + Comment.find(arguments["id"]) + } + end + + field :comments do + type types[CommentType] + description "Find all Comments" + resolve -> (object, arguments, context) { + Comment.all + } + end end