mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-22 03:16: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 { 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 {
|
export class SkeletonCRUDController implements ISkeletonCRUDController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly createProcess,
|
public readonly createProcess,
|
||||||
private readonly readProcess,
|
public readonly readProcess,
|
||||||
private readonly readPaginationProcess,
|
public readonly readPaginationProcess,
|
||||||
private readonly readEntireProcess,
|
public readonly readEntireProcess,
|
||||||
private readonly updatePartialProcess,
|
public readonly updatePartialProcess,
|
||||||
private readonly updateBatchProcess,
|
public readonly updateBatchProcess,
|
||||||
private readonly updateEntireProcess,
|
public readonly updateEntireProcess,
|
||||||
private readonly updateEntireBatchProcess,
|
public readonly updateEntireBatchProcess,
|
||||||
private readonly deleteProcess,
|
public readonly deleteProcess,
|
||||||
private readonly deleteBatchProcess,
|
public readonly deleteBatchProcess,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
Loading…
Reference in New Issue
Block a user