mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
feat: include sub groups in report generation
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Api} from '@openstapps/gitlab-api';
|
||||
import {Project} from '@openstapps/gitlab-api/lib/types';
|
||||
import {Group, Project} from '@openstapps/gitlab-api/lib/types';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {asyncPool} from 'async-pool-native/dist/async-pool';
|
||||
import {readFile, unlink, writeFile} from 'fs';
|
||||
@@ -45,6 +45,18 @@ export async function getProjects(api: Api, groups: number[]): Promise<Project[]
|
||||
return projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subgroups for a list of groups
|
||||
*
|
||||
* @param api GitLab API to make requests with
|
||||
* @param groups List of groups
|
||||
*/
|
||||
export async function getSubGroups(api: Api, groups: number[]): Promise<Group[]> {
|
||||
return flatten2dArray(await asyncPool(2, groups, async (groupId) => {
|
||||
return await api.getSubGroupsForGroup(groupId);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten 2d array
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user