diff --git a/libs/skeleton/src/entities/pagination.entity.ts b/libs/skeleton/src/entities/pagination.entity.ts new file mode 100644 index 0000000..78d3500 --- /dev/null +++ b/libs/skeleton/src/entities/pagination.entity.ts @@ -0,0 +1,13 @@ +export interface IPaginationEntity { + // Data related + data: T[]; + totalData: number; + + // Page related + totalPage: number; + currentPage: number; + lastPage: number; + perPage: number; + nextPage: number | null; + previousPage: number | null; +} diff --git a/libs/skeleton/src/interfaces/controller/skeleton-crud.controller.interface.ts b/libs/skeleton/src/interfaces/controller/skeleton-crud.controller.interface.ts index 6c3e672..bf33f46 100644 --- a/libs/skeleton/src/interfaces/controller/skeleton-crud.controller.interface.ts +++ b/libs/skeleton/src/interfaces/controller/skeleton-crud.controller.interface.ts @@ -1,12 +1,14 @@ -export interface ISkeletonCRUDController { - create(); - readSelected(id); - readPagination(); - readEntire(); - updatePartial(); - updatePartialBatch(); - updateEntire(); - updateEntirePatch(); - deleteSelected(); - deleteBatch(); +import { IPaginationEntity } from '@autocrud/skeleton/entities/pagination.entity'; + +export interface ISkeletonCRUDController { + create(): Promise; + readSelected(id): Promise; + readPagination(): Promise>; + readEntire(): Promise; + updatePartial(): Promise; + updatePartialBatch(): Promise; + updateEntire(): Promise; + updateEntireBatch(): Promise; + deleteSelected(): Promise; + deleteBatch(): Promise; } diff --git a/libs/skeleton/src/interfaces/skeleton-process.interface.ts b/libs/skeleton/src/interfaces/skeleton-process.interface.ts index 1815302..6370de0 100644 --- a/libs/skeleton/src/interfaces/skeleton-process.interface.ts +++ b/libs/skeleton/src/interfaces/skeleton-process.interface.ts @@ -1,10 +1,10 @@ -export interface SkeletonProcess { - initialization(): void; - before(): void; - begin(): void; - process(): void; - end(): void; - after(): void; +import { Observable } from 'rxjs'; - result(); +export interface SkeletonProcess { + initialization(): Observable; + before(): Observable; + begin(): Observable; + process(): Observable; + end(): Observable; + after(): Observable; } diff --git a/libs/skeleton/src/skeleton-crud.controller.ts b/libs/skeleton/src/skeleton-crud.controller.ts index af90e2a..444b1c0 100644 --- a/libs/skeleton/src/skeleton-crud.controller.ts +++ b/libs/skeleton/src/skeleton-crud.controller.ts @@ -1,34 +1,55 @@ import { Delete, Get, Param, Patch, Post, Put } from '@nestjs/common'; import { ISkeletonCRUDController } from './interfaces/controller/skeleton-crud.controller.interface'; +import { IPaginationEntity } from './entities/pagination.entity'; -export class SkeletonCRUDController implements ISkeletonCRUDController { +export class SkeletonCRUDController implements ISkeletonCRUDController { @Post() - create() {} + async create(): Promise { + throw new Error('Method not implemented.'); + } @Get(':id') - readSelected(@Param('id') id) {} + async readSelected(@Param('id') id): Promise { + throw new Error('Method not implemented.'); + } @Get() - readPagination() {} + async readPagination(): Promise> { + throw new Error('Method not implemented.'); + } @Get('list') - readEntire() {} + async readEntire(): Promise { + throw new Error('Method not implemented.'); + } @Patch() - updatePartial() {} + async updatePartial(): Promise { + throw new Error('Method not implemented.'); + } @Patch('batch') - updatePartialBatch() {} + async updatePartialBatch(): Promise { + throw new Error('Method not implemented.'); + } @Put() - updateEntire() {} + async updateEntire(): Promise { + throw new Error('Method not implemented.'); + } @Put('batch') - updateEntirePatch() {} + async updateEntireBatch(): Promise { + throw new Error('Method not implemented.'); + } @Delete() - deleteSelected() {} + async deleteSelected(): Promise { + throw new Error('Method not implemented.'); + } @Delete('batch') - deleteBatch() {} + async deleteBatch(): Promise { + throw new Error('Method not implemented.'); + } }