chore: added prisma module
This commit is contained in:
@@ -11,8 +11,8 @@ RUN npm i -g pnpm
|
||||
|
||||
|
||||
# Prisma bits
|
||||
#COPY prisma ./
|
||||
#RUN pnpx prisma generate
|
||||
COPY prisma ./
|
||||
RUN pnpx prisma generate
|
||||
|
||||
|
||||
COPY . .
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
build: .
|
||||
environment:
|
||||
- PRODUCTION=false
|
||||
- DATABASE_URL=postgresql://postgres:testpass@dev-db:5432/hoppscotch
|
||||
- DATABASE_URL=postgresql://postgres:testpass@dev-db:5432/hoppscotch?connect_timeout=300
|
||||
- PORT=3000
|
||||
# volumes:
|
||||
# - .:/usr/src/app
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
"@nestjs/core": "^9.2.1",
|
||||
"@nestjs/graphql": "^10.1.6",
|
||||
"@nestjs/platform-express": "^9.2.1",
|
||||
"@prisma/client": "^4.7.1",
|
||||
"apollo-server-express": "^3.11.1",
|
||||
"graphql": "^15.5.0",
|
||||
"graphql-redis-subscriptions": "^2.5.0",
|
||||
"graphql-subscriptions": "^2.0.0",
|
||||
"ioredis": "^5.2.4",
|
||||
"prisma": "^4.7.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.6.0"
|
||||
|
||||
8
packages/hoppscotch-backend/src/prisma/prisma.module.ts
Normal file
8
packages/hoppscotch-backend/src/prisma/prisma.module.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Module } from '@nestjs/common/decorators';
|
||||
import { PrismaService } from './prisma.service';
|
||||
|
||||
@Module({
|
||||
providers: [PrismaService],
|
||||
exports: [PrismaService],
|
||||
})
|
||||
export class PrismaModule {}
|
||||
19
packages/hoppscotch-backend/src/prisma/prisma.service.ts
Normal file
19
packages/hoppscotch-backend/src/prisma/prisma.service.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
||||
import { PrismaClient } from '@prisma/client/scripts/default-index';
|
||||
|
||||
@Injectable()
|
||||
export class PrismaService
|
||||
extends PrismaClient
|
||||
implements OnModuleInit, OnModuleDestroy
|
||||
{
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
async onModuleInit() {
|
||||
await this.$connect();
|
||||
}
|
||||
|
||||
async onModuleDestroy() {
|
||||
await this.$disconnect();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user