mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2025-05-04 20:39:53 +00:00
25 lines
628 B
TypeScript
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();
|
|
}
|
|
}
|