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';
|
import { BatchDeleteProcess } from '@autocrud/skeleton/processes/batch/delete.process';
|
||||||
|
|
||||||
export abstract class PrismaBatchDeleteProcess implements BatchDeleteProcess {
|
export class PrismaBatchDeleteProcess extends BatchDeleteProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { BatchUpdateProcess } from '@autocrud/skeleton/processes/batch/update.process';
|
import { BatchUpdateProcess } from '@autocrud/skeleton/processes/batch/update.process';
|
||||||
|
|
||||||
export abstract class PrismaBatchUpdateProcess implements BatchUpdateProcess {
|
export class PrismaBatchUpdateProcess extends BatchUpdateProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
import { CreateProcess } from '@autocrud/skeleton/processes/create.process';
|
import { CreateProcess } from '@autocrud/skeleton/processes/create.process';
|
||||||
|
|
||||||
export class PrismaCreateProcess implements CreateProcess {
|
export class PrismaCreateProcess extends CreateProcess {
|
||||||
initialization();
|
async process(): Promise<any> {
|
||||||
before();
|
|
||||||
begin();
|
|
||||||
|
|
||||||
process(): T {
|
|
||||||
this.prisma['asd'].create({
|
this.prisma['asd'].create({
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
end();
|
|
||||||
after();
|
|
||||||
result();
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,3 @@
|
|||||||
import { DeleteProcess } from '@autocrud/skeleton/processes/delete.process';
|
import { DeleteProcess } from '@autocrud/skeleton/processes/delete.process';
|
||||||
import { Prisma } from '@prisma/client';
|
|
||||||
|
|
||||||
export abstract class PrismaDeleteProcess implements DeleteProcess {
|
export class PrismaDeleteProcess extends DeleteProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ListProcess } from '@autocrud/skeleton/processes/list.process';
|
import { ListProcess } from '@autocrud/skeleton/processes/list.process';
|
||||||
|
|
||||||
export abstract class PrismaListProcess implements ListProcess {
|
export class PrismaListProcess extends ListProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { PaginationProcess } from '@autocrud/skeleton/processes/pagination.process';
|
import { PaginationProcess } from '@autocrud/skeleton/processes/pagination.process';
|
||||||
|
|
||||||
export abstract class PrismaPaginationProcess implements PaginationProcess {
|
export class PrismaPaginationProcess extends PaginationProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
import { PartialBatchUpdateProcess } from '@autocrud/skeleton/processes/partial/batch/update.process';
|
import { PartialBatchUpdateProcess } from '@autocrud/skeleton/processes/partial/batch/update.process';
|
||||||
|
|
||||||
export abstract class PrismaPartialBatchUpdateProcess
|
export class PrismaPartialBatchUpdateProcess extends PartialBatchUpdateProcess {}
|
||||||
implements PartialBatchUpdateProcess
|
|
||||||
{
|
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
import { PartialUpdateProcess } from '@autocrud/skeleton/processes/partial/update.process';
|
import { PartialUpdateProcess } from '@autocrud/skeleton/processes/partial/update.process';
|
||||||
|
|
||||||
export abstract class PrismaPartialUpdateProcess
|
export class PrismaPartialUpdateProcess extends PartialUpdateProcess {}
|
||||||
implements PartialUpdateProcess
|
|
||||||
{
|
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ReadProcess } from '@autocrud/skeleton/processes/read.process';
|
import { ReadProcess } from '@autocrud/skeleton/processes/read.process';
|
||||||
|
|
||||||
export abstract class PrismaReadProcess implements ReadProcess {
|
export class PrismaReadProcess extends ReadProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { UpdateProcess } from '@autocrud/skeleton/processes/update.process';
|
import { UpdateProcess } from '@autocrud/skeleton/processes/update.process';
|
||||||
|
|
||||||
export abstract class PrismaUpdateProcess implements UpdateProcess {
|
export class PrismaUpdateProcess extends UpdateProcess {}
|
||||||
abstract initialization();
|
|
||||||
abstract before();
|
|
||||||
abstract begin();
|
|
||||||
abstract process();
|
|
||||||
abstract end();
|
|
||||||
abstract after();
|
|
||||||
abstract result();
|
|
||||||
}
|
|
||||||
|
@ -4,12 +4,12 @@ export class DefaultExecutor {
|
|||||||
constructor(private process: ISkeletonProcess) {}
|
constructor(private process: ISkeletonProcess) {}
|
||||||
|
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
this.process.initialization();
|
await this.process.initialization();
|
||||||
this.process.before();
|
await this.process.before();
|
||||||
this.process.begin();
|
await this.process.begin();
|
||||||
this.process.process();
|
await this.process.process();
|
||||||
this.process.end();
|
await this.process.end();
|
||||||
this.process.after();
|
await this.process.after();
|
||||||
}
|
}
|
||||||
|
|
||||||
getResult(): any {
|
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 {
|
export class BatchDeleteProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface';
|
import { DefaultProcess } from '../default.process';
|
||||||
|
|
||||||
export abstract class BatchUpdateProcess implements ISkeletonProcess {
|
export class BatchUpdateProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
import { DefaultProcess } from './default.process';
|
||||||
|
|
||||||
export class CreateProcess implements ISkeletonProcess {
|
export class CreateProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
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 {
|
export class DeleteProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
import { DefaultProcess } from './default.process';
|
||||||
|
|
||||||
export abstract class ListProcess implements ISkeletonProcess {
|
export class ListProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
import { DefaultProcess } from './default.process';
|
||||||
|
|
||||||
export abstract class PaginationProcess implements ISkeletonProcess {
|
export class PaginationProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface';
|
import { DefaultProcess } from '../../default.process';
|
||||||
|
|
||||||
export abstract class PartialBatchUpdateProcess implements ISkeletonProcess {
|
export class PartialBatchUpdateProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '@autocrud/skeleton/interfaces/skeleton-process.interface';
|
import { DefaultProcess } from '../default.process';
|
||||||
|
|
||||||
export abstract class PartialUpdateProcess implements ISkeletonProcess {
|
export class PartialUpdateProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
import { DefaultProcess } from './default.process';
|
||||||
|
|
||||||
export abstract class ReadProcess implements ISkeletonProcess {
|
export class ReadProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
import { ISkeletonProcess } from '../interfaces/skeleton-process.interface';
|
import { DefaultProcess } from './default.process';
|
||||||
|
|
||||||
export class UpdateProcess implements ISkeletonProcess {
|
export class UpdateProcess extends DefaultProcess {}
|
||||||
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> {}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user