diff --git a/index.ts b/index.ts index aeffca8..8e46477 100644 --- a/index.ts +++ b/index.ts @@ -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() diff --git a/package.json b/package.json index 26fd804..7e712cc 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/routes/transcriptor/getTranscript.ts b/routes/transcriptor/getTranscript.ts index f35e659..2f6b43e 100644 --- a/routes/transcriptor/getTranscript.ts +++ b/routes/transcriptor/getTranscript.ts @@ -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",