feat: implement e2e test for CompanyResolver (#944)
* feat: wip e2e server test * feat: use github action postgres & use infra for local * feat: company e2e test * feat: add company e2e test for permissions * Simplify server e2e test run * Fix lint --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -2,6 +2,7 @@ import {
|
||||
INestApplication,
|
||||
Injectable,
|
||||
Logger,
|
||||
OnModuleDestroy,
|
||||
OnModuleInit,
|
||||
} from '@nestjs/common';
|
||||
|
||||
@ -20,7 +21,7 @@ const createPrismaClient = (options: Prisma.PrismaClientOptions) => {
|
||||
type ExtendedPrismaClient = ReturnType<typeof createPrismaClient>;
|
||||
|
||||
@Injectable()
|
||||
export class PrismaService implements OnModuleInit {
|
||||
export class PrismaService implements OnModuleInit, OnModuleDestroy {
|
||||
private readonly logger = new Logger(PrismaService.name);
|
||||
private prismaClient!: ExtendedPrismaClient;
|
||||
|
||||
@ -61,6 +62,10 @@ export class PrismaService implements OnModuleInit {
|
||||
await this.prismaClient.$connect();
|
||||
}
|
||||
|
||||
async onModuleDestroy(): Promise<void> {
|
||||
await this.prismaClient.$disconnect();
|
||||
}
|
||||
|
||||
async enableShutdownHooks(app: INestApplication) {
|
||||
this.prismaClient.$on('beforeExit', async () => {
|
||||
await app.close();
|
||||
|
||||
Reference in New Issue
Block a user