BigW Consortium Gitlab

Commit de6c44e9 by James Lopez

using new config

parent acfa0b69
......@@ -11,27 +11,11 @@ module Projects
end
def project_tree
%i(issues labels milestones releases events) + [snippets, members, merge_requests, commit_statuses]
Projects::ImportExport::ImportExportReader.project_tree
end
private
def snippets
{ snippets: { except: :expired_at } }
end
def merge_requests
{ merge_requests: { include: :merge_request_diff } }
end
def commit_statuses
{ commit_statuses: { include: :commit } }
end
def members
{ project_members: { include: [user: { only: [:id, :email, :username] }] } }
end
def storage_path
File.join(Settings.shared['path'], 'tmp/project_exports')
end
......
......@@ -28,4 +28,8 @@
:user:
- :id
- :email
- :username
\ No newline at end of file
- :username
:attributes_except:
:snippets:
- :expired_at
\ No newline at end of file
......@@ -26,7 +26,14 @@ module Projects
end
def build_hash(array)
array.map { |el| el.is_a?(Hash) ? process_include(el) : el }
array.map do |el|
if el.is_a?(Hash)
process_include(el)
else
only_except_hash = check_only_and_except(el)
only_except_hash.empty? ? el : { el => only_except_hash }
end
end
end
def process_include(hash, included_classes_hash = {})
......@@ -44,8 +51,8 @@ module Projects
def process_current_class(hash, included_classes_hash, value)
value = value.is_a?(Hash) ? process_include(hash, included_classes_hash) : value
current_key = hash.keys.first
current_key_only = check_only_and_except(current_key)
included_classes_hash[current_key] ||= current_key_only unless current_key_only.empty?
only_except_hash = check_only_and_except(current_key)
included_classes_hash[current_key] ||= only_except_hash unless only_except_hash.empty?
return current_key, value
end
......@@ -56,8 +63,8 @@ module Projects
end
def add_class(current_key, included_classes_hash, value)
check_only_hash = check_only_and_except(value)
value = { value => check_only_hash } unless check_only_hash.empty?
only_except_hash = check_only_and_except(value)
value = { value => only_except_hash } unless only_except_hash.empty?
old_values = included_classes_hash[current_key][:include]
included_classes_hash[current_key][:include] = ([old_values] + [value]).compact.flatten
end
......
......@@ -32,7 +32,7 @@ module Projects
def project_json_tree
# TODO confirm children, also add subchildren (i.e comments)
# TODO confirm atts for children
@project.to_json(only: ImportExport.project_atts, include: ImportExport.project_tree)
@project.to_json(Projects::ImportExport.project_tree)
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