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

feat: Upgrade to v2 API #76

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading