Skip to content

Commit 120f7bc

Browse files
committed
chore: use groupBy from common lib
Signed-off-by: Uroš Marolt <[email protected]>
1 parent 739fdeb commit 120f7bc

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

  • services/libs/data-access-layer/src/repositories

services/libs/data-access-layer/src/repositories/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { groupBy } from '@crowd/common'
12
import { Logger } from '@crowd/logging'
23
import { RedisCache, RedisClient } from '@crowd/redis'
34

@@ -591,12 +592,7 @@ export async function getReposGroupedByOrg(
591592
integrationId: string,
592593
): Promise<Record<string, IGithubRepoForIntegration[]>> {
593594
const repos = await getReposForGithubIntegration(qx, integrationId)
594-
const grouped: Record<string, IGithubRepoForIntegration[]> = {}
595-
for (const repo of repos) {
596-
if (!grouped[repo.owner]) grouped[repo.owner] = []
597-
grouped[repo.owner].push(repo)
598-
}
599-
return grouped
595+
return Object.fromEntries(groupBy(repos, (repo) => repo.owner))
600596
}
601597

602598
/**

0 commit comments

Comments
 (0)