2022-01-26 12:08:38 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module BulkImports
|
|
|
|
module Projects
|
|
|
|
module Graphql
|
2022-04-04 11:22:00 +05:30
|
|
|
class GetSnippetRepositoryQuery
|
|
|
|
include Queryable
|
2022-01-26 12:08:38 +05:30
|
|
|
|
|
|
|
def to_s
|
|
|
|
<<-'GRAPHQL'
|
|
|
|
query($full_path: ID!) {
|
|
|
|
project(fullPath: $full_path) {
|
|
|
|
snippets {
|
|
|
|
page_info: pageInfo {
|
|
|
|
next_page: endCursor
|
|
|
|
has_next_page: hasNextPage
|
|
|
|
}
|
|
|
|
nodes {
|
|
|
|
title
|
|
|
|
createdAt
|
|
|
|
httpUrlToRepo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GRAPHQL
|
|
|
|
end
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
def variables
|
2022-01-26 12:08:38 +05:30
|
|
|
{
|
|
|
|
full_path: context.entity.source_full_path,
|
|
|
|
cursor: context.tracker.next_page,
|
|
|
|
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def base_path
|
|
|
|
%w[data project snippets]
|
|
|
|
end
|
|
|
|
|
|
|
|
def data_path
|
|
|
|
base_path << 'nodes'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|