@@ -8,22 +8,133 @@ const router: Router = Router();
8
8
9
9
/* Note: these routes already have '/customers' part on them */
10
10
11
- // Todo: swagger doc!
11
+ /**
12
+ * @swagger
13
+ * /customers/:
14
+ * get:
15
+ * description: Get all customers
16
+ * tags: ["Customers"]
17
+ * security:
18
+ * - bearerAuth: []
19
+ * requestBody:
20
+ * description: retrieves all customers, organization id for filtering is coming from jwt token
21
+ * required: true
22
+ * content:
23
+ * application/json:
24
+ * schema:
25
+ * $ref: ''
26
+ */
12
27
router . get ( '/' , CustomerComponent . getAll ) ; // Retrieves a list of customers
13
28
14
- // Todo: swagger doc!
29
+ /**
30
+ * @swagger
31
+ * /customers/{customerId}:
32
+ * get:
33
+ * description: Get customer with given customer id
34
+ * summary: Get a customer by ID
35
+ * parameters:
36
+ * - in: path
37
+ * name: customerId
38
+ * schema:
39
+ * type: integer
40
+ * required: true
41
+ * description: Numeric ID of the customer to get
42
+ * tags: ["Customers"]
43
+ * security:
44
+ * - bearerAuth: []
45
+ * requestBody:
46
+ * description: retrieves customer given as url parameter, organization id for filtering is coming from jwt token
47
+ * required: true
48
+ * content:
49
+ * application/json:
50
+ * schema:
51
+ * $ref: ''
52
+ * responses:
53
+ * 201:
54
+ * description: return created customer
55
+ * content:
56
+ * application/json:
57
+ * schema:
58
+ * oneOf:
59
+ * - $ref: ''
60
+ * default:
61
+ * description: unexpected error
62
+ * content:
63
+ * application/json:
64
+ * schema:
65
+ * $ref: ''
66
+ */
15
67
router . get ( '/:customerId' , CustomerComponent . getOne ) ; // Retrieves a specific customer
16
68
17
- // Todo: swagger doc!
69
+ /**
70
+ * @swagger
71
+ * /customers/:
72
+ * post:
73
+ * description: Create new customer
74
+ * tags: ["Customers"]
75
+ * security:
76
+ * - bearerAuth: []
77
+ * requestBody:
78
+ * description: customer creation request body
79
+ * required: true
80
+ * content:
81
+ * application/json:
82
+ * schema:
83
+ * $ref: ''
84
+ * example:
85
+ * customer_name: Test Customer
86
+ * customer_description: Customer for testing purposes
87
+ * responses:
88
+ * 201:
89
+ * description: return created customer
90
+ * content:
91
+ * application/json:
92
+ * schema:
93
+ * oneOf:
94
+ * - $ref: ''
95
+ * default:
96
+ * description: unexpected error
97
+ * content:
98
+ * application/json:
99
+ * schema:
100
+ * $ref: ''
101
+ */
18
102
router . post ( '/' , CustomerComponent . create ) ; // Create a new customer
19
103
20
- // Todo: swagger doc!
104
+ // Todo: improve swagger doc!
105
+ /**
106
+ * @swagger
107
+ * /customers/{customerId}:
108
+ * put:
109
+ * description: Update customer
110
+ * tags: ["Customers"]
111
+ * security:
112
+ * - bearerAuth: []
113
+ */
21
114
router . put ( '/:customerId' , CustomerComponent . update ) ; // Updates customer
22
115
23
- // Todo: swagger doc!
116
+ // Todo: improve swagger doc!
117
+ /**
118
+ * @swagger
119
+ * /customers/{customerId}:
120
+ * patch:
121
+ * description: Partially update customer
122
+ * tags: ["Customers"]
123
+ * security:
124
+ * - bearerAuth: []
125
+ */
24
126
router . patch ( '/:customerId' , CustomerComponent . update ) ; // Partial update for one customer
25
127
26
- // Todo: swagger doc!
128
+ // Todo: improve swagger doc!
129
+ /**
130
+ * @swagger
131
+ * /customers/{customerId}:
132
+ * delete:
133
+ * description: Delete customer with customerId
134
+ * tags: ["Customers"]
135
+ * security:
136
+ * - bearerAuth: []
137
+ */
27
138
router . delete ( '/:customerId' , CustomerComponent . deleteOne ) ; // Delete customer
28
139
29
140
0 commit comments