Class: Decidim::Comments::VoteCommentResolver
- Inherits:
-
Object
- Object
- Decidim::Comments::VoteCommentResolver
- Defined in:
- app/resolvers/decidim/comments/vote_comment_resolver.rb
Overview
A GraphQL resolver to handle ‘upVote` and `downVote` mutations It creates a vote for a comment by the current user.
Instance Method Summary collapse
- #call(obj, _args, ctx) ⇒ Object
-
#initialize(options = { weight: 1 }) ⇒ VoteCommentResolver
constructor
A new instance of VoteCommentResolver.
Constructor Details
#initialize(options = { weight: 1 }) ⇒ VoteCommentResolver
Returns a new instance of VoteCommentResolver.
7 8 9 |
# File 'app/resolvers/decidim/comments/vote_comment_resolver.rb', line 7 def initialize( = { weight: 1 }) @weight = [:weight] end |
Instance Method Details
#call(obj, _args, ctx) ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/resolvers/decidim/comments/vote_comment_resolver.rb', line 11 def call(obj, _args, ctx) Decidim::Comments::VoteComment.call(obj, ctx[:current_user], weight: @weight) do on(:ok) do |comment| return comment end end end |