-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
1170 lines (1117 loc) · 29.3 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
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
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
swagger: '2.0'
info:
title: Sunrise API
description: API for managing school endpoints in Sunrise
version: 1.0.0
host: localhost:5000
basePath: /api
schemes:
- http
paths:
/users:
post:
summary: Create a new user
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/User'
responses:
201:
description: User created successfully
400:
description: Invalid input
get:
summary: Get all users
responses:
200:
description: A list of users
schema:
type: array
items:
$ref: '#/definitions/User'
404:
description: No users found
/users/{user_id}:
get:
summary: Get a user by ID
parameters:
- in: path
name: user_id
type: string
required: true
description: The ID of the user
responses:
200:
description: A user
schema:
$ref: '#/definitions/User'
404:
description: User not found
put:
summary: Update a user by ID
parameters:
- in: path
name: user_id
type: string
required: true
description: The ID of the user
- in: body
name: body
schema:
$ref: '#/definitions/User'
responses:
200:
description: User updated successfully
404:
description: User not found
500:
description: User update failed
delete:
summary: Delete a user by ID
parameters:
- in: path
name: user_id
type: string
required: true
description: The ID of the user
responses:
200:
description: User deleted successfully
404:
description: User not found or delete failed
# Product paths
/products:
post:
summary: Add a new Product
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/Product'
responses:
201:
description: Product added successfully
400:
description: Invalid input
get:
summary: Get all products
responses:
200:
description: A list of all products
schema:
type: array
items:
$ref: '#/definitions/Product'
404:
description: No product found
/products/{product_id}:
get:
summary: Get a product by ID
parameters:
- in: path
name: product_id
type: string
required: true
description: The ID of the product
responses:
200:
description: A product
schema:
$ref: '#/definitions/Product'
404:
description: Product not found
put:
summary: Update the product by ID
parameters:
- in: path
name: product_id
type: string
required: true
description: The ID of the product
- in: body
name: body
schema:
$ref: '#/definitions/Product'
responses:
200:
description: Product updated successfully
404:
description: Product not found
500:
description: Product update failed
delete:
summary: Delete the product by ID
parameters:
- in: path
name: product_id
type: string
required: true
description: The ID of the product
responses:
200:
description: product deleted successfully
404:
description: product not found or delete failed
# teacher routes
/teachers:
post:
summary: Create a new teacher
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/Teacher'
responses:
201:
description: Teacher created successfully
400:
description: Invalid input
get:
summary: Get all teachers
responses:
200:
description: A list of teachers
schema:
type: array
items:
$ref: '#/definitions/Teacher'
404:
description: No teachers found
/teachers/{teacher_id}:
get:
summary: Get a teacher by ID
parameters:
- in: path
name: teacher_id
type: string
required: true
description: The ID of the teacher
responses:
200:
description: A teacher
schema:
$ref: '#/definitions/Teacher'
404:
description: Teacher not found
put:
summary: Update a teacher by ID
parameters:
- in: path
name: teacher_id
type: string
required: true
description: The ID of the teacher
- in: body
name: body
schema:
$ref: '#/definitions/Teacher'
responses:
200:
description: Teacher updated successfully
404:
description: Teacher not found
500:
description: Teacher update failed
delete:
summary: Delete a teacher by ID
parameters:
- in: path
name: teacher_id
type: string
required: true
description: The ID of the teacher
responses:
200:
description: Teacher deleted successfully
404:
description: Teacher not found or delete failed
/menus:
post:
summary: Create a new menu
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/Menu'
responses:
201:
description: Menu created successfully
400:
description: Invalid input
get:
summary: Get all menus
responses:
200:
description: A list of menus
schema:
type: array
items:
$ref: '#/definitions/Menu'
404:
description: No menus found
/menus/{menu_id}:
get:
summary: Get a menu by ID
parameters:
- in: path
name: menu_id
type: string
required: true
description: The ID of the menu
responses:
200:
description: A menu
schema:
$ref: '#/definitions/Menu'
404:
description: Menu not found
put:
summary: Update a menu by ID
parameters:
- in: path
name: menu_id
type: string
required: true
description: The ID of the menu
- in: body
name: body
schema:
$ref: '#/definitions/Menu'
responses:
200:
description: Menu updated successfully
404:
description: Menu not found
500:
description: Menu update failed
delete:
summary: Delete a menu by ID
parameters:
- in: path
name: menu_id
type: string
required: true
description: The ID of the menu
responses:
200:
description: Menu deleted successfully
404:
description: Menu not found or delete failed
/submenus:
post:
summary: Create a new submenu
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/Submenu'
responses:
201:
description: Submenu created successfully
400:
description: Invalid input
get:
summary: Get all submenus
responses:
200:
description: A list of submenus
schema:
type: array
items:
$ref: '#/definitions/Submenu'
404:
description: No submenus found
/submenus/{submenu_id}:
get:
summary: Get a submenu by ID
parameters:
- in: path
name: submenu_id
type: string
required: true
description: The ID of the submenu
responses:
200:
description: A submenu
schema:
$ref: '#/definitions/Submenu'
404:
description: Submenu not found
put:
summary: Update a submenu by ID
parameters:
- in: path
name: submenu_id
type: string
required: true
description: The ID of the submenu
- in: body
name: body
schema:
$ref: '#/definitions/Submenu'
responses:
200:
description: Submenu updated successfully
404:
description: Submenu not found
500:
description: Submenu update failed
delete:
summary: Delete a submenu by ID
parameters:
- in: path
name: submenu_id
type: string
required: true
description: The ID of the submenu
responses:
200:
description: Submenu deleted successfully
404:
description: Submenu not found or delete failed
/login:
post:
summary: User login
description: Authenticates a user and returns a JWT token.
parameters:
- in: body
name: body
required: true
description: User login credentials
schema:
type: object
required:
- email
- password
properties:
email:
type: string
format: email
example: "user@example.com"
password:
type: string
format: password
example: "password123"
responses:
200:
description: JWT token
schema:
type: object
properties:
access_token:
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
401:
description: Invalid email or password
500:
description: Internal server error
# Class
/classes:
post:
summary: 'Create a new class'
description: 'Creates a new class with the provided information.'
consumes:
- 'application/json'
produces:
- 'application/json'
parameters:
- in: 'body'
name: 'body'
description: 'Class object that needs to be added'
required: true
schema:
$ref: '#/definitions/Class'
responses:
201:
description: 'Class created successfully'
get:
summary: 'Get list of all classes'
description: 'Returns a list of all classes.'
produces:
- 'application/json'
responses:
200:
description: 'List of classes'
schema:
type: array
items:
$ref: '#/definitions/Class'
/classes/{class_id}:
get:
summary: 'Get class by ID'
description: 'Returns a class based on the ID provided.'
produces:
- 'application/json'
parameters:
- name: 'class_id'
in: 'path'
required: true
type: string
responses:
200:
description: 'Class retrieved successfully'
schema:
type: object
$ref: '#/definitions/Class'
404:
description: 'Class not found'
schema:
type: object
properties:
error:
type: string
example: 'Class not found'
put:
summary: 'Update class by ID'
description: 'Updates a class based on the ID provided.'
consumes:
- 'application/json'
produces:
- 'application/json'
parameters:
- name: 'class_id'
in: 'path'
required: true
type: string
- in: 'body'
name: 'body'
description: 'Class object with updated information'
required: true
schema:
type: object
$ref: '#/definitions/Class'
responses:
200:
description: 'Class updated successfully'
schema:
type: object
properties:
className:
type: string
classUrl:
type: string
aboutClass:
type: string
students:
type: string
404:
description: 'Class not found'
schema:
type: object
properties:
error:
type: string
example: 'Class not found'
delete:
summary: 'Delete class by ID'
description: 'Deletes a class based on the ID provided.'
produces:
- 'application/json'
parameters:
- name: 'class_id'
in: 'path'
required: true
type: string
responses:
200:
description: 'Class deleted successfully'
schema:
type: object
properties:
message:
type: string
example: 'Class deleted'
404:
description: 'Class not found'
schema:
type: object
properties:
error:
type: string
example: 'Class not found'
# Events
/events:
post:
summary: "Create a new event "
description: "Creates a new event with the provided information."
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Event object that needs to be added"
required: true
schema:
$ref: "#/definitions/Event"
responses:
201:
description: "Event created successfully"
schema:
$ref: "#/definitions/Event"
get:
summary: "Get list of all event "
description: "Returns a list of all event ."
produces:
- "application/json"
responses:
200:
description: "List of event "
schema:
type: array
items:
$ref: "#/definitions/Event"
/events/{eventId}:
get:
summary: "Get event by ID"
description: "Returns an event based on the ID provided."
produces:
- "application/json"
parameters:
- name: "eventId"
in: "path"
required: true
type: string
responses:
200:
description: "Event retrieved successfully"
schema:
$ref: "#/definitions/Event"
404:
description: "Event not found"
schema:
type: object
properties:
error:
type: string
example: "Event not found"
put:
summary: "Update event by ID"
description: "Updates an event based on the ID provided."
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "eventId"
in: "path"
required: true
type: string
- in: "body"
name: "body"
description: "Event object with updated information"
required: true
schema:
$ref: "#/definitions/Event"
responses:
200:
description: "Event updated successfully"
schema:
$ref: "#/definitions/Event"
404:
description: "Event not found"
schema:
type: object
properties:
error:
type: string
example: "Event not found"
delete:
summary: "Delete event by ID"
description: "Deletes an event based on the ID provided."
produces:
- "application/json"
parameters:
- name: "eventId"
in: "path"
required: true
type: string
responses:
200:
description: "Event deleted successfully"
schema:
type: object
properties:
message:
type: string
example: "Event deleted"
404:
description: "Event not found"
schema:
type: object
properties:
error:
type: string
example: "Event detail not found"
# testimonial routes
/testimonials:
post:
summary: "Create a new testimonial "
description: "Creates a new testimonial with the provided information."
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Testimonial object that needs to be added"
required: true
schema:
$ref: "#/definitions/Testimonial"
responses:
201:
description: "Testimonial created successfully"
schema:
$ref: "#/definitions/Testimonial"
get:
summary: "Get list of all Testimonial "
description: "Returns a list of all Testimonial ."
produces:
- "application/json"
responses:
200:
description: "List of Testimonial "
schema:
type: array
items:
$ref: "#/definitions/Testimonial"
/testimonials/{testimonialId}:
get:
summary: "Get Testimonial by ID"
description: "Returns an Testimonial based on the ID provided."
produces:
- "application/json"
parameters:
- name: "testimonialId"
in: "path"
required: true
type: string
responses:
200:
description: "Testimonial retrieved successfully"
schema:
$ref: "#/definitions/Testimonial"
404:
description: "Event not found"
schema:
type: object
properties:
error:
type: string
example: "Event not found"
put:
summary: "Update Testimonial by ID"
description: "Updates an Testimonial based on the ID provided."
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "testimonialId"
in: "path"
required: true
type: string
- in: "body"
name: "body"
description: "Testimonial object with updated information"
required: true
schema:
$ref: "#/definitions/Testimonial"
responses:
200:
description: "Testimonial updated successfully"
schema:
$ref: "#/definitions/Testimonial"
404:
description: "Testimonial not found"
schema:
type: object
properties:
error:
type: string
example: "Testimonial not found"
delete:
summary: "Delete Testimonial by ID"
description: "Deletes the Testimonial based on the ID provided."
produces:
- "application/json"
parameters:
- name: "testimonialId"
in: "path"
required: true
type: string
responses:
200:
description: "Testimonial deleted successfully"
schema:
type: object
properties:
message:
type: string
example: "Testimonial deleted"
404:
description: "Testimonial not found"
schema:
type: object
properties:
error:
type: string
example: "Testimonial detail not found"
####### Model definitions
definitions:
User:
type: object
properties:
firstName:
type: string
example: John
lastName:
type: string
example: Doe
mobile:
type: string
example: '234567890'
email:
type: string
example: john.doe@example.com
password:
type: string
example: password123
userType:
type: string
example: admin
IsActive:
type: integer
example: 1
# Teacher
Teacher:
type: object
properties:
name:
type: string
example: Nashid Martines
email:
type : string
example : johnsnow@gmail.com
age:
type: integer
example: 40
gender:
type: string
example: Male
teacherImage:
type: string
example: https://images.unsplash.com/photo-1721403715005-cd5df8ab90ee?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwzNHx8fGVufDB8fHx8fA%3D%3D
position:
type: string
example: Principal
isActive:
type: integer
example: 1
about:
type: string
example: Expert in Mathematics
experience:
type: string
example: 15 years
subject:
type: string
example: Chemistry Teacher
duty:
type: string
example: The duties of a chemistry teacher include creating lesson plans; preparing and delivering lectures; creating and supervising laboratory activities for students; evaluating student performance; maintaining classroom records; meeting with parents, teachers, and other professionals; and participating in campus events.
# Menu
Menu:
type: object
properties:
title:
type: string
example: About Us
menuClass:
type: string
example: main-menu
isActive:
type: integer
example: 1
userId:
type: string
example: 6693c7b58b3d3bde81ec497a
orderBy:
type: integer
example: 1
# Submenu
Submenu:
type: object
required:
- menuId
- title
- subMenuClass
- isActive
- userId
properties:
menuId:
type: string
description: The ID of the menu this submenu belongs to
title:
type: string
description: The title of the submenu
route:
type: string
description: The route of the submenu
subMenuClass:
type: string
description: The CSS class of the submenu
isActive:
type: boolean
description: The status of the submenu
userId:
type: string
description: The ID of the user who created the submenu
subSubMenu:
type: array
description: The sub-submenus under this submenu
items:
$ref: '#/definitions/SubSubmenu'
SubSubmenu:
type: object
required:
- title
- subSubMenuClass
- isActive
- userId
properties:
title:
type: string
description: The title of the sub-submenu
route:
type: string
description: The route of the sub-submenu
subSubMenuClass:
type: string
description: The CSS class of the sub-submenu
isActive:
type: boolean
description: The status of the sub-submenu
userId:
type: integer
description: The ID of the user who created the sub-submenu
# Product
Product:
type: object
properties:
img:
type: string
example: https://images.unsplash.com/photo-1721403715005-cd5df8ab90ee?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwzNHx8fGVufDB8fHx8fA%3D%3D
title:
type: string
example: School Bag
price:
type: string
example: $10
priceDiscount:
type: string
example: $5
category:
type: string
example: Bag
description:
type: string
example: A durable and spacious school bag perfect for students.
currency:
type: string
example: '$10'
stock:
type: string
example: '25'
availability:
type: string
example: 'in stock'
additionalImages:
type: array
items:
type: string
example: 'https://images.unsplash.com/photo-1723239406233-88c68024a4d5?q=80&w=3087&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'
video:
type: string
format: 'mp4'
example: 'assets/videos/product/item1.mp4'
specifications:
type: object
properties:
dimensions: