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.

Update planetscale.ts

Steven Tey808b65cca247
diff --git a/apps/web/lib/planetscale.ts b/apps/web/lib/planetscale.ts
index 19b84b4c0c..40c1ae466d 100644
--- a/apps/web/lib/planetscale.ts
+++ b/apps/web/lib/planetscale.ts
@@ -1,6 +1,6 @@
import { nanoid, punyEncode } from "@dub/utils";
import { connect } from "@planetscale/database";
-import { Customer, Project, User } from "@prisma/client";
+import { Customer, Project } from "@prisma/client";
import { DomainProps } from "./types";
export const DATABASE_URL =
@@ -130,40 +130,6 @@ export async function getRandomKey({
}
}
-export const getToken = async (hashedKey: string) => {
- const { rows } = await conn.execute<User>(
- "SELECT * FROM User WHERE User.ID IN (SELECT userId FROM Token WHERE hashedKey = ? AND userId IS NOT NULL) LIMIT 1",
- [hashedKey],
- );
-
- return rows.length > 0 ? rows[0] : null;
-};
-
-export const updateTokenLastUsed = async (hashedKey: string) => {
- return await conn.execute(
- "UPDATE Token SET lastUsed = NOW() WHERE hashedKey = ?",
- [hashedKey],
- );
-};
-
-export const getWorkspaceById = async (workspaceId: string) => {
- const { rows } = await conn.execute<Project>(
- "SELECT * FROM Project WHERE id = ? LIMIT 1",
- [workspaceId.replace("ws_", "")],
- );
-
- return rows && Array.isArray(rows) && rows.length > 0 ? rows[0] : null;
-};
-
-export const getWorkspaceBySlug = async (workspaceSlug: string) => {
- const { rows } = await conn.execute<Project>(
- "SELECT * FROM Project WHERE slug = ? LIMIT 1",
- [workspaceSlug],
- );
-
- return rows && Array.isArray(rows) && rows.length > 0 ? rows[0] : null;
-};
-
export const createCustomer = async ({
id,
name,