mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-22 03:16:21 +00:00
feat: just extending from skeleton
This commit is contained in:
parent
ff07bd1ec3
commit
2c0e0b8ae8
@ -1,24 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
import { SkeletonCRUDController } from '@autocrud/skeleton';
|
||||
import { PrismaExecutor } from './executors/prisma.executor';
|
||||
|
||||
export class PrismaCRUDController extends SkeletonCRUDController {
|
||||
async create(): Promise<any> {
|
||||
return await PrismaExecutor.default(this.createProcess);
|
||||
}
|
||||
}
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -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<any> {
|
||||
this.prisma['asd'].create({
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
end();
|
||||
after();
|
||||
result();
|
||||
}
|
||||
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -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 {}
|
||||
|
@ -4,12 +4,12 @@ export class DefaultExecutor {
|
||||
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();
|
||||
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 {
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class BatchDeleteProcess extends DefaultProcess {}
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class BatchUpdateProcess extends DefaultProcess {}
|
||||
|
@ -1,11 +1,3 @@
|
||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
||||
import { DefaultProcess } from './default.process';
|
||||
|
||||
export class CreateProcess implements ISkeletonProcess {
|
||||
async initialization(): Promise<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class CreateProcess extends DefaultProcess {}
|
||||
|
12
libs/skeleton/src/processes/default.process.ts
Normal file
12
libs/skeleton/src/processes/default.process.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
||||
|
||||
export class DefaultProcess implements ISkeletonProcess {
|
||||
async initialization(): Promise<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
|
||||
result(): any {}
|
||||
}
|
@ -1,11 +1,3 @@
|
||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
||||
import { DefaultProcess } from './default.process';
|
||||
|
||||
export class DeleteProcess implements ISkeletonProcess {
|
||||
async initialization(): Promise<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class DeleteProcess extends DefaultProcess {}
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class ListProcess extends DefaultProcess {}
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class PaginationProcess extends DefaultProcess {}
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class PartialBatchUpdateProcess extends DefaultProcess {}
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class PartialUpdateProcess extends DefaultProcess {}
|
||||
|
@ -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<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class ReadProcess extends DefaultProcess {}
|
||||
|
@ -1,11 +1,3 @@
|
||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
||||
import { DefaultProcess } from './default.process';
|
||||
|
||||
export class UpdateProcess implements ISkeletonProcess {
|
||||
async initialization(): Promise<any> {}
|
||||
async before(): Promise<any> {}
|
||||
async begin(): Promise<any> {}
|
||||
async process(): Promise<any> {}
|
||||
async end(): Promise<any> {}
|
||||
async after(): Promise<any> {}
|
||||
async result(): Promise<any> {}
|
||||
}
|
||||
export class UpdateProcess extends DefaultProcess {}
|
||||
|
Loading…
Reference in New Issue
Block a user