From 7f3ef02d5684f2d8cdf017e8992cdb71739e8d51 Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Tue, 1 Oct 2024 10:12:18 +0530 Subject: [PATCH 1/5] fix caching --- app/(hacktoberfest)/oss-issues/page.tsx | 14 +- app/api/github-webook/route.ts | 41 ++ lib/github/hooks/bounty.ts | 366 +++++----- lib/github/hooks/cache.ts | 18 + lib/github/hooks/installation.ts | 15 +- lib/github/hooks/issue.ts | 862 ++++++++++++------------ lib/github/index.ts | 76 ++- lib/github/service.ts | 51 +- lib/github/utils.ts | 8 +- pages/api/github-webhook.ts | 52 -- types/issue.ts | 5 +- 11 files changed, 755 insertions(+), 753 deletions(-) create mode 100644 app/api/github-webook/route.ts create mode 100644 lib/github/hooks/cache.ts delete mode 100644 pages/api/github-webhook.ts diff --git a/app/(hacktoberfest)/oss-issues/page.tsx b/app/(hacktoberfest)/oss-issues/page.tsx index 03ec515..9f53398 100644 --- a/app/(hacktoberfest)/oss-issues/page.tsx +++ b/app/(hacktoberfest)/oss-issues/page.tsx @@ -1,19 +1,21 @@ -import { getAllOssGgIssuesOfRepos } from "@/lib/github/service"; +import { getOssIssuesForRepo } from "@/lib/github/service"; import { getAllRepositories } from "@/lib/repository/service"; import { TPullRequest } from "@/types/pullRequest"; import Link from "next/link"; export default async function IssuesPage() { const ossGgRepositories = await getAllRepositories(); - const pullRequests: TPullRequest[] = await getAllOssGgIssuesOfRepos( - ossGgRepositories.map((repo) => ({ id: repo.githubId, fullName: `${repo.owner}/${repo.name}` })) - ); + const issues: TPullRequest[] = ( + await Promise.all( + ossGgRepositories.map((repo) => getOssIssuesForRepo(repo.githubId, `${repo.owner}/${repo.name}`)) + ) + ).flat(); return (
-

available issues ({pullRequests.length})

+

available issues ({issues.length})