Commit 665afdd1 authored by João Cunha's avatar João Cunha

Refactor BulkImport graphql queriable methods

Removes some code duplication.
I've created the BulkImports::Projects::Graphql::Queriable module
to support some boilerplate method definition on some of the
BulkImports::Projects::Graphql/* files
parent 6695bf1c
...@@ -4,6 +4,7 @@ module BulkImports ...@@ -4,6 +4,7 @@ module BulkImports
module Projects module Projects
module Graphql module Graphql
module GetProjectQuery module GetProjectQuery
extend Queryable
extend self extend self
def to_s def to_s
...@@ -28,22 +29,6 @@ module BulkImports ...@@ -28,22 +29,6 @@ module BulkImports
} }
GRAPHQL GRAPHQL
end end
def variables(context)
{ full_path: context.entity.source_full_path }
end
def base_path
%w[data project]
end
def data_path
base_path
end
def page_info_path
base_path << 'page_info'
end
end end
end end
end end
......
...@@ -4,6 +4,7 @@ module BulkImports ...@@ -4,6 +4,7 @@ module BulkImports
module Projects module Projects
module Graphql module Graphql
module GetRepositoryQuery module GetRepositoryQuery
extend Queryable
extend self extend self
def to_s def to_s
...@@ -15,22 +16,6 @@ module BulkImports ...@@ -15,22 +16,6 @@ module BulkImports
} }
GRAPHQL GRAPHQL
end end
def variables(context)
{ full_path: context.entity.source_full_path }
end
def base_path
%w[data project]
end
def data_path
base_path
end
def page_info_path
base_path << 'page_info'
end
end end
end end
end end
......
# frozen_string_literal: true
module BulkImports
module Projects
module Graphql
module Queryable
def variables(context)
{ full_path: context.entity.source_full_path }
end
def base_path
%w[data project]
end
def data_path
base_path
end
def page_info_path
base_path << 'page_info'
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment