-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendnodes.yaml
650 lines (626 loc) · 17.5 KB
/
sendnodes.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
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
swagger: '2.0'
info:
version: '1.0'
title: "Seat&Meals API"
description: API for the university canteen. It allows to visualize the list of the seats available, to book a seat, to visualize the canteen menu and to make reviews about it. All APIs are tested with request data passed trough 'query params' section in Postman.
license:
name: Seat&Meals API
url: https://github.com/Spanix98/ingso2
contact:
email: fabio.spano@studenti.unitn.it
host: bookmealunitn.herokuapp.com
basePath: /
tags:
- name: "USERS"
- name: "MEALS"
- name: "SEATS"
- name: "BOOKS"
- name: "REVIEWS"
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/api/v1/users:
post:
tags:
- "Users"
summary: "Create new user"
description: "The user can create a new user by putting the email and the id."
operationId: "addUser"
parameters:
- in: query
name: email
description: "The user email. Example: france@gmail.com"
type: string
required: true
- in: query
name: mat
description: "The user id. Example: 111111"
type: string
required: true
responses:
201:
description: "User correctly created"
schema:
type: object
items:
$ref: '#/definitions/userview'
example:
- email: francesco@gmail.com
mat: 111111
400:
description: "ERROR 400: User not created maybe for a mistake in the query params!"
500:
description: "ERROR 500: Local server error"
get:
tags:
- "Users"
summary: "View all the users"
description: "For each user are shown the email and the id."
operationId: "showAllUsers"
responses:
200:
description: "List of users found!"
schema:
type: array
items:
$ref: '#/definitions/userview'
example:
- email: france@gmail.com
mat: 111112
- email: fabio@yahoo.it
mat: 111111
404:
description: "No users found!"
500:
description: "ERROR 500: Local server error"
delete:
tags:
- "Users"
summary: "Delete all the users"
description: "All the users are eliminated."
operationId: "deleteAllUsers"
responses:
200:
description: "All users are cancelled"
404:
description: "ERROR 404: All users are already cancelled"
500:
description: "ERROR 500: Local server error"
put:
tags:
- "User"
summary: "Update the user who has that id."
description: "The user email is modified"
operationId: "updateUser"
parameters:
- in: query
name: email
description: "The user email. Example: fra@gmail.com"
type: string
required: true
- in: query
name: mat
description: "The user id. Example: 111111"
type: string
required: true
responses:
201:
description: "User correctly modified"
400:
description: "User not found"
500:
description: "ERROR 500: Local server error"
/api/v1/users/{user_mat}:
get:
tags:
- "Users"
summary: "View the user information."
description: "The user is shown."
operationId: "showUser"
parameters:
- in: "path"
name: "user_mat"
description: "Id of the user to get"
required: true
type: "string"
format: "string"
responses:
200:
description: "User correctly found"
schema:
type: object
items:
$ref: '#/definitions/userview'
example:
- email: francesco@gmail.com
mat: 111110
404:
description: "User not found"
500:
description: "ERROR 500: Local server error"
delete:
tags:
- "User"
summary: "Delete the user"
description: "The user is eliminated"
operationId: "deleteUser"
parameters:
- in: "path"
name: "user_mat"
description: "ID of user to delete"
required: true
type: "string"
format: "string64"
responses:
200:
description: "Successfully deleted"
404:
description: "Invalid matricola"
500:
description: "ERROR 500: Local server error"
/api/v1/meals:
post:
tags:
- "Meals"
summary: "Create a new meal"
description: "The administrator creates a new meal for a specific date. You can put one meal for date."
operationId: "addMeals"
parameters:
- in: query
name: first
description: "The first plate. Example: pasta"
type: string
required: true
- in: query
name: second
description: "The second plate. Example: carne"
type: string
required: true
- in: query
name: dessert
description: "The dessert. Example: torta"
type: string
required: true
- in: query
name: date
description: "The date of the meal. Example: dd-mm-yyyy"
type: string
required: true
responses:
201:
description: "Meal correctly created"
400:
description: "ERROR 400: Meal not created. There is a mistake in the syntax"
500:
description: "ERROR 500: Local server error"
get:
tags:
- "Meals"
summary: "View all the meals"
description: "Meals are shown."
operationId: "showAllMeals"
responses:
200:
description: "Meals found!"
schema:
type: array
items:
$ref: '#/definitions/mealview'
example:
- first: pasta
second: carne
dessert: budino
date: 11-11-2011
mealid: 65vhsfbhj
- first: riso
second: pesce
dessert: frutta
date: 08-06-2019
mealid: 65vhdfbhj
404:
description: "ERROR 404: No meals found!"
500:
description: "ERROR 500: Local server error"
delete:
tags:
- "Meals"
summary: "Delete all the meals"
description: "Delete the entire list of meals"
operationId: "deleteMeals"
responses:
200:
description: "All meals are cancelled"
400:
description: "ERROR 404: All meals are already cancelled"
500:
description: "ERROR 500: Local server error"
/api/v1/meals/{date}:
get:
tags:
- "Meals"
summary: "View a meal in a specific date."
description: "The meal is shown."
operationId: "showMealDate"
parameters:
- in: "path"
name: "date"
description: "Date of meal to get"
required: true
type: "string"
format: "string"
responses:
200:
description: "Meal correctly found!"
schema:
type: object
items:
$ref: '#/definitions/mealview'
example:
- first: pasta
second: carne
dessert: budino
date: 11-11-2011
mealid: 65vhsfbhj
404:
description: "ERROR 404: Meal not found"
500:
description: "ERROR 500: Local server error!"
/api/v1/seats:
get:
tags:
- "Seats"
summary: "Return the list of all seats."
description: "All the seats are printed."
operationId: "getSeats"
responses:
200:
description: "List of seats found!"
schema:
type: array
items:
$ref: '#/definitions/seats'
example:
- booked: false
seatid: 0
- booked: false
seatid: 1
- booked: true
seatid: 2
404:
description: "ERROR 404: No seats found!"
500:
description: "ERROR 500: Local server error!"
delete:
tags:
- "Seats"
summary: "Delete all the seats"
description: "All the seats are deleted"
operationId: "deleteSeat"
responses:
200:
description: "List of seats deleted!"
400:
description: "ERROR 404: No seats found!"
500:
description: "ERROR 500: Local server error!"
/api/v1/seats/{nseats}:
post:
tags:
- "Seats"
summary: "Add seats"
description: "A specific number of seats is added."
operationId: "showSeat"
parameters:
- in: "path"
name: "nseats"
description: "Number of seats to insert"
required: true
type: "integer"
format: "int64"
responses:
201:
description: "Seats correctly created"
schema:
type: array
items:
$ref: '#/definitions/seats'
example:
- booked: false
seatid: 0
- booked: false
seatid: 1
- booked: true
seatid: 2
400:
description: "ERROR 400: Seats not created!"
500:
description: "ERROR 500: Local server error!"
/api/v1/books:
get:
tags:
- "Books"
summary: "Return the list of all bookings."
description: "All the bookings are printed."
operationId: "getBookings"
responses:
200:
description: "List of books found!"
schema:
type: array
items:
$ref: '#/definitions/bookview'
example:
- seatid: 2
date: 2019-12-10T18:09:16.543Z
user: 111110
id: 23frwbegsne
- seatid: 5
date: 2015-11-10T12:10:16.543Z
user: 111111
id: 23frvggfsne
404:
description: "ERROR 404: No books found!"
500:
description: "ERROR 500: Local server error!"
delete:
tags:
- "Books"
summary: "Delete all the bookings"
description: "All the bookings are deleted"
operationId: "deleteBookings"
responses:
200:
description: "List of books deleted!"
400:
description: "ERROR 404: No books found!"
500:
description: "ERROR 500: Local server error!"
/api/v1/books/{user_mat}:
post:
tags:
- "Books"
summary: "Create a seat booking."
description: "The user books a seat in the canteen. You can book a seat which is not already booked. The booking duration is of one day."
operationId: "addBooking"
parameters:
- in: "path"
name: "user_mat"
description: "Id of the user who are making the booking"
required: true
type: "string"
format: "string"
- in: query
name: seatid
description: "The seat id. Examle: 3"
type: integer
required: true
responses:
201:
description: "Seats correctly booked"
400:
description: "ERROR 400: Seats does not exist or it is already booked"
404:
description: "ERROR 404: User not found"
500:
description: "ERROR 500: Local server error!"
get:
tags:
- "Books"
summary: "View the bookings of that user"
description: "Booking are shown"
operationId: "showBooksUser_mat"
parameters:
- in: "path"
name: "user_mat"
description: "ID of user to get"
required: true
type: "string"
format: "string"
responses:
200:
description: "List of books found!"
schema:
type: array
items:
$ref: '#/definitions/bookview'
example:
- seatid: 2
date: 2019-12-10T18:09:16.543Z
user: 111110
id: 23frwbegsne
- seatid: 5
date: 2015-11-10T12:10:16.543Z
user: 111111
id: 23frwbegsne
404:
description: "ERROR 404: No books found or user incorrect!"
500:
description: "ERROR 500: Local server error!"
put:
tags:
- "Books"
summary: "Update a booking of the user inserted and the id specified."
description: "The booking is update. The seat is changed if the inserted one is not already booked."
operationId: "updateBooking"
parameters:
- in: "path"
name: "user_mat"
description: "ID of user to get"
required: true
type: "string"
format: "string"
- in: query
name: bookid
description: "The booking id. Examle: 1gwejnbvjibijgsh734i8"
type: string
required: true
- in: query
name: seatid
description: "The seat id. Examle: 4"
type: integer
required: true
responses:
200:
description: "Book changed!"
400:
description: "ERROR 400: Book not changed because the user was incorrect or the booking does not exist!"
500:
description: "ERROR 500: Local server error!"
/api/v1/reviews:
post:
tags:
- "Reviews"
summary: "Create a new review"
description: "The user creates a new review for a specific meal. In case of errors the review will not be created. If the review is refered to a future meals, the system won't insert it."
operationId: "addReviews"
parameters:
- in: query
name: review
description: "The text of the review. Examle: blablabla"
type: string
required: true
- in: query
name: mealDate
description: "The date of the meal. Examle: dd-mm-yyyy"
type: string
required: true
responses:
201:
description: "Review correctly created"
400:
description: "ERROR 400: Review not created, probably no review written or the meal date is incorrect!"
500:
description: "ERROR 500: Local server error"
get:
tags:
- "Reviews"
summary: "Return the list of all reviews."
description: "All the reviews are printed."
operationId: "getReviews"
responses:
200:
description: "Reviews found!"
schema:
type: array
items:
$ref: '#/definitions/reviewview'
example:
- date: 2019-12-10T18:09:16.543Z
reviewText: blablabla
mealDate: 09-12-2018
reviewid: 12sfvaagbne
- date: 2011-10-10T18:10:16.543Z
reviewText: blabla
mealDate: 09-12-2018
id: 12sfhyibne
404:
description: "ERROR 404: No reviews found!"
500:
description: "ERROR 500: Local server error!"
delete:
tags:
- "Reviews"
summary: "Delete all the reviews"
description: "All the reviews are deleted"
operationId: "deleteReviews"
responses:
200:
description: "All reviews are cancelled"
400:
description: "ERROR 404: All reviews are already cancelled"
500:
description: "ERROR 500: Local server error!"
/api/v1/reviews/{review_id}:
get:
tags:
- "Reviews"
summary: "View a review with a specific id."
description: "The review is shown."
operationId: "showReviewById"
parameters:
- in: "path"
name: "review_id"
description: "Id of review to get"
required: true
type: "string"
format: "string"
responses:
200:
description: "Review correctly found!"
schema:
type: object
items:
$ref: '#/definitions/reviewview'
example:
- date: 2019-12-10T18:09:16.543Z
reviewText: blablabla
mealDate: 09-12-2018
reviewid: 12sfvaagbne
404:
description: "ERROR 404: Review not found!"
500:
description: "ERROR 500: Local server error!"
definitions:
userview:
type: "object"
properties:
email:
type: "string"
mat:
type: "string"
mealview:
type: "object"
properties:
first:
type: "string"
second:
type: "string"
dessert:
type: "string"
date:
type: "string"
mealid:
type: "string"
bookview:
type: "object"
properties:
seatid:
type: "integer"
date:
type: "string"
user:
type: "string"
id:
type: "string"
reviewview:
type: "object"
properties:
date:
type: "string"
reviewText:
type: "string"
mealDate:
type: "string"
reviewid:
type: "string"
seats:
type: "object"
properties:
seatid:
type: "integer"
booked:
type: "boolean"
ApiResponse:
type: "object"
properties:
code:
type: "integer"
format: "int32"
type:
type: "string"
message:
type: "string"