def resolve(where: {}, order_by: {'field': 'updated_at', 'direction': 'desc'})
order_by.symbolize_keys!
[context[:current_user]] unless context[:current_user].has_capability?(self.class.name.demodulize)
cap_belongs_to = context[:current_user].determine_capability_belongs_to(self.class.name.demodulize)
users = if cap_belongs_to[:direct] || context[:current_user].user_type == 'SuperAdmin'
context[:tenant].users.includes([:groups, :roles]).where(where).order("#{order_by[:field]} #{order_by[:direction]}")
elsif cap_belongs_to[:group].present?
context[:tenant].groups.where(cap_belongs_to['group']).map(&:users).flatten
else
[context[:current_user]]
end
stored_user_contents = (UserContent.select("DISTINCT ON (user_id) user_contents.*"))
users.to_a
missing_user_content_ids = users.ids - stored_user_contents.pluck(:user_id)
missing_user_contents = missing_user_content_ids.map do |user_id|
UserContent.new(user_id: user_id, on_fly: true)
end
in the above code if i remove
users.to_a
from code then i am getting
undefined method `ids’ for [#<User id:..] error why ?
how to solve above, bellow is my graphql query
expected is valid result but getting error in my code..
query usersaa {
users {
totalCount
edges {
node {
id
fullName
firstName
lastName
userType
email
deletedAt
createdAt
updatedAt
profileImageUrl
unconfirmedEmail
courses {
edges {
status
node {
id
title
}
}
}
}
}
}
}