diff --git a/apps/web/components/apps/AllApps.tsx b/apps/web/components/apps/AllApps.tsx
index 31e6eb5373..ccc16f9817 100644
--- a/apps/web/components/apps/AllApps.tsx
+++ b/apps/web/components/apps/AllApps.tsx
@@ -19,6 +19,7 @@ export default function AllApps({ apps }: { apps: App[] }) {
logo={app.logo}
rating={app.rating}
reviews={app.reviews}
+ installs={app.installs}
/>
))}
diff --git a/apps/web/components/apps/AppCard.tsx b/apps/web/components/apps/AppCard.tsx
index 2512e786d8..a6a56e52c7 100644
--- a/apps/web/components/apps/AppCard.tsx
+++ b/apps/web/components/apps/AppCard.tsx
@@ -11,9 +11,12 @@ interface AppCardProps {
description: string;
rating: number;
reviews?: number;
+ installs?: number;
}
export default function AppCard(props: AppCardProps) {
+ console.log("🚀 ~ file: AppCard.tsx ~ line 16 ~ installs", props.installs);
+
return (
{
- const appStore = await getAppRegistry();
+ const appMetaData = await getAppRegistry();
- const categoryQuery = await prisma.app.findMany({
+ const appsQuery = await prisma.app.findMany({
select: {
+ slug: true,
categories: true,
+ _count: {
+ select: {
+ credentials: true,
+ },
+ },
},
});
- const categories = categoryQuery.reduce((c, app) => {
- for (const category of app.categories) {
+ console.log("🚀 ~ file: index.tsx ~ line 40 ~ getStaticProps ~ appsQuery", appsQuery);
+
+ const appStore = appMetaData.map((app) => {
+ const installs = appsQuery.filter((query) => query.slug === app.slug);
+ console.log("🚀 ~ file: index.tsx ~ line 45 ~ appStore ~ installs", installs[0]._count.credentials);
+
+ return { ...app, installs: installs[0]._count.credentials };
+ });
+
+ const categoriesArray = appsQuery.map((app) => app.categories);
+ const categories = categoriesArray.reduce((c, app) => {
+ for (const category of app) {
c[category] = c[category] ? c[category] + 1 : 1;
}
return c;
diff --git a/packages/types/App.d.ts b/packages/types/App.d.ts
index 9025f2a3be..0c2858e12f 100644
--- a/packages/types/App.d.ts
+++ b/packages/types/App.d.ts
@@ -73,4 +73,6 @@ export interface App {
price?: number;
/** only required for "usage-based" billing. % of commission for paid bookings */
commission?: number;
+ /** Query from db, count the number of credentials */
+ installs?: number;
}