Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
feat: Upgrade to v2 API
Browse files Browse the repository at this point in the history
Signed-off-by: John McBride <[email protected]>
  • Loading branch information
jpmcb committed Jan 24, 2024
1 parent 5df0d42 commit 36b73e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/social-card/highlight-card/highlight-card.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ export class HighlightCardService {
private readonly httpService: HttpService,
private readonly githubService: GithubService,
private readonly s3FileStorageService: S3FileStorageService,
) {}
) { }

private async getHighlightData (highlightId: number): Promise<HighlightCardData> {
const highlightReq = firstValueFrom(
this.httpService.get<DbUserHighlight>(`${process.env.API_BASE_URL!}/v1/user/highlights/${highlightId}`),
this.httpService.get<DbUserHighlight>(`${process.env.API_BASE_URL!}/v2/user/highlights/${highlightId}`),
);

const reactionsReq = firstValueFrom(
this.httpService.get<DbReaction[]>(`${process.env.API_BASE_URL!}/v1/highlights/${highlightId}/reactions`),
this.httpService.get<DbReaction[]>(`${process.env.API_BASE_URL!}/v2/highlights/${highlightId}/reactions`),
);

const [highlight, highlightReactions] = await Promise.all([highlightReq, reactionsReq]);
Expand Down
6 changes: 3 additions & 3 deletions src/social-card/insight-card/insight-card.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export class InsightCardService {
private readonly httpService: HttpService,
private readonly githubService: GithubService,
private readonly s3FileStorageService: S3FileStorageService,
) {}
) { }

private async getInsightData (insightId: number): Promise<InsightCardData> {
const maxRepoQueryIdsLenght = 10;

const insightPageReq = await firstValueFrom(
this.httpService.get<DbInsight>(`${process.env.API_BASE_URL!}/v1/insights/${insightId}`),
this.httpService.get<DbInsight>(`${process.env.API_BASE_URL!}/v2/insights/${insightId}`),
);

const { repos, name, updated_at } = insightPageReq.data;
Expand All @@ -52,7 +52,7 @@ export class InsightCardService {

const contributorsReq = await firstValueFrom(
this.httpService.get<{ data: { author_login: string }[] }>(
`${process.env.API_BASE_URL!}/v1/contributors/search?${String(query)}`,
`${process.env.API_BASE_URL!}/v2/contributors/search?${String(query)}`,
),
);

Expand Down

0 comments on commit 36b73e9

Please sign in to comment.