Commit 98c02d63 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'jh-bulk_import_docs' into 'master'

Add class documentation for the bulk import models

See merge request gitlab-org/gitlab!45414
parents 2c780291 7166b5e1
# frozen_string_literal: true
# The BulkImport import model links together all the models required to for a
# bulk import of groups and projects to a GitLab instance, and associates these
# with the user that initiated the import.
class BulkImport < ApplicationRecord
belongs_to :user, optional: false
......
# frozen_string_literal: true
# Stores the authentication data required to access another GitLab instance on
# behalf of a user, to import Groups and Projects directly from that instance.
class BulkImports::Configuration < ApplicationRecord
self.table_name = 'bulk_import_configurations'
......
# frozen_string_literal: true
# The BulkImport::Entity represents a Group or Project that is going to be
# imported during the bulk import process. An entity is nested under the a
# parent group when it is not a top level group.
#
# A full bulk import entity structure might look like this, where the links are
# parents:
#
# **Before Import** **After Import**
#
# GroupEntity Group
# | | | |
# GroupEntity ProjectEntity Group Project
# | |
# ProjectEntity Project
#
# The tree structure of the entities will result in the same structure for the
# imported Groups and Projects.
class BulkImports::Entity < ApplicationRecord
self.table_name = 'bulk_import_entities'
......@@ -33,11 +50,17 @@ class BulkImports::Entity < ApplicationRecord
def validate_imported_entity_type
if group.present? && project_entity?
errors.add(:group, s_('BulkImport|expected an associated Project but has an associated Group'))
errors.add(
:group,
s_('BulkImport|expected an associated Project but has an associated Group')
)
end
if project.present? && group_entity?
errors.add(:project, s_('BulkImport|expected an associated Group but has an associated Project'))
errors.add(
:project,
s_('BulkImport|expected an associated Group but has an associated Project')
)
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