radar/twist-v2

View on GitHub
backend/lib/twist/web/graphql/resolvers/books.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Twist
  module Web
    module GraphQL
      module Resolvers
        class Books < Resolver
          def resolve
            books = context[:book_repo].all
            books.select do |book|
              authorization = Authorization::Book.new(
                book: book,
                user: current_user,
                permission_repo: context[:permission_repo],
              )
              authorization.success?
            end
          end
        end
      end
    end
  end
end