feat: just extending from skeleton

This commit is contained in:
Supan Adit Pratama 2024-10-26 23:46:28 +07:00
parent ff07bd1ec3
commit 2c0e0b8ae8
24 changed files with 49 additions and 234 deletions

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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();
}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View 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 {}
}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}