diff --git a/libs/prisma/src/processes/create.process.ts b/libs/prisma/src/processes/create.process.ts index fa17e90..4640344 100644 --- a/libs/prisma/src/processes/create.process.ts +++ b/libs/prisma/src/processes/create.process.ts @@ -5,11 +5,11 @@ export class PrismaCreateProcess extends PrismaProcess implements CreateProcess { - public data; + public payload; async process(): Promise { this.result = await this.getDelegate().create({ - data: this.data, + data: this.payload, }); } } diff --git a/libs/prisma/src/processes/delete.process.ts b/libs/prisma/src/processes/delete.process.ts index 2bdde3b..85acc0d 100644 --- a/libs/prisma/src/processes/delete.process.ts +++ b/libs/prisma/src/processes/delete.process.ts @@ -5,11 +5,11 @@ export class PrismaDeleteProcess extends PrismaProcess implements DeleteProcess { - public id: any; + public identity: any; async process(): Promise { this.result = await this.getDelegate().delete({ - where: { id: this.id }, + where: { id: this.identity }, }); } } diff --git a/libs/prisma/src/processes/read.process.ts b/libs/prisma/src/processes/read.process.ts index 25f6c46..a7c4020 100644 --- a/libs/prisma/src/processes/read.process.ts +++ b/libs/prisma/src/processes/read.process.ts @@ -2,11 +2,11 @@ import { ReadProcess } from '@aditama-labs/nest-autocrud/skeleton'; import { PrismaProcess } from './prisma.process'; export class PrismaReadProcess extends PrismaProcess implements ReadProcess { - public id; + public identity; async process(): Promise { this.result = await this.getDelegate().findUnique({ - where: { id: this.id }, + where: { id: this.identity }, }); } } diff --git a/libs/prisma/src/processes/update.process.ts b/libs/prisma/src/processes/update.process.ts index faf282f..ef5457b 100644 --- a/libs/prisma/src/processes/update.process.ts +++ b/libs/prisma/src/processes/update.process.ts @@ -5,13 +5,13 @@ export class PrismaUpdateProcess extends PrismaProcess implements UpdateProcess { - public id: any; - public data: any; + public identity: any; + public payload: any; async process(): Promise { this.result = await this.getDelegate().update({ - data: this.data, - where: { id: this.id }, + data: this.payload, + where: { id: this.identity }, }); } } diff --git a/libs/skeleton/src/executors/create.executor.ts b/libs/skeleton/src/executors/create.executor.ts index b8ffc53..611fe39 100644 --- a/libs/skeleton/src/executors/create.executor.ts +++ b/libs/skeleton/src/executors/create.executor.ts @@ -5,7 +5,7 @@ export class CreateExcutor extends DefaultExecutor { constructor(process: CreateProcess, data) { super(process); // Set data to process - process.data = data; + process.payload = data; } static async bootstrap(process: CreateProcess, data): Promise { diff --git a/libs/skeleton/src/executors/delete.executor.ts b/libs/skeleton/src/executors/delete.executor.ts index 635a2ad..c7a7fda 100644 --- a/libs/skeleton/src/executors/delete.executor.ts +++ b/libs/skeleton/src/executors/delete.executor.ts @@ -6,7 +6,7 @@ export class DeleteExecutor extends DefaultExecutor { constructor(process: DeleteProcess, id) { super(process); // Set the id of the data - process.id = id; + process.identity = id; } static async bootstrap(process: DeleteProcess, id): Promise { diff --git a/libs/skeleton/src/executors/read.executor.ts b/libs/skeleton/src/executors/read.executor.ts index dd6be53..beda8c9 100644 --- a/libs/skeleton/src/executors/read.executor.ts +++ b/libs/skeleton/src/executors/read.executor.ts @@ -5,7 +5,7 @@ export class ReadExecutor extends DefaultExecutor { constructor(process: ReadProcess, id) { super(process); // Set the id of the data - process.id = id; + process.identity = id; } static async bootstrap(process: ReadProcess, id): Promise { diff --git a/libs/skeleton/src/executors/update.executor.ts b/libs/skeleton/src/executors/update.executor.ts index 580880a..ce94f97 100644 --- a/libs/skeleton/src/executors/update.executor.ts +++ b/libs/skeleton/src/executors/update.executor.ts @@ -6,8 +6,8 @@ export class UpdateExecutor extends DefaultExecutor { constructor(process: UpdateProcess, id, data) { super(process); // Set the id and data to process - process.id = id; - process.data = data; + process.identity = id; + process.payload = data; } static async bootstrap(process: UpdateProcess, id, data): Promise { diff --git a/libs/skeleton/src/processes/create.process.ts b/libs/skeleton/src/processes/create.process.ts index c1bd302..02e41c1 100644 --- a/libs/skeleton/src/processes/create.process.ts +++ b/libs/skeleton/src/processes/create.process.ts @@ -1,5 +1,5 @@ import { DefaultProcess } from './default.process'; export class CreateProcess extends DefaultProcess { - public data; + public payload; } diff --git a/libs/skeleton/src/processes/delete.process.ts b/libs/skeleton/src/processes/delete.process.ts index dbb101c..ed7ec3d 100644 --- a/libs/skeleton/src/processes/delete.process.ts +++ b/libs/skeleton/src/processes/delete.process.ts @@ -2,5 +2,5 @@ import { DefaultProcess } from './default.process'; // @TODO: DeleteProcess and ReadProcess are the same, should be refactored next export class DeleteProcess extends DefaultProcess { - public id; + public identity; } diff --git a/libs/skeleton/src/processes/read.process.ts b/libs/skeleton/src/processes/read.process.ts index 5a14dc1..a15eef3 100644 --- a/libs/skeleton/src/processes/read.process.ts +++ b/libs/skeleton/src/processes/read.process.ts @@ -1,5 +1,5 @@ import { DefaultProcess } from './default.process'; export class ReadProcess extends DefaultProcess { - public id; + public identity; } diff --git a/libs/skeleton/src/processes/update.process.ts b/libs/skeleton/src/processes/update.process.ts index 7a6b37f..5f0ca61 100644 --- a/libs/skeleton/src/processes/update.process.ts +++ b/libs/skeleton/src/processes/update.process.ts @@ -2,7 +2,7 @@ import { DefaultProcess } from './default.process'; export class UpdateProcess extends DefaultProcess { // @TODO: The property of id can be take from ReadProcess which is extended - public id; + public identity; // @TODO: The property of data can be take from CreateProcess which is extended - public data; + public payload; } diff --git a/libs/skeleton/src/skeleton-crud.controller.ts b/libs/skeleton/src/skeleton-crud.controller.ts index e071766..6d9447c 100644 --- a/libs/skeleton/src/skeleton-crud.controller.ts +++ b/libs/skeleton/src/skeleton-crud.controller.ts @@ -50,8 +50,8 @@ class SkeletonCRUDController implements ISkeletonCRUDController { } @Delete(':id') - async delete(@Param('id') providedKey) { - return await DeleteExecutor.bootstrap(this.deleteProcess, providedKey); + async delete(@Param('id') identity) { + return await DeleteExecutor.bootstrap(this.deleteProcess, identity); } @Get('list') @@ -66,17 +66,13 @@ class SkeletonCRUDController implements ISkeletonCRUDController { } @Get(':id') - async read(@Param('id') providedKey) { - return await ReadExecutor.bootstrap(this.readProcess, providedKey); + async read(@Param('id') identity) { + return await ReadExecutor.bootstrap(this.readProcess, identity); } @Patch(':id') - async update(@Param('id') providedKey, @Body() body) { - return await UpdateExecutor.bootstrap( - this.updateProcess, - providedKey, - body, - ); + async update(@Param('id') identity, @Body() body) { + return await UpdateExecutor.bootstrap(this.updateProcess, identity, body); } } diff --git a/src/example/custom/domain/custom.read.process.ts b/src/example/custom/domain/custom.read.process.ts index 7d21243..8d4d572 100644 --- a/src/example/custom/domain/custom.read.process.ts +++ b/src/example/custom/domain/custom.read.process.ts @@ -4,7 +4,7 @@ export class CustomReadProcess extends PrismaReadProcess { customResult; async before(): Promise { - console.log('The ID requested in path parameter', this.id); + console.log('The ID requested in path parameter', this.identity); } async after(): Promise { this.customResult = {