diff --git a/backend/package.json b/backend/package.json index 3643095..7aa3dfc 100644 --- a/backend/package.json +++ b/backend/package.json @@ -10,7 +10,7 @@ "start": "NODE_ENV=PROD node dist/src/index.js", "predev": "npx prisma migrate dev --name init && npx prisma generate", "dev": "NODE_ENV=DEV nodemon -e ts --exec \"npm run build && node dist/src/index.js\"", - "pretest": "npx prisma migrate deploy && npx prisma generate", + "pretest": "npx prisma migrate dev --name init && npx prisma generate", "test": "NODE_ENV=TEST npm run build && mocha \"dist/test/**/*.test.js\"" }, "keywords": [], diff --git a/backend/src/index.ts b/backend/src/index.ts index 6e28f84..5d26cca 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -4,12 +4,9 @@ import algorithmRouter from "./routers/algorithm.router.js"; import authenticationRouter from "./routers/authentication.router.js"; import errorHandler from "./middlewares/error.middleware.js"; import { PORT } from "./config/config.js"; -import { PrismaClient } from "@prisma/client"; export const app: Express = express(); -export const prisma = new PrismaClient(); - app.use(cors()); app.use(express.json()); diff --git a/backend/src/routers/authentication.router.ts b/backend/src/routers/authentication.router.ts index 3d7f66d..7f074fc 100644 --- a/backend/src/routers/authentication.router.ts +++ b/backend/src/routers/authentication.router.ts @@ -1,5 +1,5 @@ import { Router } from "express"; -import { prisma } from "../index.js"; +import { PrismaClient } from "@prisma/client"; import UserRepository from "../repositories/user.repository.js"; import AuthenticationService from "../services/authentication.service.js"; import AuthenticationController from "../controllers/authentication.controller.js"; @@ -11,6 +11,8 @@ import { const authenticationRouter = Router(); +const prisma = new PrismaClient(); + const userRepository: UserRepositoryInterface = new UserRepository(prisma); const authenticationService: AuthenticationServiceInterface =