From 9059b8d5169002fd9f4c195da41487821ced1d1f Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Fri, 10 May 2019 17:44:07 +0200 Subject: [PATCH] only show findable dois. --- app/graphql/lupo_schema.rb | 3 +++ app/graphql/types/query_type.rb | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/graphql/lupo_schema.rb b/app/graphql/lupo_schema.rb index 0de3cf4bf..1545a1c3e 100644 --- a/app/graphql/lupo_schema.rb +++ b/app/graphql/lupo_schema.rb @@ -1,6 +1,9 @@ # frozen_string_literal: true class LupoSchema < GraphQL::Schema + default_max_page_size 100 + max_depth 5 + # mutation(Types::MutationType) query(Types::QueryType) end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index edc9800e0..dcf7a2b7d 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -106,7 +106,7 @@ def organization(id:) end def datasets(query: nil, first: nil) - Doi.query(query, resource_type_id: "Dataset", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Dataset", state: "findable", page: { number: 1, size: first }) end field :dataset, DatasetType, null: false do @@ -124,7 +124,7 @@ def dataset(id:) end def publications(query: nil, first: nil) - Doi.query(query, resource_type_id: "Text", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Text", state: "findable", page: { number: 1, size: first }) end field :publication, PublicationType, null: false do @@ -142,7 +142,7 @@ def publication(id:) end def audiovisuals(query: nil, first: nil) - Doi.query(query, resource_type_id: "Audiovisual", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Audiovisual", state: "findable", page: { number: 1, size: first }) end field :audiovisual, AudiovisualType, null: false do @@ -160,7 +160,7 @@ def audiovisual(id:) end def collections(query: nil, first: nil) - Doi.query(query, resource_type_id: "Collection", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Collection", state: "findable", page: { number: 1, size: first }) end field :collection, CollectionType, null: false do @@ -178,7 +178,7 @@ def collection(id:) end def data_papers(query: nil, first: nil) - Doi.query(query, resource_type_id: "DataPaper", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "DataPaper", state: "findable", page: { number: 1, size: first }) end field :data_paper, DataPaperType, null: false do @@ -196,7 +196,7 @@ def data_paper(id:) end def events(query: nil, first: nil) - Doi.query(query, resource_type_id: "Event", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Event", state: "findable", page: { number: 1, size: first }) end field :event, EventType, null: false do @@ -214,7 +214,7 @@ def event(id:) end def images(query: nil, first: nil) - Doi.query(query, resource_type_id: "Image", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Image", state: "findable", page: { number: 1, size: first }) end field :image, ImageType, null: false do @@ -232,7 +232,7 @@ def image(id:) end def interactive_resources(query: nil, first: nil) - Doi.query(query, resource_type_id: "InteractiveResource", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "InteractiveResource", state: "findable", page: { number: 1, size: first }) end field :interactive_resource, InteractiveResourceType, null: false do @@ -250,7 +250,7 @@ def interactive_resource(id:) end def models(query: nil, first: nil) - Doi.query(query, resource_type_id: "Model", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Model", state: "findable", page: { number: 1, size: first }) end field :model, ModelType, null: false do @@ -268,7 +268,7 @@ def model(id:) end def physical_objects(query: nil, first: nil) - Doi.query(query, resource_type_id: "PhysicalObject", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "PhysicalObject", state: "findable", page: { number: 1, size: first }) end field :physical_object, PhysicalObjectType, null: false do @@ -286,7 +286,7 @@ def physical_object(id:) end def services(query: nil, first: nil) - Doi.query(query, resource_type_id: "Service", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Service", state: "findable", page: { number: 1, size: first }) end field :service, ServiceType, null: false do @@ -304,7 +304,7 @@ def service(id:) end def softwares(query: nil, first: nil) - Doi.query(query, resource_type_id: "Software", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Software", state: "findable", page: { number: 1, size: first }) end field :software, SoftwareType, null: false do @@ -322,7 +322,7 @@ def software(id:) end def sounds(query: nil, first: nil) - Doi.query(query, resource_type_id: "Sound", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Sound", state: "findable", page: { number: 1, size: first }) end field :sound, SoundType, null: false do @@ -340,7 +340,7 @@ def sound(id:) end def workflows(query: nil, first: nil) - Doi.query(query, resource_type_id: "Workflow", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Workflow", state: "findable", page: { number: 1, size: first }) end field :workflow, WorkflowType, null: false do @@ -358,7 +358,7 @@ def workflow(id:) end def others(query: nil, first: nil) - Doi.query(query, resource_type_id: "Other", page: { number: 1, size: first }) + Doi.query(query, resource_type_id: "Other", state: "findable", page: { number: 1, size: first }) end field :other, OtherType, null: false do