Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

switch to prisma

Steven Tey86f4b3d30473
diff --git a/app/ui/home/stats.tsx b/app/ui/home/stats.tsx
index 0e6ed2ca35..880546c0c5 100644
--- a/app/ui/home/stats.tsx
+++ b/app/ui/home/stats.tsx
@@ -1,11 +1,15 @@
-import { getTotalLinks, getTotalVerifiedDomains } from "#/lib/planetscale";
+import prisma from "#/lib/prisma";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import { nFormatter } from "#/lib/utils";
export default async function Stats() {
const [domains, shortlinks, clicks] = await Promise.all([
- getTotalVerifiedDomains(),
- getTotalLinks(),
+ prisma.domain.count({
+ where: {
+ verified: true,
+ },
+ }),
+ prisma.link.count(),
process.env.TINYBIRD_API_KEY
? fetch(`https://api.us-east.tinybird.co/v0/pipes/all_clicks.json`, {
headers: {
diff --git a/app/ui/home/testimonials.tsx b/app/ui/home/testimonials.tsx
index ca1468708a..290cf26d8a 100644
--- a/app/ui/home/testimonials.tsx
+++ b/app/ui/home/testimonials.tsx
@@ -1,9 +1,9 @@
+import prisma from "#/lib/prisma";
import { nFormatter } from "#/lib/utils";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import TestimonialsMobile from "./testimonials-mobile";
import Tweet from "#/ui/tweet";
import { getTweet, Tweet as TweetProps } from "react-tweet/api";
-import { getTotalUsers } from "#/lib/planetscale";
const tweets = [
"1631671657617059842",
@@ -25,7 +25,7 @@ const tweets = [
export default async function Testimonials() {
const [userCount, tweetsData] = await Promise.all([
- getTotalUsers(),
+ prisma.user.count(),
(
await Promise.all(tweets.map((id) => getTweet(id)))
).filter((t) => t) as TweetProps[],