diff --git a/app/graphql/resolvers/project_samples_resolver.rb b/app/graphql/resolvers/project_samples_resolver.rb index b4d4480315..be14667668 100644 --- a/app/graphql/resolvers/project_samples_resolver.rb +++ b/app/graphql/resolvers/project_samples_resolver.rb @@ -16,7 +16,7 @@ class ProjectSamplesResolver < BaseResolver default_value: nil def resolve(filter:, order_by:) - ransack_obj = Sample.where(project_id: project.id).ransack(filter&.to_h) + ransack_obj = project.samples.ransack(filter&.to_h) ransack_obj.sorts = ["#{order_by.field} #{order_by.direction}"] if order_by.present? ransack_obj.result diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index a0af807540..1c6bb18fe5 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -42,14 +42,5 @@ def self.authorized?(object, context) context: { user: context[:current_user], token: context[:token] } ) end - - def self.scope_items(items, context) - scope = authorized_scope Project, type: :relation, - context: { user: context[:current_user], token: context[:token] } - project_ids = items.pluck(:id) - scope.where(id: project_ids).in_order_of(:id, project_ids) - end - - reauthorize_scoped_objects(false) end end diff --git a/app/graphql/types/sample_type.rb b/app/graphql/types/sample_type.rb index 77e9401e66..41f08bf8e4 100644 --- a/app/graphql/types/sample_type.rb +++ b/app/graphql/types/sample_type.rb @@ -36,14 +36,5 @@ def self.authorized?(object, context) context: { user: context[:current_user], token: context[:token] } ) end - - def self.scope_items(items, context) - scope = authorized_scope Project, type: :relation, - context: { user: context[:current_user], token: context[:token] } - sample_ids = items.pluck(:id) - Sample.where(id: sample_ids, project_id: scope.select(:id)).in_order_of(:id, sample_ids) - end - - reauthorize_scoped_objects(false) end end