Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new project and group importer for organizations #3598

Merged
merged 2 commits into from Nov 30, 2023

Conversation

shreddedbacon
Copy link
Member

@shreddedbacon shreddedbacon commented Nov 19, 2023

General Checklist

  • Affected Issues have been mentioned in the Closing issues section
  • Documentation has been written/updated
  • PR title is ready for inclusion in changelog

Database Migrations

  • If your PR contains a database migation, it MUST be the latest in date order alphabetically

This adds a new query and mutation for helping with importing a project, and all associated groups into an organization.

The new query is called checkBulkImportProjectsAndGroupsToOrganization and it will return lists of all the projects and groups that would be imported into the organization. The payload allows an administrator to verify that the correct projects and groups would be imported. Giving the administrator time to verify the imported projects and groups and either remove, or add anything that may be missing, then run the query again.

This query also returns a second list of projects and groups, but it will contain anything in there that indicates a project or group has already been moved into a completely different organization, which would result in the import failing.

The new mutation is called bulkImportProjectsAndGroupsToOrganization and will perform the changes that checkBulkImportProjectsAndGroupsToOrganization outputs. There is the option of also detaching all notifications from all projects within the import. Otherwise existing notifications will remain attached to the projects, but the organization owners will only ever be able to remove these from their projects, because the main notification object will be owned by the platform (the way notifications always were before). The platform defined notifcations themselves will NOT be imported, as there could be the possibility that this is shared across multiple organizations, which is not supported by the organization model.

It marks all the previous importing queries and mutations as deprecated, and their usage is discouraged.

@shreddedbacon shreddedbacon added this to the 2.16.1 milestone Nov 19, 2023
@shreddedbacon shreddedbacon marked this pull request as ready for review November 19, 2023 23:38
Co-authored-by: Toby Bellwood <toby.bellwood@amazee.io>
@tobybellwood
Copy link
Member

Sample check query:

query checkBulkImportProjectsAndGroupsToOrganization {
	checkBulkImportProjectsAndGroupsToOrganization(
		input: { project: 1, organization: 1 }
	) {
		projects {id, name}
		groups { id, name }
		otherOrgProjects { id, name }
		otherOrgGroups { id, name }
	}
}

Copy link
Member

@tobybellwood tobybellwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised, tested against a few edge cases

@tobybellwood tobybellwood merged commit 30f7a58 into main Nov 30, 2023
1 check passed
@tobybellwood tobybellwood deleted the organization-project-group-associations branch November 30, 2023 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants