add prisma to reg deps
This commit is contained in:
parent
8048e99794
commit
a7660f6374
3 changed files with 3 additions and 30 deletions
|
@ -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),
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue