This commit is contained in:
2026-04-16 17:21:48 +03:00
parent c8fa4c442d
commit c8e7e4e927
116 changed files with 3720 additions and 4197 deletions
+9 -9
View File
@@ -3,11 +3,11 @@ import {
OnModuleInit,
OnModuleDestroy,
Logger,
} from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
} from "@nestjs/common";
import { PrismaClient } from "@prisma/client";
// Models that support soft delete
const SOFT_DELETE_MODELS = ['user', 'role', 'tenant'];
const SOFT_DELETE_MODELS = ["user", "role", "tenant"];
// Type for Prisma model delegate with common operations
interface PrismaDelegate {
@@ -29,20 +29,20 @@ export class PrismaService
constructor() {
super({
log: [
{ emit: 'event', level: 'query' },
{ emit: 'event', level: 'error' },
{ emit: 'event', level: 'warn' },
{ emit: "event", level: "query" },
{ emit: "event", level: "error" },
{ emit: "event", level: "warn" },
],
});
}
async onModuleInit() {
this.logger.log(
`Connecting to database... URL: ${process.env.DATABASE_URL?.split('@')[1]}`,
`Connecting to database... URL: ${process.env.DATABASE_URL?.split("@")[1]}`,
); // Mask password
try {
await this.$connect();
this.logger.log('✅ Database connected successfully');
this.logger.log("✅ Database connected successfully");
} catch (error) {
this.logger.error(
`❌ Database connection failed: ${error.message}`,
@@ -54,7 +54,7 @@ export class PrismaService
async onModuleDestroy() {
await this.$disconnect();
this.logger.log('🔌 Database disconnected');
this.logger.log("🔌 Database disconnected");
}
/**