QueryRoot now returns proposals, comment(:id) and comments
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user