mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-21 19:06:21 +00:00
wip: executor
This commit is contained in:
parent
4d5ac919be
commit
b15a07d16a
18
libs/prisma/src/executors/prisma.executor.ts
Normal file
18
libs/prisma/src/executors/prisma.executor.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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();
|
||||
}
|
||||
}
|
@ -1,3 +1,10 @@
|
||||
import { SkeletonCRUDController } from '@autocrud/skeleton';
|
||||
import { PrismaExecutor } from './executors/prisma.executor';
|
||||
|
||||
export class PrismaCRUDController extends SkeletonCRUDController {}
|
||||
export class PrismaCRUDController extends SkeletonCRUDController {
|
||||
async create(): Promise<any> {
|
||||
const executor = new PrismaExecutor(this.createProcess);
|
||||
await executor.execute();
|
||||
return executor.getResult();
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,16 @@ import { ISkeletonCRUDController } from './interfaces/controller/skeleton-crud.c
|
||||
|
||||
export class SkeletonCRUDController implements ISkeletonCRUDController {
|
||||
constructor(
|
||||
private readonly createProcess,
|
||||
private readonly readProcess,
|
||||
private readonly readPaginationProcess,
|
||||
private readonly readEntireProcess,
|
||||
private readonly updatePartialProcess,
|
||||
private readonly updateBatchProcess,
|
||||
private readonly updateEntireProcess,
|
||||
private readonly updateEntireBatchProcess,
|
||||
private readonly deleteProcess,
|
||||
private readonly deleteBatchProcess,
|
||||
public readonly createProcess,
|
||||
public readonly readProcess,
|
||||
public readonly readPaginationProcess,
|
||||
public readonly readEntireProcess,
|
||||
public readonly updatePartialProcess,
|
||||
public readonly updateBatchProcess,
|
||||
public readonly updateEntireProcess,
|
||||
public readonly updateEntireBatchProcess,
|
||||
public readonly deleteProcess,
|
||||
public readonly deleteBatchProcess,
|
||||
) {}
|
||||
|
||||
@Post()
|
||||
|
Loading…
Reference in New Issue
Block a user