diff --git a/client/lib/config.ts b/client/lib/config.ts index 92d2e4bd..c578a636 100644 --- a/client/lib/config.ts +++ b/client/lib/config.ts @@ -63,6 +63,8 @@ export const config = (env: Environment): Config => { validNodeEnvs(env.NODE_ENV) + throwIfUndefined("DATABASE_URL"); + const config: Config = { is_production, enable_admin: stringToBoolean(env.ENABLE_ADMIN), diff --git a/client/lib/server/prisma.ts b/client/lib/server/prisma.ts index a2282083..b8f598a5 100644 --- a/client/lib/server/prisma.ts +++ b/client/lib/server/prisma.ts @@ -6,35 +6,6 @@ import config from "@lib/config" import { Post, PrismaClient, File, User, Prisma } from "@prisma/client" export type { User, File, Post } from "@prisma/client" -// we want to update iff they exist the createdAt/updated/expired/deleted items -// the input could be an array, in which case we'd check each item in the array -// if it's an object, we'd check that object -// then we return the changed object or array - -const updateDateForItem = (item: any) => { - if (item.createdAt) { - item.createdAt = item.createdAt.toString() - } - if (item.updatedAt) { - item.updatedAt = item.updatedAt.toString() - } - if (item.expiresAt) { - item.expiresAt = item.expiresAt.toString() - } - if (item.deletedAt) { - item.deletedAt = item.deletedAt.toString() - } - return item -} - -const updateDates = (input: any) => { - if (Array.isArray(input)) { - return input.map((item) => updateDateForItem(item)) - } else { - return updateDateForItem(input) - } -} - export const prisma = global.prisma || new PrismaClient({ diff --git a/client/package.json b/client/package.json index 31589954..a9fbab7a 100644 --- a/client/package.json +++ b/client/package.json @@ -37,6 +37,7 @@ "react-hot-toast": "^2.4.0", "server-only": "^0.0.1", "swr": "1.3.0", + "prisma": "^4.6.1", "textarea-markdown-editor": "0.1.13", "ts-jest": "^29.0.3" }, @@ -54,7 +55,6 @@ "katex": "^0.16.3", "next-unused": "0.0.6", "prettier": "2.6.2", - "prisma": "^4.6.1", "typescript": "4.6.4", "typescript-plugin-css-modules": "3.4.0" },