Skip to content

Commit

Permalink
Merge pull request #3562 from uselagoon/organizationById_update
Browse files Browse the repository at this point in the history
Change: Updated argument naming organizationByID
  • Loading branch information
tobybellwood authored Oct 10, 2023
2 parents 893c1cb + 246e967 commit 06f6da1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions node-packages/commons/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1256,10 +1256,10 @@ export const getEnvironmentsForProject = (
}
`);

export async function getOrganizationById(organization: number): Promise<any> {
export async function getOrganizationById(id: number): Promise<any> {
const result = await graphqlapi.query(`
{
organization:organizationById(organization: ${organization}) {
organization:organizationById(id: ${id}) {
id
name
friendlyName
Expand All @@ -1282,7 +1282,7 @@ export async function getOrganizationById(organization: number): Promise<any> {
`);

if (!result || !result.organization) {
throw new OrganizationNotFound(`Cannot find organization ${organization}`);
throw new OrganizationNotFound(`Cannot find organization ${id}`);
}

return result.organization;
Expand Down
10 changes: 5 additions & 5 deletions services/api/src/resources/organization/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,17 @@ export const updateOrganization: ResolverFn = async (
};

export const getOrganizationById: ResolverFn = async (
organization,
id,
args,
{ sqlClientPool, hasPermission }
) => {
let oid = args.organization;
if (organization) {
oid = organization;
let oid = args.id;
if (id) {
oid = id;
}

await hasPermission('organization', 'view', {
organization: oid,
organization: oid,
});

const rows = await query(sqlClientPool, Sql.selectOrganization(oid));
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ const typeDefs = gql`
"""
Get an organization by its ID
"""
organizationById(organization: Int!): Organization
organizationById(id: Int!): Organization
organizationByName(name: String!): Organization
getGroupProjectOrganizationAssociation(input: AddGroupInput!): String
getProjectGroupOrganizationAssociation(input: ProjectOrgGroupsInput!): String
Expand Down

0 comments on commit 06f6da1

Please sign in to comment.