@@ -12,7 +12,7 @@ import {
12
12
Query ,
13
13
UseGuards ,
14
14
} from '@nestjs/common' ;
15
- import { ApiTags } from '@nestjs/swagger' ;
15
+ import { ApiOperation , ApiTags } from '@nestjs/swagger' ;
16
16
import { Types } from 'mongoose' ;
17
17
import { BasicInventoryItemDto , InventoryItemDto , PageDto } from 'shared-types' ;
18
18
import { AuthenticatedGuard } from '../../auth/guards/authenticated.guard' ;
@@ -35,7 +35,7 @@ export class InventoryController {
35
35
constructor ( private readonly inventoryService : InventoryService ) { }
36
36
37
37
@Post ( )
38
- @HttpCode ( 201 )
38
+ @ApiOperation ( { summary : 'Create new inventory item' } )
39
39
async create ( @Body ( SecurityValidationPipe ) dto : CreateInventoryItemDto ) {
40
40
const warehouseId = new Types . ObjectId ( dto . warehouseId ) ;
41
41
const productId = new Types . ObjectId ( dto . productId ) ;
@@ -52,6 +52,7 @@ export class InventoryController {
52
52
53
53
@Put ( ':id' )
54
54
@HttpCode ( 200 )
55
+ @ApiOperation ( { summary : 'Update inventory item by id' } )
55
56
async update (
56
57
@Param ( 'id' , ParseObjectIdPipe ) id : Types . ObjectId ,
57
58
@Body ( SecurityValidationPipe ) dto : UpdateInventoryItemDto ,
@@ -61,11 +62,13 @@ export class InventoryController {
61
62
62
63
@Delete ( ':id' )
63
64
@HttpCode ( 200 )
65
+ @ApiOperation ( { summary : 'Delete inventory item by id' } )
64
66
async delete ( @Param ( 'id' , ParseObjectIdPipe , HasInventoryAccessPipe ) id : Types . ObjectId ) {
65
67
await this . inventoryService . delete ( id ) ;
66
68
}
67
69
68
70
@Get ( 'by-product' )
71
+ @ApiOperation ( { summary : 'Get inventory item by warehouse id and product id' } )
69
72
async findByProduct (
70
73
@Query ( 'warehouseId' , ParseObjectIdPipe , HasWarehouseAccessPipe ) warehouseId : Types . ObjectId ,
71
74
@Query ( 'productId' , ParseObjectIdPipe , HasProductAccessPipe ) productId : Types . ObjectId ,
@@ -80,6 +83,7 @@ export class InventoryController {
80
83
}
81
84
82
85
@Get ( 'by-warehouse/:id' )
86
+ @ApiOperation ( { summary : 'List inventory items in warehouse' } )
83
87
async list (
84
88
@Param ( 'id' , ParseObjectIdPipe , HasWarehouseAccessPipe ) warehouseId : Types . ObjectId ,
85
89
@Query (
@@ -100,6 +104,7 @@ export class InventoryController {
100
104
}
101
105
102
106
@Get ( ':id' )
107
+ @ApiOperation ( { summary : 'Get inventory item by id' } )
103
108
async findOne (
104
109
@Param ( 'id' , ParseObjectIdPipe , HasInventoryAccessPipe ) id : Types . ObjectId ,
105
110
) : Promise < InventoryItemDto > {
0 commit comments