nest-autocrud/libs/prisma/src/executors/prisma.executor.ts
2024-10-26 23:34:11 +07:00

25 lines
628 B
TypeScript

import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface';
export class PrismaExecutor {
constructor(private process: ISkeletonProcess) {}
async execute(): Promise<void> {
this.process.initialization();
this.process.before();
this.process.begin();
this.process.process();
this.process.end();
this.process.after();
}
getResult(): any {
return this.process.result();
}
static async default(process: ISkeletonProcess): Promise<any> {
const executor = new PrismaExecutor(process);
await executor.execute();
return executor.getResult();
}
}