add subjects and reviwers query
This commit is contained in:
17
app/graphql/resolvers/reviewers_query_resolver.rb
Normal file
17
app/graphql/resolvers/reviewers_query_resolver.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
module Resolvers
|
||||
class ReviewersQueryResolver
|
||||
def initialize(context)
|
||||
@context = context
|
||||
end
|
||||
|
||||
def resolve
|
||||
UserPolicy::Scope.new(@context[:current_user], User)
|
||||
.resolve
|
||||
.joins(:roles)
|
||||
.where(roles: { name: %i[teacher nde] })
|
||||
.where.not(id: @context[:current_user].id)
|
||||
.distinct
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user