diff --git a/local-dev/api-data-watcher-pusher/api-data/04-populate-api-data-organizations.gql b/local-dev/api-data-watcher-pusher/api-data/04-populate-api-data-organizations.gql index 3d45db9137..69c5126291 100644 --- a/local-dev/api-data-watcher-pusher/api-data/04-populate-api-data-organizations.gql +++ b/local-dev/api-data-watcher-pusher/api-data/04-populate-api-data-organizations.gql @@ -44,7 +44,7 @@ mutation PopulateApi { id } - UIOrganizationGroup: addGroup( + UIOrganizationGroup: addGroupToOrganization( input: { name: "organization-group1", organization: 1} ) { id diff --git a/services/api/src/resolvers.js b/services/api/src/resolvers.js index 43caeab7b2..42ad902c79 100644 --- a/services/api/src/resolvers.js +++ b/services/api/src/resolvers.js @@ -261,7 +261,7 @@ const { getProjectsByOrganizationId, addProjectToOrganization, removeProjectFromOrganization, - addGroupToOrganization, + addExistingGroupToOrganization, getGroupsByOrganizationsProject, getGroupCountByOrganizationProject, getProjectGroupOrganizationAssociation, // WIP resolver @@ -706,7 +706,8 @@ const resolvers = { addOrganization, updateOrganization, deleteOrganization, - addGroupToOrganization, + addGroupToOrganization: addGroup, + addExistingGroupToOrganization, addProjectToOrganization, removeProjectFromOrganization, addDeployTargetToOrganization, diff --git a/services/api/src/resources/organization/resolvers.ts b/services/api/src/resources/organization/resolvers.ts index 39617688a4..09b50ef4f1 100644 --- a/services/api/src/resources/organization/resolvers.ts +++ b/services/api/src/resources/organization/resolvers.ts @@ -866,7 +866,7 @@ export const getGroupProjectOrganizationAssociation: ResolverFn = async ( // add an existing group to an organization // this function will return errors if there are projects in the group that are not in the organization // if there are no projects in the organization, and no projects in the group then it will succeed -export const addGroupToOrganization: ResolverFn = async ( +export const addExistingGroupToOrganization: ResolverFn = async ( _root, { input }, { models, sqlClientPool, hasPermission, userActivityLogger } diff --git a/services/api/src/typeDefs.js b/services/api/src/typeDefs.js index 0ee725017e..c54805b1ee 100644 --- a/services/api/src/typeDefs.js +++ b/services/api/src/typeDefs.js @@ -1077,7 +1077,7 @@ const typeDefs = gql` deployTargets: [Openshift] projects: [OrgProject] environments: [OrgEnvironment] - groups: [GroupInterface] + groups: [OrgGroupInterface] owners: [OrgUser] notifications(type: NotificationType): [Notification] } @@ -1121,7 +1121,7 @@ const typeDefs = gql` id: Int name: String organization: Int - groups: [GroupInterface] + groups: [OrgGroupInterface] groupCount: Int notifications: [OrganizationNotification] } @@ -1417,7 +1417,7 @@ const typeDefs = gql` """ organizationById(id: Int!): Organization organizationByName(name: String!): Organization - getGroupProjectOrganizationAssociation(input: AddGroupInput!): String + getGroupProjectOrganizationAssociation(input: AddGroupToOrganizationInput!): String getProjectGroupOrganizationAssociation(input: ProjectOrgGroupsInput!): String getEnvVariablesByProjectEnvironmentName(input: EnvVariableByProjectEnvironmentNameInput!): [EnvKeyValue] } @@ -2176,7 +2176,12 @@ const typeDefs = gql` input AddGroupInput { name: String! parentGroup: GroupInput - organization: Int + } + + input AddGroupToOrganizationInput { + name: String! + organization: Int! + parentGroup: GroupInput addOrgOwner: Boolean } @@ -2420,7 +2425,11 @@ const typeDefs = gql` """ Add a group to an organization """ - addGroupToOrganization(input: AddGroupInput!): GroupInterface + addGroupToOrganization(input: AddGroupToOrganizationInput!): OrgGroupInterface + """ + Add an existing group to an organization + """ + addExistingGroupToOrganization(input: AddGroupToOrganizationInput!): OrgGroupInterface """ Add a project to an organization, will return an error if it can't easily do it """