diff --git a/server/graphql/v2/query/collection/AccountsCollectionQuery.ts b/server/graphql/v2/query/collection/AccountsCollectionQuery.ts index cfbeabd68c3..7ada5e554a8 100644 --- a/server/graphql/v2/query/collection/AccountsCollectionQuery.ts +++ b/server/graphql/v2/query/collection/AccountsCollectionQuery.ts @@ -30,6 +30,11 @@ export const CommonAccountsCollectionQueryArgs = { type: GraphQLBoolean, description: 'Included collectives which are archived', }, + skipGuests: { + type: GraphQLBoolean, + description: 'Included collectives which are archived', + defaultValue: true, + }, isActive: { type: GraphQLBoolean, description: 'Only return "active" accounts with Financial Contributions enabled if true.', @@ -54,6 +59,10 @@ const AccountsCollectionQuery = { type: new GraphQLList(GraphQLAccountReferenceInput), description: 'Host hosting the account', }, + parent: { + type: new GraphQLList(GraphQLAccountReferenceInput), + description: 'Host hosting the account', + }, type: { type: new GraphQLList(GraphQLAccountType), description: @@ -81,10 +90,8 @@ const AccountsCollectionQuery = { const { offset, limit } = args; const cleanTerm = args.searchTerm?.trim(); - let hostCollectiveIds; - if (args.host) { - hostCollectiveIds = await fetchAccountsIdsWithReference(args.host); - } + const hostCollectiveIds = args.host && (await fetchAccountsIdsWithReference(args.host)); + const parentCollectiveIds = args.parent && (await fetchAccountsIdsWithReference(args.parent)); const includeVendorsForHostId = args.includeVendorsForHost ? await fetchAccountWithReference(args.includeVendorsForHost).then(({ id }) => id) @@ -93,11 +100,12 @@ const AccountsCollectionQuery = { const extraParameters = { orderBy: args.orderBy || { field: 'RANK', direction: 'DESC' }, types: args.type?.length ? args.type.map(value => AccountTypeToModelMapping[value]) : null, - hostCollectiveIds: hostCollectiveIds, - parentCollectiveIds: null, + hostCollectiveIds, + parentCollectiveIds, isHost: args.isHost ? true : null, onlyActive: args.isActive ? true : null, skipRecentAccounts: args.skipRecentAccounts, + skipGuests: args.skipGuests, hasCustomContributionsEnabled: args.hasCustomContributionsEnabled, countries: args.country, tags: args.tag,