mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-22 03:16:21 +00:00
wip: typesafety for id type
This commit is contained in:
parent
ce6cc37650
commit
6fa469f5d7
@ -1,8 +1,8 @@
|
||||
import { IPaginationEntity } from '@autocrud/skeleton/entities/pagination.entity';
|
||||
|
||||
export interface ISkeletonCRUDController<T> {
|
||||
export interface ISkeletonCRUDController<T, E> {
|
||||
create(): Promise<T>;
|
||||
readSelected(id): Promise<T>;
|
||||
readSelected(id: E): Promise<T>;
|
||||
readPagination(): Promise<IPaginationEntity<T>>;
|
||||
readEntire(): Promise<T[]>;
|
||||
updatePartial(): Promise<T>;
|
||||
|
@ -2,14 +2,16 @@ 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<T> implements ISkeletonCRUDController<T> {
|
||||
export class SkeletonCRUDController<T, E>
|
||||
implements ISkeletonCRUDController<T, E>
|
||||
{
|
||||
@Post()
|
||||
async create(): Promise<T> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async readSelected(@Param('id') id): Promise<T> {
|
||||
async readSelected(@Param('id') id: E): Promise<T> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user