mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
468 B
25 lines
468 B
import {
|
|
Injectable,
|
|
Logger,
|
|
OnModuleDestroy,
|
|
OnModuleInit
|
|
} from '@nestjs/common';
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
@Injectable()
|
|
export class PrismaService
|
|
extends PrismaClient
|
|
implements OnModuleInit, OnModuleDestroy
|
|
{
|
|
public async onModuleInit() {
|
|
try {
|
|
await this.$connect();
|
|
} catch (error) {
|
|
Logger.error(error, 'PrismaService');
|
|
}
|
|
}
|
|
|
|
public async onModuleDestroy() {
|
|
await this.$disconnect();
|
|
}
|
|
}
|
|
|