diff --git a/src/github/entities/db-insight.entity.ts b/src/github/entities/db-insight.entity.ts index 98a3080..488e199 100644 --- a/src/github/entities/db-insight.entity.ts +++ b/src/github/entities/db-insight.entity.ts @@ -10,7 +10,7 @@ export interface DbInsight { repos: DbUserInsightRepo[]; } -interface DbUserInsightRepo { +export interface DbUserInsightRepo { readonly id: number; readonly insight_id: number; readonly repo_id: number; diff --git a/src/social-card/insight-card/insight-card.service.ts b/src/social-card/insight-card/insight-card.service.ts index 86afafb..d8c73ee 100644 --- a/src/social-card/insight-card/insight-card.service.ts +++ b/src/social-card/insight-card/insight-card.service.ts @@ -9,7 +9,7 @@ import tailwindConfig from "../templates/tailwind.config"; import { firstValueFrom } from "rxjs"; import { RequiresUpdateMeta } from "../user-card/user-card.service"; -import { DbInsight } from "../../github/entities/db-insight.entity"; +import { DbInsight, DbUserInsightRepo } from "../../github/entities/db-insight.entity"; import insightCardTemplate from "../templates/insight-card.template"; import insightRepos from "../templates/shared/insight-repos"; import insightContributors from "../templates/shared/insight-contributors"; @@ -34,12 +34,16 @@ export class InsightCardService { private async getInsightData (insightId: number): Promise { const maxRepoQueryIdsLenght = 10; - const insightPageReq = await firstValueFrom( - this.httpService.get(`${process.env.API_BASE_URL!}/v2/insights/${insightId}`), + const insightPageApiReq = firstValueFrom( + this.httpService.get(`${process.env.API_BASE_URL!}/v2/insights/${insightId}?include=none`), ); + const insightReposApiReq = firstValueFrom( + this.httpService.get(`${process.env.API_BASE_URL!}/v2/insights/${insightId}/repos`), + ); + const [insightPageReq, insightReposReq] = await Promise.all([insightPageApiReq, insightReposApiReq]); - const { repos, name, updated_at } = insightPageReq.data; - + const { name, updated_at } = insightPageReq.data; + const { data: repos } = insightReposReq; const query = (new URLSearchParams); query.set(