diff --git a/libs/prisma/src/executors/prisma.executor.ts b/libs/prisma/src/executors/prisma.executor.ts deleted file mode 100644 index 6cd0115..0000000 --- a/libs/prisma/src/executors/prisma.executor.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface'; - -export class PrismaExecutor { - constructor(private process: ISkeletonProcess) {} - - async execute(): Promise { - 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 { - const executor = new PrismaExecutor(process); - await executor.execute(); - return executor.getResult(); - } -} diff --git a/libs/prisma/src/prisma-crud.controller.ts b/libs/prisma/src/prisma-crud.controller.ts deleted file mode 100644 index 0781b2c..0000000 --- a/libs/prisma/src/prisma-crud.controller.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { SkeletonCRUDController } from '@autocrud/skeleton'; -import { PrismaExecutor } from './executors/prisma.executor'; - -export class PrismaCRUDController extends SkeletonCRUDController { - async create(): Promise { - return await PrismaExecutor.default(this.createProcess); - } -} diff --git a/libs/prisma/src/processes/batch/delete.process.ts b/libs/prisma/src/processes/batch/delete.process.ts index 6f914bb..0226a7e 100644 --- a/libs/prisma/src/processes/batch/delete.process.ts +++ b/libs/prisma/src/processes/batch/delete.process.ts @@ -1,11 +1,3 @@ import { BatchDeleteProcess } from '@autocrud/skeleton/processes/batch/delete.process'; -export abstract class PrismaBatchDeleteProcess implements BatchDeleteProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaBatchDeleteProcess extends BatchDeleteProcess {} diff --git a/libs/prisma/src/processes/batch/update.process.ts b/libs/prisma/src/processes/batch/update.process.ts index 34784bf..f5b3259 100644 --- a/libs/prisma/src/processes/batch/update.process.ts +++ b/libs/prisma/src/processes/batch/update.process.ts @@ -1,11 +1,3 @@ import { BatchUpdateProcess } from '@autocrud/skeleton/processes/batch/update.process'; -export abstract class PrismaBatchUpdateProcess implements BatchUpdateProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaBatchUpdateProcess extends BatchUpdateProcess {} diff --git a/libs/prisma/src/processes/create.process.ts b/libs/prisma/src/processes/create.process.ts index 59e2180..adf2efb 100644 --- a/libs/prisma/src/processes/create.process.ts +++ b/libs/prisma/src/processes/create.process.ts @@ -1,17 +1,9 @@ import { CreateProcess } from '@autocrud/skeleton/processes/create.process'; -export class PrismaCreateProcess implements CreateProcess { - initialization(); - before(); - begin(); - - process(): T { +export class PrismaCreateProcess extends CreateProcess { + async process(): Promise { this.prisma['asd'].create({ data, }); } - - end(); - after(); - result(); } diff --git a/libs/prisma/src/processes/delete.process.ts b/libs/prisma/src/processes/delete.process.ts index fef6feb..dee31cc 100644 --- a/libs/prisma/src/processes/delete.process.ts +++ b/libs/prisma/src/processes/delete.process.ts @@ -1,12 +1,3 @@ import { DeleteProcess } from '@autocrud/skeleton/processes/delete.process'; -import { Prisma } from '@prisma/client'; -export abstract class PrismaDeleteProcess implements DeleteProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaDeleteProcess extends DeleteProcess {} diff --git a/libs/prisma/src/processes/list.process.ts b/libs/prisma/src/processes/list.process.ts index 0fbfe3b..71c8404 100644 --- a/libs/prisma/src/processes/list.process.ts +++ b/libs/prisma/src/processes/list.process.ts @@ -1,11 +1,3 @@ import { ListProcess } from '@autocrud/skeleton/processes/list.process'; -export abstract class PrismaListProcess implements ListProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaListProcess extends ListProcess {} diff --git a/libs/prisma/src/processes/pagination.process.ts b/libs/prisma/src/processes/pagination.process.ts index d661ca5..e998e6f 100644 --- a/libs/prisma/src/processes/pagination.process.ts +++ b/libs/prisma/src/processes/pagination.process.ts @@ -1,11 +1,3 @@ import { PaginationProcess } from '@autocrud/skeleton/processes/pagination.process'; -export abstract class PrismaPaginationProcess implements PaginationProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaPaginationProcess extends PaginationProcess {} diff --git a/libs/prisma/src/processes/partial/batch/update.process.ts b/libs/prisma/src/processes/partial/batch/update.process.ts index cc63c45..9426845 100644 --- a/libs/prisma/src/processes/partial/batch/update.process.ts +++ b/libs/prisma/src/processes/partial/batch/update.process.ts @@ -1,13 +1,3 @@ import { PartialBatchUpdateProcess } from '@autocrud/skeleton/processes/partial/batch/update.process'; -export abstract class PrismaPartialBatchUpdateProcess - implements PartialBatchUpdateProcess -{ - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaPartialBatchUpdateProcess extends PartialBatchUpdateProcess {} diff --git a/libs/prisma/src/processes/partial/update.process.ts b/libs/prisma/src/processes/partial/update.process.ts index b743084..fa8759d 100644 --- a/libs/prisma/src/processes/partial/update.process.ts +++ b/libs/prisma/src/processes/partial/update.process.ts @@ -1,13 +1,3 @@ import { PartialUpdateProcess } from '@autocrud/skeleton/processes/partial/update.process'; -export abstract class PrismaPartialUpdateProcess - implements PartialUpdateProcess -{ - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaPartialUpdateProcess extends PartialUpdateProcess {} diff --git a/libs/prisma/src/processes/read.process.ts b/libs/prisma/src/processes/read.process.ts index 22e74c7..0505134 100644 --- a/libs/prisma/src/processes/read.process.ts +++ b/libs/prisma/src/processes/read.process.ts @@ -1,11 +1,3 @@ import { ReadProcess } from '@autocrud/skeleton/processes/read.process'; -export abstract class PrismaReadProcess implements ReadProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaReadProcess extends ReadProcess {} diff --git a/libs/prisma/src/processes/update.process.ts b/libs/prisma/src/processes/update.process.ts index 431e670..371b71d 100644 --- a/libs/prisma/src/processes/update.process.ts +++ b/libs/prisma/src/processes/update.process.ts @@ -1,11 +1,3 @@ import { UpdateProcess } from '@autocrud/skeleton/processes/update.process'; -export abstract class PrismaUpdateProcess implements UpdateProcess { - abstract initialization(); - abstract before(); - abstract begin(); - abstract process(); - abstract end(); - abstract after(); - abstract result(); -} +export class PrismaUpdateProcess extends UpdateProcess {} diff --git a/libs/skeleton/src/executors/default.executor.ts b/libs/skeleton/src/executors/default.executor.ts index 4bf0a45..450cf52 100644 --- a/libs/skeleton/src/executors/default.executor.ts +++ b/libs/skeleton/src/executors/default.executor.ts @@ -4,12 +4,12 @@ export class DefaultExecutor { constructor(private process: ISkeletonProcess) {} async execute(): Promise { - this.process.initialization(); - this.process.before(); - this.process.begin(); - this.process.process(); - this.process.end(); - this.process.after(); + await this.process.initialization(); + await this.process.before(); + await this.process.begin(); + await this.process.process(); + await this.process.end(); + await this.process.after(); } getResult(): any { diff --git a/libs/skeleton/src/processes/batch/delete.process.ts b/libs/skeleton/src/processes/batch/delete.process.ts index df98b48..c28cff9 100644 --- a/libs/skeleton/src/processes/batch/delete.process.ts +++ b/libs/skeleton/src/processes/batch/delete.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface'; +import { DefaultProcess } from '../default.process'; -export abstract class BatchDeleteProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class BatchDeleteProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/batch/update.process.ts b/libs/skeleton/src/processes/batch/update.process.ts index 71c75a3..6c7d787 100644 --- a/libs/skeleton/src/processes/batch/update.process.ts +++ b/libs/skeleton/src/processes/batch/update.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface'; +import { DefaultProcess } from '../default.process'; -export abstract class BatchUpdateProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class BatchUpdateProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/create.process.ts b/libs/skeleton/src/processes/create.process.ts index 8705fa1..8896dcd 100644 --- a/libs/skeleton/src/processes/create.process.ts +++ b/libs/skeleton/src/processes/create.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; +import { DefaultProcess } from './default.process'; -export class CreateProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class CreateProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/default.process.ts b/libs/skeleton/src/processes/default.process.ts new file mode 100644 index 0000000..43593c1 --- /dev/null +++ b/libs/skeleton/src/processes/default.process.ts @@ -0,0 +1,12 @@ +import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; + +export class DefaultProcess implements ISkeletonProcess { + async initialization(): Promise {} + async before(): Promise {} + async begin(): Promise {} + async process(): Promise {} + async end(): Promise {} + async after(): Promise {} + + result(): any {} +} diff --git a/libs/skeleton/src/processes/delete.process.ts b/libs/skeleton/src/processes/delete.process.ts index 9d389b1..db72350 100644 --- a/libs/skeleton/src/processes/delete.process.ts +++ b/libs/skeleton/src/processes/delete.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; +import { DefaultProcess } from './default.process'; -export class DeleteProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class DeleteProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/list.process.ts b/libs/skeleton/src/processes/list.process.ts index 8197ea0..c930683 100644 --- a/libs/skeleton/src/processes/list.process.ts +++ b/libs/skeleton/src/processes/list.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; +import { DefaultProcess } from './default.process'; -export abstract class ListProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class ListProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/pagination.process.ts b/libs/skeleton/src/processes/pagination.process.ts index a280d1d..c7e4b46 100644 --- a/libs/skeleton/src/processes/pagination.process.ts +++ b/libs/skeleton/src/processes/pagination.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; +import { DefaultProcess } from './default.process'; -export abstract class PaginationProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class PaginationProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/partial/batch/update.process.ts b/libs/skeleton/src/processes/partial/batch/update.process.ts index e24b5a0..45710f9 100644 --- a/libs/skeleton/src/processes/partial/batch/update.process.ts +++ b/libs/skeleton/src/processes/partial/batch/update.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface'; +import { DefaultProcess } from '../../default.process'; -export abstract class PartialBatchUpdateProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class PartialBatchUpdateProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/partial/update.process.ts b/libs/skeleton/src/processes/partial/update.process.ts index 176e7ca..44a8e95 100644 --- a/libs/skeleton/src/processes/partial/update.process.ts +++ b/libs/skeleton/src/processes/partial/update.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface'; +import { DefaultProcess } from '../default.process'; -export abstract class PartialUpdateProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class PartialUpdateProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/read.process.ts b/libs/skeleton/src/processes/read.process.ts index f0ff422..63485b4 100644 --- a/libs/skeleton/src/processes/read.process.ts +++ b/libs/skeleton/src/processes/read.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; +import { DefaultProcess } from './default.process'; -export abstract class ReadProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class ReadProcess extends DefaultProcess {} diff --git a/libs/skeleton/src/processes/update.process.ts b/libs/skeleton/src/processes/update.process.ts index 6ff4a89..f4ff283 100644 --- a/libs/skeleton/src/processes/update.process.ts +++ b/libs/skeleton/src/processes/update.process.ts @@ -1,11 +1,3 @@ -import { ISkeletonProcess } from '../interfaces/skeleton-process.interface'; +import { DefaultProcess } from './default.process'; -export class UpdateProcess implements ISkeletonProcess { - async initialization(): Promise {} - async before(): Promise {} - async begin(): Promise {} - async process(): Promise {} - async end(): Promise {} - async after(): Promise {} - async result(): Promise {} -} +export class UpdateProcess extends DefaultProcess {}