fix: prisma generate

This commit is contained in:
2023-10-20 22:45:46 +02:00
parent a19ce4aeba
commit 62e9f6030e
3 changed files with 6 additions and 3 deletions

View File

@@ -6,9 +6,12 @@ import { router } from "express-file-routing"
import path from 'node:path'
import { fileURLToPath } from 'node:url';
import { PrismaClient } from "@prisma/client"
const exec = (await import('util')).promisify((await import('child_process')).exec);
const dirname = path.dirname(fileURLToPath(import.meta.url));
await exec('npx prisma generate')
/* MongoDB */
export const prisma = new PrismaClient()

View File

@@ -27,12 +27,12 @@
"express": "^4.18.1",
"express-file-routing": "^3.0.3",
"express-rate-limit": "^6.6.0",
"mongoose": "^6.6.5"
"mongoose": "^6.6.5",
"prisma": "^5.4.2"
},
"devDependencies": {
"@types/cors": "^2.8.13",
"@types/express": "^4.17.14",
"prisma": "^5.4.2",
"typescript": "^4.8.4"
}
}

View File

@@ -2,7 +2,7 @@ import type { Handler } from "express"
import { prisma } from "../../index.js"
export const get: Handler = async (req, res) => {
if (!req.query.msgid) return res.status(400).json({ error: "msgid is required" })
if (!req.query.msgid) return res.status(400).json({ error: "msgid is required" })
if (await prisma.transcripts.count({ where: { msgid: req.query.msgid as string } }) === 0)
return res.status(400).json({
error: "the message doesn't exist",