@@ -9,13 +9,23 @@ import {
9
9
Put ,
10
10
UseGuards ,
11
11
} from '@nestjs/common' ;
12
- import { ApiTags } from '@nestjs/swagger' ;
12
+ import {
13
+ ApiBadRequestResponse ,
14
+ ApiBearerAuth ,
15
+ ApiInternalServerErrorResponse ,
16
+ ApiOkResponse ,
17
+ ApiTags ,
18
+ ApiUnauthorizedResponse ,
19
+ } from '@nestjs/swagger' ;
13
20
14
21
import { SupplyCategoriesService } from './supply-categories.service' ;
15
22
import { ServerResponse } from '../utils' ;
16
23
import { AdminGuard } from '@/guards/admin.guard' ;
24
+ import { CreateSupplyCategoryDTO } from './dtos/CreateSupplyCategoryDTO' ;
25
+ import { UpdateSupplyCategoryDTO } from './dtos/UpdateSupplyCategoryDTO' ;
17
26
18
27
@ApiTags ( 'Categoria de Suprimentos' )
28
+ @ApiInternalServerErrorResponse ( )
19
29
@Controller ( 'supply-categories' )
20
30
export class SupplyCategoriesController {
21
31
private logger = new Logger ( SupplyCategoriesController . name ) ;
@@ -24,6 +34,7 @@ export class SupplyCategoriesController {
24
34
private readonly supplyCategoryServices : SupplyCategoriesService ,
25
35
) { }
26
36
37
+ @ApiOkResponse ( )
27
38
@Get ( '' )
28
39
async index ( ) {
29
40
try {
@@ -39,9 +50,13 @@ export class SupplyCategoriesController {
39
50
}
40
51
}
41
52
53
+ @ApiBearerAuth ( )
54
+ @ApiUnauthorizedResponse ( )
55
+ @ApiBadRequestResponse ( )
56
+ @ApiOkResponse ( )
42
57
@Post ( '' )
43
58
@UseGuards ( AdminGuard )
44
- async store ( @Body ( ) body ) {
59
+ async store ( @Body ( ) body : CreateSupplyCategoryDTO ) {
45
60
try {
46
61
const data = await this . supplyCategoryServices . store ( body ) ;
47
62
return new ServerResponse (
@@ -55,9 +70,13 @@ export class SupplyCategoriesController {
55
70
}
56
71
}
57
72
73
+ @ApiBearerAuth ( )
74
+ @ApiUnauthorizedResponse ( )
75
+ @ApiBadRequestResponse ( )
76
+ @ApiOkResponse ( )
58
77
@Put ( ':id' )
59
78
@UseGuards ( AdminGuard )
60
- async update ( @Param ( 'id' ) id : string , @Body ( ) body ) {
79
+ async update ( @Param ( 'id' ) id : string , @Body ( ) body : UpdateSupplyCategoryDTO ) {
61
80
try {
62
81
const data = await this . supplyCategoryServices . update ( id , body ) ;
63
82
return new ServerResponse (
0 commit comments