mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-17 12:42:54 -06:00
29 lines
676 B
TypeScript
29 lines
676 B
TypeScript
import { ConfigService } from '@config/env.config';
|
|
import { Logger } from '@config/logger.config';
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
export class Query<T> {
|
|
where?: T;
|
|
sort?: 'asc' | 'desc';
|
|
page?: number;
|
|
offset?: number;
|
|
}
|
|
|
|
export class PrismaRepository extends PrismaClient {
|
|
constructor(private readonly configService: ConfigService) {
|
|
super();
|
|
}
|
|
|
|
private readonly logger = new Logger('PrismaRepository');
|
|
|
|
public async onModuleInit() {
|
|
await this.$connect();
|
|
this.logger.info('Repository:Prisma - ON');
|
|
}
|
|
|
|
public async onModuleDestroy() {
|
|
await this.$disconnect();
|
|
this.logger.warn('Repository:Prisma - OFF');
|
|
}
|
|
}
|