mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-21 19:06:21 +00:00
feat: more specific fine grain controller
This commit is contained in:
parent
80c934b5b2
commit
0c86c9ed88
10
README.md
10
README.md
@ -23,16 +23,6 @@ Nest Auto CRUD is a library that provides a set of modules, decorator, service,
|
|||||||
- Custom body mapping
|
- Custom body mapping
|
||||||
- Custom validation
|
- Custom validation
|
||||||
|
|
||||||
### Tailored Controller Abstraction
|
|
||||||
|
|
||||||
- Controller options for only read and update
|
|
||||||
- Controller options for only create and delete
|
|
||||||
- Controller options for only read
|
|
||||||
- Controller options for only update
|
|
||||||
- Controller options for only create
|
|
||||||
- Controller options for only delete
|
|
||||||
- Controller options for only read and create
|
|
||||||
|
|
||||||
### Advanced Support
|
### Advanced Support
|
||||||
|
|
||||||
- Generic support for Prisma ORM [#5273](https://github.com/prisma/prisma/issues/5273)
|
- Generic support for Prisma ORM [#5273](https://github.com/prisma/prisma/issues/5273)
|
||||||
|
@ -35,7 +35,7 @@ import {
|
|||||||
ISkeletonUpdateController,
|
ISkeletonUpdateController,
|
||||||
} from './interfaces/controller/skeleton-crud.controller.interface';
|
} from './interfaces/controller/skeleton-crud.controller.interface';
|
||||||
|
|
||||||
export class SkeletonReadController implements ISkeletonReadController {
|
export class SkeletonDetailController implements ISkeletonReadController {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(READ_PROCESS)
|
@Inject(READ_PROCESS)
|
||||||
public readonly readProcess,
|
public readonly readProcess,
|
||||||
@ -71,6 +71,48 @@ export class SkeletonListController implements ISkeletonListController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SkeletonCRController
|
||||||
|
implements ISkeletonCreateController, ISkeletonReadController
|
||||||
|
{
|
||||||
|
constructor(
|
||||||
|
@Inject(READ_PROCESS)
|
||||||
|
public readonly readProcess,
|
||||||
|
@Inject(CREATE_PROCESS)
|
||||||
|
public readonly createProcess,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
async read(@Param('id') identity) {
|
||||||
|
return await ReadExecutor.bootstrap(this.readProcess, identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
async create(@Body() body) {
|
||||||
|
return await CreateExcutor.bootstrap(this.createProcess, body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SkeletonURController
|
||||||
|
implements ISkeletonUpdateController, ISkeletonReadController
|
||||||
|
{
|
||||||
|
constructor(
|
||||||
|
@Inject(READ_PROCESS)
|
||||||
|
public readonly readProcess,
|
||||||
|
@Inject(UPDATE_PROCESS)
|
||||||
|
public readonly updateProcess,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
async read(@Param('id') identity) {
|
||||||
|
return await ReadExecutor.bootstrap(this.readProcess, identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Patch(':id')
|
||||||
|
async update(@Param('id') identity, @Body() body) {
|
||||||
|
return await UpdateExecutor.bootstrap(this.updateProcess, identity, body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class SkeletonPaginationController
|
export class SkeletonPaginationController
|
||||||
implements ISkeletonPaginationController
|
implements ISkeletonPaginationController
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user