Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/jira_import_data.rb')
-rw-r--r--app/models/jira_import_data.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/models/jira_import_data.rb b/app/models/jira_import_data.rb
new file mode 100644
index 00000000000..3f882deb24d
--- /dev/null
+++ b/app/models/jira_import_data.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class JiraImportData < ProjectImportData
+ JiraProjectDetails = Struct.new(:key, :scheduled_at, :scheduled_by)
+
+ def projects
+ return [] unless data
+
+ projects = data.dig('jira', 'projects').map do |p|
+ JiraProjectDetails.new(p['key'], p['scheduled_at'], p['scheduled_by'])
+ end
+ projects.sort_by { |jp| jp.scheduled_at }
+ end
+
+ def <<(project)
+ self.data ||= { jira: { projects: [] } }
+ self.data['jira']['projects'] << project.to_h.deep_stringify_keys!
+ end
+end