-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
538 lines (506 loc) · 13.8 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
swagger: "2.0"
info:
description: "This is a sample Asset management server.\n You can find out more about Tarento at [https://www.tarento.com/](https://www.tarento.com/)\n or on twitter [https://www.linkedin.com/company/tarento-group/mycompany/](https://www.linkedin.com/company/tarento-group/mycompany/).\n For this sample, you can use the api key `special-key` to test the authorization filters."
version: "1.0.0"
title: "Asset Management"
termsOfService: "localhost:8084/terms"
contact:
email: "[email protected]"
license:
name: "Careers"
url: "https://www.tarento.com/careers/"
host: "localhost:8084"
basePath: "/org/v1"
tags:
- name: "Admin"
description: "Admin services on the assets"
- name: "User"
description: "Operations performed by user"
- name: "Approver"
description: "Response by Manager/Super admin"
schemes:
- "http"
paths:
/admin/asset/{id}:
get:
tags:
- "Admin"
summary: "Get asset by asset id"
description: "Enter the asset id to find out the details of the assets"
operationId: "getAssetById"
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "The id of asset,details to be fetched "
required: true
type: "number"
responses:
200:
description: "OK - successfully found the asset"
schema:
$ref: '#/definitions/AddAsset'
"400":
description: "Bad request - Invalid assetId supplied"
"404":
description: "Asset not found"
"500":
description: "Internal server error"
security:
- asset_auth:
- "read:assets"
- api_key: []
/admin/asset/save:
post:
tags:
- "Admin"
summary: "Add asset to the system"
description: "Add the asset details to the system"
operationId: "saveAsset"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Add asset object"
required: true
schema:
$ref: "#/definitions/AddAsset"
responses:
200:
description: "OK - successfully added the asset"
schema:
$ref: '#/definitions/Asset'
"400":
description: "Bad request - Invalid details supplied"
"500":
description: "Internal server error"
/admin/asset/update/{id}:
patch:
tags:
- "Admin"
summary: "Update assets by id"
description: "Update the asset details present in the system"
operationId: "updateAssetById"
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "The id of asset,details to be updated "
required: true
type: "number"
- in: "body"
name: "body"
description: "Updated asset object"
required: true
schema:
$ref: "#/definitions/Update"
responses:
200:
description: "OK - successfully updated the asset"
schema:
$ref: '#/definitions/AddAsset'
"400":
description: "Bad request - Invalid details supplied"
"404":
description: "Asset not found"
"500":
description: "Internal server error"
/admin/asset/assign:
post:
tags:
- "Admin"
summary: "assign the asset to the requested user"
description: "When user request for asset the request is analysed and then approved, once approved the asset is assigned to the user"
operationId: "assignAsset"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Assigned asset details is updated in asset table according to user details"
required: true
schema:
$ref: '#/definitions/Assign'
responses:
200:
description: "OK - successfully assigned the asset"
"400":
description: "Bad request - Invalid asset parameter supplied"
"500":
description: "Internal server error"
/admin/asset/unAssigned:
get:
tags:
- "Admin"
summary: "get the list of all unassigned asset"
description: "Fetch all the unassigned asset from the system"
operationId: "getUnassignedAsset"
produces:
- "application/json"
responses:
200:
description: "OK - successfully found the unassigned asset"
schema:
$ref: '#/definitions/GetAssets'
"400":
description: "Invalid request supplied"
"500":
description: "Internal server error"
/admin/asset/defect/{status}:
get:
tags:
- "Admin"
summary: "get the list of all damaged/lost asset"
description: "Fetch all the damaged/lost asset from the system"
operationId: "getDefectAsset"
produces:
- "application/json"
parameters:
- in: "path"
required: true
type: "string"
name: "status"
description: "Status include lost/damaged"
responses:
200:
description: "OK - successfully found the damaged asset"
schema:
$ref: '#/definitions/GetAssets'
"400":
description: "Invalid request supplied"
"500":
description: "Internal server error"
/admin/asset/action:
post:
tags:
- "Admin"
summary: "Actions taken on lost/damaged assets"
description: "Action taken when user has lost/damaged the assets"
operationId: "action"
produces:
- "application/json"
parameters:
- name: body
in: body
description: "userId, assetId, actions and comments on the action taken"
schema:
$ref: '#/definitions/AssetAction'
responses:
200:
description: "OK - successful action taken against the asset"
400:
description: "Invalid action supplied"
500:
description: "Internal server error"
/user/asset/request:
post:
tags:
- "User"
summary: "User request for asset"
description: "User raise request to get the required asset"
operationId: "request"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "User id along with type and description of asset required"
required: true
schema:
$ref: '#/definitions/Request'
responses:
200:
description: "OK - successfully raised the request for the asset"
"400":
description: "Invalid request supplied"
"500":
description: "Internal server error"
/user/asset/return:
post:
tags:
- "User"
summary: "User request to return asset"
description: "User request to return the asset"
operationId: "return"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "User id along with assetId and message is required"
required: true
schema:
$ref: '#/definitions/Return'
responses:
200:
description: "OK - successfully raised the request to return the asset"
"400":
description: "Invalid request supplied"
"500":
description: "Internal server error"
/user/asset/lost:
post:
tags:
- "User"
summary: "User request to claim asset as lost/damaged"
description: "User reports to company regarding the status of the asset"
operationId: "claim"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "User id along with assetId is and status of asset is required"
required: true
schema:
$ref: '#/definitions/UserAssetStatus'
responses:
200:
description: "OK - successfully notified the lost/damage of asset"
"400":
description: "Invalid request supplied"
"500":
description: "Internal server error"
/approver/asset/manage:
post:
tags:
- "Approver"
summary: "Approve/Disapprove user request for asset"
description: "When user raises request for the asset, the asset availability is checked and then the asset is approved/rejected for alloting"
operationId: "manage"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "action either approve or reject"
required: true
schema:
$ref: '#/definitions/Manage'
responses:
200:
description: "OK - successfully managed the request"
"400":
description: "Invalid request supplied"
"500":
description: "Internal server error"
/approver/asset/{projectId}:
get:
tags:
- "Approver"
summary: "get the list of all asset for the project"
description: "Fetch all the asset from the system for the project with id supplied"
operationId: "getAssetByProject"
produces:
- "application/json"
parameters:
- name: "projectId"
in: "path"
description: "The asset details of a project that needs to be fetched. "
required: true
type: "number"
responses:
200:
description: "OK - successfully listed the asset"
schema:
$ref: '#/definitions/AssetByProject'
"400":
description: "Invalid projectId supplied"
"500":
description: "Internal server error"
securityDefinitions:
asset_auth:
type: "oauth2"
authorizationUrl: "localhost:8084/oauth/dialog"
flow: "implicit"
scopes:
write:assets: "modify assets in your account"
read:assets: "read your assets"
api_key:
type: "apiKey"
name: "api_key"
in: "header"
definitions:
Asset:
type: "object"
properties:
assetId:
type: integer
type:
type: string
enum:
- "Laptop"
- "Mobile"
- "Charger"
- "Desktop"
- "CPU"
description:
type: string
brandName:
type: string
uniqueNumber:
type: string
modelNumber:
type: string
purchaseDate:
type: string
format: "date"
status:
type: string
description: "asset Status"
enum:
- "Good"
- "Damaged"
- "Lost"
warrantyExists:
type: boolean
warrantyEndDate:
type: string
format: "date"
owner:
type: integer
format: "int32"
AddAsset:
type: "object"
properties:
type:
type: string
enum:
- "Laptop"
- "Mobile"
- "Charger"
- "Desktop"
- "CPU"
description:
type: string
brandName:
type: string
uniqueNumber:
type: string
modelNumber:
type: string
purchaseDate:
type: string
format: "date"
status:
type: string
description: "asset Status"
enum:
- "Good"
- "Damaged"
- "Lost"
warrantyExists:
type: boolean
warrantyEndDate:
type: string
format: "date"
owner:
type: integer
format: "int32"
Update:
type: "object"
properties:
type:
type: string
enum:
- "Laptop"
- "Mobile"
- "Charger"
- "Desktop"
- "CPU"
description:
type: string
status:
type: string
description: "asset Status"
enum:
- "Good"
- "Damaged"
- "Lost"
owner:
type: integer
format: "int32"
GetAssets:
type: object
properties:
assetId:
type: integer
Assign:
type: object
properties:
userId:
type: integer
assetId:
type: integer
Request:
type: object
properties:
userId:
type: integer
assetType:
type: string
enum:
- "Laptop"
- "Mobile"
- "Charger"
- "Desktop"
- "CPU"
description:
type: string
managerId:
type: integer
AssetAction:
type: object
properties:
userId:
type: integer
assetId:
type: integer
action:
type: string
enum:
- "Pending"
- "Initiated"
- "Resolved"
comments:
type: string
Return:
type: object
properties:
userId:
type: integer
assetId:
type: integer
message:
type: string
UserAssetStatus:
type: object
properties:
userId:
type: integer
assetId:
type: integer
assetStatus:
type: "string"
example: "lost"
Manage:
type: object
properties:
action:
type: string
enum:
- "approve"
- "reject"
AssetByProject:
type: object
properties:
assetId:
type: integer
userId:
type: integer
externalDocs:
description: "Find out more about Tarento"
url: "https://www.tarento.com"