@@ -2,7 +2,8 @@ import { Get, Post, Put, Delete, Body, Param, HttpStatus } from '@nestjs/common'
2
2
import { ApiOperation , ApiResponse } from '@nestjs/swagger' ;
3
3
import { Base } from '../entities/base.entity' ;
4
4
import { DeepPartial } from 'typeorm' ;
5
- import { ICrudService } from './icube.service' ;
5
+ import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity' ;
6
+ import { ICrudService } from './icrud.service' ;
6
7
7
8
@ApiResponse ( { status : HttpStatus . UNAUTHORIZED , description : 'Unauthorized' } )
8
9
@ApiResponse ( { status : HttpStatus . FORBIDDEN , description : 'Forbidden' } )
@@ -31,7 +32,7 @@ export abstract class CrudController<T extends Base> {
31
32
description : 'Invalid input, The response body may contain clues as to what went wrong' ,
32
33
} )
33
34
@Post ( )
34
- async create ( @Body ( ) entity : DeepPartial < T > , options ? : any ) : Promise < T > {
35
+ async create ( @Body ( ) entity : DeepPartial < T > , ... options : any [ ] ) : Promise < T > {
35
36
return this . crudService . create ( entity ) ;
36
37
}
37
38
@@ -43,15 +44,15 @@ export abstract class CrudController<T extends Base> {
43
44
description : 'Invalid input, The response body may contain clues as to what went wrong' ,
44
45
} )
45
46
@Put ( ':id' )
46
- async update ( @Param ( 'id' ) id : string , @Body ( ) entity : DeepPartial < T > , options ? : any ) : Promise < any > {
47
+ async update ( @Param ( 'id' ) id : string , @Body ( ) entity : QueryDeepPartialEntity < T > , ... options : any [ ] ) : Promise < any > {
47
48
return this . crudService . update ( id , entity ) ; // FIXME: https://github.com/typeorm/typeorm/issues/1544
48
49
}
49
50
50
51
@ApiOperation ( { title : 'Delete record' } )
51
52
@ApiResponse ( { status : HttpStatus . NO_CONTENT , description : 'The record has been successfully deleted' } )
52
53
@ApiResponse ( { status : HttpStatus . NOT_FOUND , description : 'Record not found' } )
53
54
@Delete ( ':id' )
54
- async delete ( @Param ( 'id' ) id : string , options ? : any ) : Promise < any > {
55
+ async delete ( @Param ( 'id' ) id : string , ... options : any [ ] ) : Promise < any > {
55
56
return this . crudService . delete ( id ) ;
56
57
}
57
58
}
0 commit comments