feat: keep deletions restorable and confirm a pipeline's deals before it is removed

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-13 22:23:09 +03:30
co-authored by Cursor
parent c04582072d
commit 2cc81bb596
17 changed files with 1158 additions and 6 deletions
+25 -4
View File
@@ -1,13 +1,34 @@
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
import { withDeletionArchive } from '../deletions/deletion-archive';
const base = new PrismaClient();
const client = withDeletionArchive(base);
export interface PrismaService extends PrismaClient {}
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
export class PrismaService implements OnModuleInit, OnModuleDestroy {
constructor() {
return new Proxy(this, {
get: (target, prop, receiver) => {
if (Reflect.has(target, prop)) return Reflect.get(target, prop, receiver);
const value = (client as unknown as Record<PropertyKey, unknown>)[prop];
if (typeof value === 'function') {
return (value as (...args: unknown[]) => unknown).bind(client);
}
return value;
},
});
}
async onModuleInit() {
await this.$connect();
await client.$connect();
}
async onModuleDestroy() {
await this.$disconnect();
await client.$disconnect();
}
}
export type PrismaServiceClient = typeof client;