moahmedwafy commited on
Commit
fe17679
·
1 Parent(s): 721abf7

feat: custom swagger decorators

Browse files
package-lock.json CHANGED
@@ -25,11 +25,12 @@
25
  "mongoose": "^8.0.3",
26
  "npm": "^10.2.5",
27
  "path": "^0.12.7",
28
- "tsc-alias": "^1.8.8",
29
- "tspec": "^0.1.112"
30
  },
31
  "devDependencies": {
32
  "@types/express": "^4.17.21",
 
33
  "nodemon": "^3.0.2",
34
  "ts-node": "^10.9.2",
35
  "ts-node-dev": "^2.0.0",
@@ -37,15 +38,11 @@
37
  "typescript": "^5.3.3"
38
  }
39
  },
40
- "node_modules/@cloudflare/json-schema-walker": {
41
- "version": "0.1.1",
42
- "resolved": "https://registry.npmjs.org/@cloudflare/json-schema-walker/-/json-schema-walker-0.1.1.tgz",
43
- "integrity": "sha512-P3n0hEgk1m6uKWgL4Yb1owzXVG4pM70G4kRnDQxZXiVvfCRtaqiHu+ZRiRPzmwGBiLTO1LWc2yR1M8oz0YkXww=="
44
- },
45
  "node_modules/@cspotcode/source-map-support": {
46
  "version": "0.8.1",
47
  "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
48
  "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
 
49
  "dependencies": {
50
  "@jridgewell/trace-mapping": "0.3.9"
51
  },
@@ -165,6 +162,7 @@
165
  "version": "3.1.1",
166
  "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
167
  "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
 
168
  "engines": {
169
  "node": ">=6.0.0"
170
  }
@@ -172,12 +170,14 @@
172
  "node_modules/@jridgewell/sourcemap-codec": {
173
  "version": "1.4.15",
174
  "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
175
- "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
 
176
  },
177
  "node_modules/@jridgewell/trace-mapping": {
178
  "version": "0.3.9",
179
  "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
180
  "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
 
181
  "dependencies": {
182
  "@jridgewell/resolve-uri": "^3.0.3",
183
  "@jridgewell/sourcemap-codec": "^1.4.10"
@@ -286,28 +286,32 @@
286
  "node_modules/@tsconfig/node10": {
287
  "version": "1.0.9",
288
  "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
289
- "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA=="
 
290
  },
291
  "node_modules/@tsconfig/node12": {
292
  "version": "1.0.11",
293
  "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
294
- "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="
 
295
  },
296
  "node_modules/@tsconfig/node14": {
297
  "version": "1.0.3",
298
  "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
299
- "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
 
300
  },
301
  "node_modules/@tsconfig/node16": {
302
  "version": "1.0.4",
303
  "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
304
- "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="
 
305
  },
306
  "node_modules/@types/body-parser": {
307
  "version": "1.19.5",
308
  "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
309
  "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==",
310
- "devOptional": true,
311
  "dependencies": {
312
  "@types/connect": "*",
313
  "@types/node": "*"
@@ -317,7 +321,7 @@
317
  "version": "3.4.38",
318
  "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
319
  "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",
320
- "devOptional": true,
321
  "dependencies": {
322
  "@types/node": "*"
323
  }
@@ -326,7 +330,7 @@
326
  "version": "4.17.21",
327
  "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
328
  "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==",
329
- "devOptional": true,
330
  "dependencies": {
331
  "@types/body-parser": "*",
332
  "@types/express-serve-static-core": "^4.17.33",
@@ -338,7 +342,7 @@
338
  "version": "4.17.41",
339
  "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz",
340
  "integrity": "sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==",
341
- "devOptional": true,
342
  "dependencies": {
343
  "@types/node": "*",
344
  "@types/qs": "*",
@@ -359,26 +363,13 @@
359
  "version": "2.0.4",
360
  "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
361
  "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==",
362
- "devOptional": true
363
- },
364
- "node_modules/@types/http-proxy": {
365
- "version": "1.17.14",
366
- "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.14.tgz",
367
- "integrity": "sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w==",
368
- "dependencies": {
369
- "@types/node": "*"
370
- }
371
- },
372
- "node_modules/@types/json-schema": {
373
- "version": "7.0.15",
374
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
375
- "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
376
  },
377
  "node_modules/@types/mime": {
378
  "version": "1.3.5",
379
  "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
380
  "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
381
- "devOptional": true
382
  },
383
  "node_modules/@types/minimatch": {
384
  "version": "5.1.2",
@@ -397,19 +388,19 @@
397
  "version": "6.9.11",
398
  "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz",
399
  "integrity": "sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ==",
400
- "devOptional": true
401
  },
402
  "node_modules/@types/range-parser": {
403
  "version": "1.2.7",
404
  "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz",
405
  "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==",
406
- "devOptional": true
407
  },
408
  "node_modules/@types/send": {
409
  "version": "0.17.4",
410
  "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
411
  "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==",
412
- "devOptional": true,
413
  "dependencies": {
414
  "@types/mime": "^1",
415
  "@types/node": "*"
@@ -419,7 +410,7 @@
419
  "version": "1.15.5",
420
  "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz",
421
  "integrity": "sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==",
422
- "devOptional": true,
423
  "dependencies": {
424
  "@types/http-errors": "*",
425
  "@types/mime": "*",
@@ -438,6 +429,16 @@
438
  "integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==",
439
  "dev": true
440
  },
 
 
 
 
 
 
 
 
 
 
441
  "node_modules/@types/webidl-conversions": {
442
  "version": "7.0.3",
443
  "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
@@ -473,6 +474,7 @@
473
  "version": "8.11.2",
474
  "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
475
  "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
 
476
  "bin": {
477
  "acorn": "bin/acorn"
478
  },
@@ -484,6 +486,7 @@
484
  "version": "8.3.1",
485
  "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz",
486
  "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==",
 
487
  "engines": {
488
  "node": ">=0.4.0"
489
  }
@@ -550,7 +553,8 @@
550
  "node_modules/arg": {
551
  "version": "4.1.3",
552
  "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
553
- "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
 
554
  },
555
  "node_modules/array-flatten": {
556
  "version": "1.1.1",
@@ -690,49 +694,6 @@
690
  "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz",
691
  "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw=="
692
  },
693
- "node_modules/cliui": {
694
- "version": "8.0.1",
695
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
696
- "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
697
- "dependencies": {
698
- "string-width": "^4.2.0",
699
- "strip-ansi": "^6.0.1",
700
- "wrap-ansi": "^7.0.0"
701
- },
702
- "engines": {
703
- "node": ">=12"
704
- }
705
- },
706
- "node_modules/cliui/node_modules/ansi-styles": {
707
- "version": "4.3.0",
708
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
709
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
710
- "dependencies": {
711
- "color-convert": "^2.0.1"
712
- },
713
- "engines": {
714
- "node": ">=8"
715
- },
716
- "funding": {
717
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
718
- }
719
- },
720
- "node_modules/cliui/node_modules/wrap-ansi": {
721
- "version": "7.0.0",
722
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
723
- "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
724
- "dependencies": {
725
- "ansi-styles": "^4.0.0",
726
- "string-width": "^4.1.0",
727
- "strip-ansi": "^6.0.0"
728
- },
729
- "engines": {
730
- "node": ">=10"
731
- },
732
- "funding": {
733
- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
734
- }
735
- },
736
  "node_modules/color-convert": {
737
  "version": "2.0.1",
738
  "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -822,7 +783,8 @@
822
  "node_modules/create-require": {
823
  "version": "1.1.1",
824
  "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
825
- "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
 
826
  },
827
  "node_modules/cross-spawn": {
828
  "version": "7.0.3",
@@ -900,6 +862,7 @@
900
  "version": "4.0.2",
901
  "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
902
  "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
 
903
  "engines": {
904
  "node": ">=0.3.1"
905
  }
@@ -966,14 +929,6 @@
966
  "node": ">= 0.8"
967
  }
968
  },
969
- "node_modules/escalade": {
970
- "version": "3.1.2",
971
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
972
- "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
973
- "engines": {
974
- "node": ">=6"
975
- }
976
- },
977
  "node_modules/escape-html": {
978
  "version": "1.0.3",
979
  "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -987,11 +942,6 @@
987
  "node": ">= 0.6"
988
  }
989
  },
990
- "node_modules/eventemitter3": {
991
- "version": "4.0.7",
992
- "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
993
- "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
994
- },
995
  "node_modules/express": {
996
  "version": "4.18.2",
997
  "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
@@ -1158,25 +1108,6 @@
1158
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
1159
  "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
1160
  },
1161
- "node_modules/follow-redirects": {
1162
- "version": "1.15.6",
1163
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
1164
- "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
1165
- "funding": [
1166
- {
1167
- "type": "individual",
1168
- "url": "https://github.com/sponsors/RubenVerborgh"
1169
- }
1170
- ],
1171
- "engines": {
1172
- "node": ">=4.0"
1173
- },
1174
- "peerDependenciesMeta": {
1175
- "debug": {
1176
- "optional": true
1177
- }
1178
- }
1179
- },
1180
  "node_modules/foreground-child": {
1181
  "version": "3.1.1",
1182
  "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
@@ -1286,14 +1217,6 @@
1286
  "node": ">=10"
1287
  }
1288
  },
1289
- "node_modules/get-caller-file": {
1290
- "version": "2.0.5",
1291
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
1292
- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
1293
- "engines": {
1294
- "node": "6.* || 8.* || >= 10.*"
1295
- }
1296
- },
1297
  "node_modules/get-intrinsic": {
1298
  "version": "1.2.2",
1299
  "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
@@ -1470,42 +1393,6 @@
1470
  "node": ">= 0.8"
1471
  }
1472
  },
1473
- "node_modules/http-proxy": {
1474
- "version": "1.18.1",
1475
- "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
1476
- "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
1477
- "dependencies": {
1478
- "eventemitter3": "^4.0.0",
1479
- "follow-redirects": "^1.0.0",
1480
- "requires-port": "^1.0.0"
1481
- },
1482
- "engines": {
1483
- "node": ">=8.0.0"
1484
- }
1485
- },
1486
- "node_modules/http-proxy-middleware": {
1487
- "version": "2.0.6",
1488
- "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz",
1489
- "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==",
1490
- "dependencies": {
1491
- "@types/http-proxy": "^1.17.8",
1492
- "http-proxy": "^1.18.1",
1493
- "is-glob": "^4.0.1",
1494
- "is-plain-obj": "^3.0.0",
1495
- "micromatch": "^4.0.2"
1496
- },
1497
- "engines": {
1498
- "node": ">=12.0.0"
1499
- },
1500
- "peerDependencies": {
1501
- "@types/express": "^4.17.13"
1502
- },
1503
- "peerDependenciesMeta": {
1504
- "@types/express": {
1505
- "optional": true
1506
- }
1507
- }
1508
- },
1509
  "node_modules/https-proxy-agent": {
1510
  "version": "5.0.1",
1511
  "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
@@ -1631,17 +1518,6 @@
1631
  "node": ">=0.12.0"
1632
  }
1633
  },
1634
- "node_modules/is-plain-obj": {
1635
- "version": "3.0.0",
1636
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz",
1637
- "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==",
1638
- "engines": {
1639
- "node": ">=10"
1640
- },
1641
- "funding": {
1642
- "url": "https://github.com/sponsors/sindresorhus"
1643
- }
1644
- },
1645
  "node_modules/isexe": {
1646
  "version": "2.0.0",
1647
  "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -1676,15 +1552,6 @@
1676
  "@sideway/pinpoint": "^2.0.0"
1677
  }
1678
  },
1679
- "node_modules/json-schema-to-openapi-schema": {
1680
- "version": "0.4.0",
1681
- "resolved": "https://registry.npmjs.org/json-schema-to-openapi-schema/-/json-schema-to-openapi-schema-0.4.0.tgz",
1682
- "integrity": "sha512-/DY8s4l28M5ZIJBhmcUFWbZChJV5v7RCA7RMVxubyD1l5KwIceUq6+EUnqQ2q3wh/2D3Zn8bNSeAu1i2X+sMHQ==",
1683
- "deprecated": "This package is no longer maintained. Use @openapi-contrib/json-schema-to-openapi-schema instead.",
1684
- "dependencies": {
1685
- "@cloudflare/json-schema-walker": "^0.1.1"
1686
- }
1687
- },
1688
  "node_modules/json5": {
1689
  "version": "2.2.3",
1690
  "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
@@ -1816,7 +1683,8 @@
1816
  "node_modules/make-error": {
1817
  "version": "1.3.6",
1818
  "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
1819
- "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
 
1820
  },
1821
  "node_modules/media-typer": {
1822
  "version": "0.3.0",
@@ -4951,11 +4819,6 @@
4951
  "wrappy": "1"
4952
  }
4953
  },
4954
- "node_modules/openapi-types": {
4955
- "version": "12.1.3",
4956
- "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
4957
- "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="
4958
- },
4959
  "node_modules/parseurl": {
4960
  "version": "1.3.3",
4961
  "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -4973,11 +4836,6 @@
4973
  "util": "^0.10.3"
4974
  }
4975
  },
4976
- "node_modules/path-equal": {
4977
- "version": "1.2.5",
4978
- "resolved": "https://registry.npmjs.org/path-equal/-/path-equal-1.2.5.tgz",
4979
- "integrity": "sha512-i73IctDr3F2W+bsOWDyyVm/lqsXO47aY9nsFZUjTT/aljSbkxHxxCoyZ9UUrM8jK0JVod+An+rl48RCsvWM+9g=="
4980
- },
4981
  "node_modules/path-is-absolute": {
4982
  "version": "1.0.1",
4983
  "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -5165,19 +5023,6 @@
5165
  "node": ">=8.10.0"
5166
  }
5167
  },
5168
- "node_modules/require-directory": {
5169
- "version": "2.1.1",
5170
- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
5171
- "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
5172
- "engines": {
5173
- "node": ">=0.10.0"
5174
- }
5175
- },
5176
- "node_modules/requires-port": {
5177
- "version": "1.0.0",
5178
- "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
5179
- "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
5180
- },
5181
  "node_modules/resolve": {
5182
  "version": "1.22.8",
5183
  "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -5278,14 +5123,6 @@
5278
  }
5279
  ]
5280
  },
5281
- "node_modules/safe-stable-stringify": {
5282
- "version": "2.4.3",
5283
- "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz",
5284
- "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==",
5285
- "engines": {
5286
- "node": ">=10"
5287
- }
5288
- },
5289
  "node_modules/safer-buffer": {
5290
  "version": "2.1.2",
5291
  "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
@@ -5582,16 +5419,16 @@
5582
  }
5583
  },
5584
  "node_modules/swagger-ui-dist": {
5585
- "version": "5.14.0",
5586
- "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.14.0.tgz",
5587
- "integrity": "sha512-7qsKvc3gs5dnEIOclY4xkzacY85Pu9a/Gzkf+eezKLQ4BpErlI8BxYWADhnCx6PmFyU4fxH4AMKH+/d3Kml0Gg=="
5588
  },
5589
  "node_modules/swagger-ui-express": {
5590
- "version": "4.6.3",
5591
- "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.6.3.tgz",
5592
- "integrity": "sha512-CDje4PndhTD2HkgyKH3pab+LKspDeB/NhPN2OF1j+piYIamQqBYwAXWESOT1Yju2xFg51bRW9sUng2WxDjzArw==",
5593
  "dependencies": {
5594
- "swagger-ui-dist": ">=4.11.0"
5595
  },
5596
  "engines": {
5597
  "node": ">= v0.10.32"
@@ -5671,6 +5508,7 @@
5671
  "version": "10.9.2",
5672
  "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
5673
  "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
 
5674
  "dependencies": {
5675
  "@cspotcode/source-map-support": "^0.8.0",
5676
  "@tsconfig/node10": "^1.0.7",
@@ -5817,81 +5655,6 @@
5817
  "node": ">=6"
5818
  }
5819
  },
5820
- "node_modules/tspec": {
5821
- "version": "0.1.112",
5822
- "resolved": "https://registry.npmjs.org/tspec/-/tspec-0.1.112.tgz",
5823
- "integrity": "sha512-rkTAZ5czVp/ZrRLD0Vydl2xHz+Tw+rZkya64Fysk1qMpHnQDIMyItqgY6IQ7tj2jxB9Y22kuRbCfxzrzznMU6g==",
5824
- "dependencies": {
5825
- "debug": "^4.3.4",
5826
- "express": "^4.18.2",
5827
- "glob": "^8.1.0",
5828
- "http-proxy-middleware": "^2.0.6",
5829
- "json-schema-to-openapi-schema": "^0.4.0",
5830
- "openapi-types": "^12.0.2",
5831
- "swagger-ui-express": "^4.6.2",
5832
- "typescript": "~5.1.0",
5833
- "typescript-json-schema": "^0.62.0",
5834
- "yargs": "^17.7.1"
5835
- },
5836
- "bin": {
5837
- "tspec": "dist/cli.js"
5838
- },
5839
- "engines": {
5840
- "node": ">=12.0.0"
5841
- },
5842
- "peerDependencies": {
5843
- "express": "^4.17.1"
5844
- }
5845
- },
5846
- "node_modules/tspec/node_modules/brace-expansion": {
5847
- "version": "2.0.1",
5848
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
5849
- "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
5850
- "dependencies": {
5851
- "balanced-match": "^1.0.0"
5852
- }
5853
- },
5854
- "node_modules/tspec/node_modules/glob": {
5855
- "version": "8.1.0",
5856
- "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
5857
- "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
5858
- "dependencies": {
5859
- "fs.realpath": "^1.0.0",
5860
- "inflight": "^1.0.4",
5861
- "inherits": "2",
5862
- "minimatch": "^5.0.1",
5863
- "once": "^1.3.0"
5864
- },
5865
- "engines": {
5866
- "node": ">=12"
5867
- },
5868
- "funding": {
5869
- "url": "https://github.com/sponsors/isaacs"
5870
- }
5871
- },
5872
- "node_modules/tspec/node_modules/minimatch": {
5873
- "version": "5.1.6",
5874
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
5875
- "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
5876
- "dependencies": {
5877
- "brace-expansion": "^2.0.1"
5878
- },
5879
- "engines": {
5880
- "node": ">=10"
5881
- }
5882
- },
5883
- "node_modules/tspec/node_modules/typescript": {
5884
- "version": "5.1.6",
5885
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
5886
- "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
5887
- "bin": {
5888
- "tsc": "bin/tsc",
5889
- "tsserver": "bin/tsserver"
5890
- },
5891
- "engines": {
5892
- "node": ">=14.17"
5893
- }
5894
- },
5895
  "node_modules/type-is": {
5896
  "version": "1.6.18",
5897
  "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@@ -5908,60 +5671,7 @@
5908
  "version": "5.3.3",
5909
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
5910
  "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
5911
- "bin": {
5912
- "tsc": "bin/tsc",
5913
- "tsserver": "bin/tsserver"
5914
- },
5915
- "engines": {
5916
- "node": ">=14.17"
5917
- }
5918
- },
5919
- "node_modules/typescript-json-schema": {
5920
- "version": "0.62.0",
5921
- "resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.62.0.tgz",
5922
- "integrity": "sha512-qRO6pCgyjKJ230QYdOxDRpdQrBeeino4v5p2rYmSD72Jf4rD3O+cJcROv46sQukm46CLWoeusqvBgKpynEv25g==",
5923
- "dependencies": {
5924
- "@types/json-schema": "^7.0.9",
5925
- "@types/node": "^16.9.2",
5926
- "glob": "^7.1.7",
5927
- "path-equal": "^1.2.5",
5928
- "safe-stable-stringify": "^2.2.0",
5929
- "ts-node": "^10.9.1",
5930
- "typescript": "~5.1.0",
5931
- "yargs": "^17.1.1"
5932
- },
5933
- "bin": {
5934
- "typescript-json-schema": "bin/typescript-json-schema"
5935
- }
5936
- },
5937
- "node_modules/typescript-json-schema/node_modules/@types/node": {
5938
- "version": "16.18.95",
5939
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.95.tgz",
5940
- "integrity": "sha512-z9w+CcR7ahc7UhsKe+PGB25nmPmCERQBAdLdFHhoZ6+FfgSr7gUvdQI0eLH2t7ue8u5wKsLdde6cHKPjhC8vGg=="
5941
- },
5942
- "node_modules/typescript-json-schema/node_modules/glob": {
5943
- "version": "7.2.3",
5944
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
5945
- "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
5946
- "dependencies": {
5947
- "fs.realpath": "^1.0.0",
5948
- "inflight": "^1.0.4",
5949
- "inherits": "2",
5950
- "minimatch": "^3.1.1",
5951
- "once": "^1.3.0",
5952
- "path-is-absolute": "^1.0.0"
5953
- },
5954
- "engines": {
5955
- "node": "*"
5956
- },
5957
- "funding": {
5958
- "url": "https://github.com/sponsors/isaacs"
5959
- }
5960
- },
5961
- "node_modules/typescript-json-schema/node_modules/typescript": {
5962
- "version": "5.1.6",
5963
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
5964
- "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
5965
  "bin": {
5966
  "tsc": "bin/tsc",
5967
  "tsserver": "bin/tsserver"
@@ -6018,7 +5728,8 @@
6018
  "node_modules/v8-compile-cache-lib": {
6019
  "version": "3.0.1",
6020
  "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
6021
- "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
 
6022
  },
6023
  "node_modules/vary": {
6024
  "version": "1.1.2",
@@ -6177,48 +5888,16 @@
6177
  "node": ">=0.4"
6178
  }
6179
  },
6180
- "node_modules/y18n": {
6181
- "version": "5.0.8",
6182
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
6183
- "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
6184
- "engines": {
6185
- "node": ">=10"
6186
- }
6187
- },
6188
  "node_modules/yallist": {
6189
  "version": "4.0.0",
6190
  "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
6191
  "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
6192
  },
6193
- "node_modules/yargs": {
6194
- "version": "17.7.2",
6195
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
6196
- "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
6197
- "dependencies": {
6198
- "cliui": "^8.0.1",
6199
- "escalade": "^3.1.1",
6200
- "get-caller-file": "^2.0.5",
6201
- "require-directory": "^2.1.1",
6202
- "string-width": "^4.2.3",
6203
- "y18n": "^5.0.5",
6204
- "yargs-parser": "^21.1.1"
6205
- },
6206
- "engines": {
6207
- "node": ">=12"
6208
- }
6209
- },
6210
- "node_modules/yargs-parser": {
6211
- "version": "21.1.1",
6212
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
6213
- "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
6214
- "engines": {
6215
- "node": ">=12"
6216
- }
6217
- },
6218
  "node_modules/yn": {
6219
  "version": "3.1.1",
6220
  "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
6221
  "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
 
6222
  "engines": {
6223
  "node": ">=6"
6224
  }
 
25
  "mongoose": "^8.0.3",
26
  "npm": "^10.2.5",
27
  "path": "^0.12.7",
28
+ "swagger-ui-express": "^5.0.0",
29
+ "tsc-alias": "^1.8.8"
30
  },
31
  "devDependencies": {
32
  "@types/express": "^4.17.21",
33
+ "@types/swagger-ui-express": "^4.1.6",
34
  "nodemon": "^3.0.2",
35
  "ts-node": "^10.9.2",
36
  "ts-node-dev": "^2.0.0",
 
38
  "typescript": "^5.3.3"
39
  }
40
  },
 
 
 
 
 
41
  "node_modules/@cspotcode/source-map-support": {
42
  "version": "0.8.1",
43
  "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
44
  "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
45
+ "dev": true,
46
  "dependencies": {
47
  "@jridgewell/trace-mapping": "0.3.9"
48
  },
 
162
  "version": "3.1.1",
163
  "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
164
  "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
165
+ "dev": true,
166
  "engines": {
167
  "node": ">=6.0.0"
168
  }
 
170
  "node_modules/@jridgewell/sourcemap-codec": {
171
  "version": "1.4.15",
172
  "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
173
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
174
+ "dev": true
175
  },
176
  "node_modules/@jridgewell/trace-mapping": {
177
  "version": "0.3.9",
178
  "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
179
  "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
180
+ "dev": true,
181
  "dependencies": {
182
  "@jridgewell/resolve-uri": "^3.0.3",
183
  "@jridgewell/sourcemap-codec": "^1.4.10"
 
286
  "node_modules/@tsconfig/node10": {
287
  "version": "1.0.9",
288
  "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
289
+ "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
290
+ "dev": true
291
  },
292
  "node_modules/@tsconfig/node12": {
293
  "version": "1.0.11",
294
  "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
295
+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
296
+ "dev": true
297
  },
298
  "node_modules/@tsconfig/node14": {
299
  "version": "1.0.3",
300
  "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
301
+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
302
+ "dev": true
303
  },
304
  "node_modules/@tsconfig/node16": {
305
  "version": "1.0.4",
306
  "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
307
+ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
308
+ "dev": true
309
  },
310
  "node_modules/@types/body-parser": {
311
  "version": "1.19.5",
312
  "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
313
  "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==",
314
+ "dev": true,
315
  "dependencies": {
316
  "@types/connect": "*",
317
  "@types/node": "*"
 
321
  "version": "3.4.38",
322
  "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
323
  "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",
324
+ "dev": true,
325
  "dependencies": {
326
  "@types/node": "*"
327
  }
 
330
  "version": "4.17.21",
331
  "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
332
  "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==",
333
+ "dev": true,
334
  "dependencies": {
335
  "@types/body-parser": "*",
336
  "@types/express-serve-static-core": "^4.17.33",
 
342
  "version": "4.17.41",
343
  "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz",
344
  "integrity": "sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==",
345
+ "dev": true,
346
  "dependencies": {
347
  "@types/node": "*",
348
  "@types/qs": "*",
 
363
  "version": "2.0.4",
364
  "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
365
  "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==",
366
+ "dev": true
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  },
368
  "node_modules/@types/mime": {
369
  "version": "1.3.5",
370
  "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
371
  "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
372
+ "dev": true
373
  },
374
  "node_modules/@types/minimatch": {
375
  "version": "5.1.2",
 
388
  "version": "6.9.11",
389
  "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz",
390
  "integrity": "sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ==",
391
+ "dev": true
392
  },
393
  "node_modules/@types/range-parser": {
394
  "version": "1.2.7",
395
  "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz",
396
  "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==",
397
+ "dev": true
398
  },
399
  "node_modules/@types/send": {
400
  "version": "0.17.4",
401
  "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
402
  "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==",
403
+ "dev": true,
404
  "dependencies": {
405
  "@types/mime": "^1",
406
  "@types/node": "*"
 
410
  "version": "1.15.5",
411
  "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz",
412
  "integrity": "sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==",
413
+ "dev": true,
414
  "dependencies": {
415
  "@types/http-errors": "*",
416
  "@types/mime": "*",
 
429
  "integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==",
430
  "dev": true
431
  },
432
+ "node_modules/@types/swagger-ui-express": {
433
+ "version": "4.1.6",
434
+ "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.6.tgz",
435
+ "integrity": "sha512-UVSiGYXa5IzdJJG3hrc86e8KdZWLYxyEsVoUI4iPXc7CO4VZ3AfNP8d/8+hrDRIqz+HAaSMtZSqAsF3Nq2X/Dg==",
436
+ "dev": true,
437
+ "dependencies": {
438
+ "@types/express": "*",
439
+ "@types/serve-static": "*"
440
+ }
441
+ },
442
  "node_modules/@types/webidl-conversions": {
443
  "version": "7.0.3",
444
  "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
 
474
  "version": "8.11.2",
475
  "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
476
  "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
477
+ "dev": true,
478
  "bin": {
479
  "acorn": "bin/acorn"
480
  },
 
486
  "version": "8.3.1",
487
  "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz",
488
  "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==",
489
+ "dev": true,
490
  "engines": {
491
  "node": ">=0.4.0"
492
  }
 
553
  "node_modules/arg": {
554
  "version": "4.1.3",
555
  "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
556
+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
557
+ "dev": true
558
  },
559
  "node_modules/array-flatten": {
560
  "version": "1.1.1",
 
694
  "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz",
695
  "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw=="
696
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
697
  "node_modules/color-convert": {
698
  "version": "2.0.1",
699
  "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
 
783
  "node_modules/create-require": {
784
  "version": "1.1.1",
785
  "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
786
+ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
787
+ "dev": true
788
  },
789
  "node_modules/cross-spawn": {
790
  "version": "7.0.3",
 
862
  "version": "4.0.2",
863
  "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
864
  "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
865
+ "dev": true,
866
  "engines": {
867
  "node": ">=0.3.1"
868
  }
 
929
  "node": ">= 0.8"
930
  }
931
  },
 
 
 
 
 
 
 
 
932
  "node_modules/escape-html": {
933
  "version": "1.0.3",
934
  "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
 
942
  "node": ">= 0.6"
943
  }
944
  },
 
 
 
 
 
945
  "node_modules/express": {
946
  "version": "4.18.2",
947
  "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
 
1108
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
1109
  "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
1110
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1111
  "node_modules/foreground-child": {
1112
  "version": "3.1.1",
1113
  "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
 
1217
  "node": ">=10"
1218
  }
1219
  },
 
 
 
 
 
 
 
 
1220
  "node_modules/get-intrinsic": {
1221
  "version": "1.2.2",
1222
  "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
 
1393
  "node": ">= 0.8"
1394
  }
1395
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1396
  "node_modules/https-proxy-agent": {
1397
  "version": "5.0.1",
1398
  "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
 
1518
  "node": ">=0.12.0"
1519
  }
1520
  },
 
 
 
 
 
 
 
 
 
 
 
1521
  "node_modules/isexe": {
1522
  "version": "2.0.0",
1523
  "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
 
1552
  "@sideway/pinpoint": "^2.0.0"
1553
  }
1554
  },
 
 
 
 
 
 
 
 
 
1555
  "node_modules/json5": {
1556
  "version": "2.2.3",
1557
  "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
 
1683
  "node_modules/make-error": {
1684
  "version": "1.3.6",
1685
  "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
1686
+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
1687
+ "dev": true
1688
  },
1689
  "node_modules/media-typer": {
1690
  "version": "0.3.0",
 
4819
  "wrappy": "1"
4820
  }
4821
  },
 
 
 
 
 
4822
  "node_modules/parseurl": {
4823
  "version": "1.3.3",
4824
  "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
 
4836
  "util": "^0.10.3"
4837
  }
4838
  },
 
 
 
 
 
4839
  "node_modules/path-is-absolute": {
4840
  "version": "1.0.1",
4841
  "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
 
5023
  "node": ">=8.10.0"
5024
  }
5025
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
5026
  "node_modules/resolve": {
5027
  "version": "1.22.8",
5028
  "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
 
5123
  }
5124
  ]
5125
  },
 
 
 
 
 
 
 
 
5126
  "node_modules/safer-buffer": {
5127
  "version": "2.1.2",
5128
  "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
 
5419
  }
5420
  },
5421
  "node_modules/swagger-ui-dist": {
5422
+ "version": "5.17.0",
5423
+ "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.17.0.tgz",
5424
+ "integrity": "sha512-PtEozc87rN6i6rqLYNVTK+1ZAYmCMy6poU6I2MOJXD19BVv6D7U9zwS8geRbtfamCM5yUwWkSNQKWGK58vculg=="
5425
  },
5426
  "node_modules/swagger-ui-express": {
5427
+ "version": "5.0.0",
5428
+ "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.0.tgz",
5429
+ "integrity": "sha512-tsU9tODVvhyfkNSvf03E6FAk+z+5cU3lXAzMy6Pv4av2Gt2xA0++fogwC4qo19XuFf6hdxevPuVCSKFuMHJhFA==",
5430
  "dependencies": {
5431
+ "swagger-ui-dist": ">=5.0.0"
5432
  },
5433
  "engines": {
5434
  "node": ">= v0.10.32"
 
5508
  "version": "10.9.2",
5509
  "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
5510
  "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
5511
+ "dev": true,
5512
  "dependencies": {
5513
  "@cspotcode/source-map-support": "^0.8.0",
5514
  "@tsconfig/node10": "^1.0.7",
 
5655
  "node": ">=6"
5656
  }
5657
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5658
  "node_modules/type-is": {
5659
  "version": "1.6.18",
5660
  "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
 
5671
  "version": "5.3.3",
5672
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
5673
  "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
5674
+ "dev": true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5675
  "bin": {
5676
  "tsc": "bin/tsc",
5677
  "tsserver": "bin/tsserver"
 
5728
  "node_modules/v8-compile-cache-lib": {
5729
  "version": "3.0.1",
5730
  "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
5731
+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
5732
+ "dev": true
5733
  },
5734
  "node_modules/vary": {
5735
  "version": "1.1.2",
 
5888
  "node": ">=0.4"
5889
  }
5890
  },
 
 
 
 
 
 
 
 
5891
  "node_modules/yallist": {
5892
  "version": "4.0.0",
5893
  "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
5894
  "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
5895
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5896
  "node_modules/yn": {
5897
  "version": "3.1.1",
5898
  "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
5899
  "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
5900
+ "dev": true,
5901
  "engines": {
5902
  "node": ">=6"
5903
  }
package.json CHANGED
@@ -5,7 +5,7 @@
5
  "main": "dist/index.js",
6
  "scripts": {
7
  "start": "rimraf dist && tsc && tsc-alias && node dist/index.js",
8
- "start:dev": "ts-node-dev -r tsconfig-paths/register src/index.ts",
9
  "build": "tsc",
10
  "lint": "eslint . --ext .ts"
11
  },
@@ -13,6 +13,7 @@
13
  "license": "ISC",
14
  "devDependencies": {
15
  "@types/express": "^4.17.21",
 
16
  "nodemon": "^3.0.2",
17
  "ts-node": "^10.9.2",
18
  "ts-node-dev": "^2.0.0",
@@ -36,7 +37,7 @@
36
  "mongoose": "^8.0.3",
37
  "npm": "^10.2.5",
38
  "path": "^0.12.7",
39
- "tsc-alias": "^1.8.8",
40
- "tspec": "^0.1.112"
41
  }
42
  }
 
5
  "main": "dist/index.js",
6
  "scripts": {
7
  "start": "rimraf dist && tsc && tsc-alias && node dist/index.js",
8
+ "start:dev": "ts-node-dev --files -r tsconfig-paths/register src/index.ts",
9
  "build": "tsc",
10
  "lint": "eslint . --ext .ts"
11
  },
 
13
  "license": "ISC",
14
  "devDependencies": {
15
  "@types/express": "^4.17.21",
16
+ "@types/swagger-ui-express": "^4.1.6",
17
  "nodemon": "^3.0.2",
18
  "ts-node": "^10.9.2",
19
  "ts-node-dev": "^2.0.0",
 
37
  "mongoose": "^8.0.3",
38
  "npm": "^10.2.5",
39
  "path": "^0.12.7",
40
+ "swagger-ui-express": "^5.0.0",
41
+ "tsc-alias": "^1.8.8"
42
  }
43
  }
src/lib/decorators/prefix.decorator.ts CHANGED
@@ -1,6 +1,7 @@
 
1
  import { BaseController } from "../controllers/controller.base";
2
 
3
- export const Prefix = (prefix: string) => {
4
  return (target: typeof BaseController) => {
5
  const originalConstructor = target;
6
  const newConstructor: any = function (...args: any[]) {
@@ -9,6 +10,17 @@ export const Prefix = (prefix: string) => {
9
  return instance;
10
  };
11
  newConstructor.prototype = originalConstructor.prototype;
 
 
 
 
 
 
 
 
 
 
 
12
  return newConstructor;
13
  };
14
  };
 
1
+ import { swaggerRegistry } from "@lib/swagger/swagger";
2
  import { BaseController } from "../controllers/controller.base";
3
 
4
+ export const Controller = (prefix: string) => {
5
  return (target: typeof BaseController) => {
6
  const originalConstructor = target;
7
  const newConstructor: any = function (...args: any[]) {
 
10
  return instance;
11
  };
12
  newConstructor.prototype = originalConstructor.prototype;
13
+ swaggerRegistry.setControllerPrefix(
14
+ target.prototype.constructor.name,
15
+ prefix
16
+ );
17
+ swaggerRegistry.setControllerTags(target.prototype.constructor.name, [
18
+ prefix
19
+ .split("/")
20
+ .slice(1)
21
+ .map((tag) => tag.charAt(0).toUpperCase() + tag.slice(1))
22
+ .join(" - "),
23
+ ]);
24
  return newConstructor;
25
  };
26
  };
src/lib/decorators/swagger-controller.decorator.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import { swaggerRegistry } from "@lib/swagger/swagger";
2
+
3
+ export const SwaggerController = (path: string) => {
4
+ return (target: any) => {
5
+ target = target.prototype.constructor.name;
6
+ swaggerRegistry.setControllerPrefix(target, path);
7
+ };
8
+ };
src/lib/decorators/swagger-request.decorator.ts ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { swaggerRegistry } from "@lib/swagger/swagger";
2
+
3
+ export const SwaggerRequest = (joiSchema: any) => {
4
+ return (target: any, propertyKey: string) => {
5
+ const schema: any = {
6
+ type: "object",
7
+ properties: {},
8
+ };
9
+
10
+ const properties = Object.getOwnPropertyNames(joiSchema.describe().keys);
11
+ properties.forEach((property) => {
12
+ schema.properties[property] = {
13
+ type: joiSchema.describe().keys[property].type,
14
+ };
15
+ });
16
+
17
+ swaggerRegistry.updateRoute(target.constructor.name, {
18
+ propertyKey,
19
+ request: schema,
20
+ });
21
+ };
22
+ };
src/lib/decorators/swagger-response.decorator.ts ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { swaggerRegistry } from "@lib/swagger/swagger";
2
+ import { instanceToPlain } from "class-transformer";
3
+
4
+ export const SwaggerResponse = (responseClass: any) => {
5
+ return (target: any, propertyKey: string) => {
6
+ const isArray = Array.isArray(responseClass);
7
+ responseClass = isArray ? responseClass[0] : responseClass;
8
+
9
+ // turn class to swagger schema
10
+ const schema: any = {
11
+ type: "object",
12
+ properties: {},
13
+ };
14
+
15
+ // get class properties
16
+ let properties = [];
17
+ let instance;
18
+ try {
19
+ instance = new responseClass();
20
+ properties = Object.getOwnPropertyNames(instanceToPlain(instance));
21
+ } catch (e) {
22
+ instance = responseClass;
23
+ properties = Object.getOwnPropertyNames(instance);
24
+ }
25
+ properties.forEach((property) => {
26
+ schema.properties[property] = {
27
+ type: (instance[property] && typeof instance[property]) || "string",
28
+ };
29
+ });
30
+
31
+ if (isArray) {
32
+ schema.type = "array";
33
+ schema.items = {
34
+ type: "object",
35
+ properties: schema.properties,
36
+ };
37
+ }
38
+
39
+ const standardResponseSchema: any = {
40
+ type: "object",
41
+ properties: {
42
+ data: schema,
43
+ message: {
44
+ type: "string",
45
+ },
46
+ status: {
47
+ type: "string",
48
+ },
49
+ },
50
+ };
51
+
52
+ if (isArray) {
53
+ standardResponseSchema.properties.meta = {
54
+ type: "object",
55
+ properties: {
56
+ total: {
57
+ type: "number",
58
+ },
59
+ page: {
60
+ type: "number",
61
+ },
62
+ limit: {
63
+ type: "number",
64
+ },
65
+ },
66
+ };
67
+ }
68
+
69
+ swaggerRegistry.updateRoute(target.constructor.name, {
70
+ propertyKey,
71
+ response: standardResponseSchema,
72
+ });
73
+ };
74
+ };
src/lib/decorators/swagger-routes.decorator.ts ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { swaggerRegistry } from "@lib/swagger/swagger";
2
+
3
+ export const SwaggerRoute = (
4
+ path: string = "",
5
+ method: "get" | "post" | "put" | "patch" | "delete"
6
+ ) => {
7
+ return (target: any, propertyKey: string) => {
8
+ swaggerRegistry.updateRoute(target.constructor.name, {
9
+ propertyKey,
10
+ path,
11
+ method,
12
+ });
13
+ };
14
+ };
15
+
16
+ export const SwaggerGet = (path: string = "") => SwaggerRoute(path, "get");
17
+ export const SwaggerPost = (path: string = "") => SwaggerRoute(path, "post");
18
+ export const SwaggerPut = (path: string = "") => SwaggerRoute(path, "put");
19
+ export const SwaggerPatch = (path: string = "") => SwaggerRoute(path, "patch");
20
+ export const SwaggerDelete = (path: string = "") =>
21
+ SwaggerRoute(path, "delete");
src/lib/decorators/swagger-tags.decorator.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import { swaggerRegistry } from "@lib/swagger/swagger";
2
+
3
+ export const SwaggerTags = (...tags: string[]) => {
4
+ if (!tags.length) return;
5
+ return (target: any) => {
6
+ target = target.prototype.constructor.name;
7
+ swaggerRegistry.setControllerTags(target, tags);
8
+ };
9
+ };
src/lib/swagger/swagger.ts ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Swagger registry class.
3
+ */
4
+ class SwaggerRegistry {
5
+ public static registry = new Map<
6
+ any,
7
+ {
8
+ routes: {
9
+ propertyKey: string;
10
+ path?: string;
11
+ method?: "get" | "post" | "put" | "patch" | "delete";
12
+ request?: any;
13
+ response?: any;
14
+ }[];
15
+ prefix: string;
16
+ tags?: string[];
17
+ }
18
+ >();
19
+
20
+ public initControllerIfNotExists(controller: any, prefix: string = "") {
21
+ if (!SwaggerRegistry.registry.has(controller)) {
22
+ SwaggerRegistry.registry.set(controller, {
23
+ routes: [],
24
+ prefix,
25
+ });
26
+ }
27
+ }
28
+
29
+ public setControllerPrefix(controller: any, prefix: string) {
30
+ this.initControllerIfNotExists(controller);
31
+ const data = SwaggerRegistry.registry.get(controller);
32
+ data.prefix = prefix;
33
+ SwaggerRegistry.registry.set(controller, data);
34
+ }
35
+
36
+ public updateRoute(
37
+ controller: any,
38
+ params: {
39
+ propertyKey: string;
40
+ path?: string;
41
+ method?: "get" | "post" | "put" | "patch" | "delete";
42
+ request?: any;
43
+ response?: any;
44
+ }
45
+ ) {
46
+ this.initControllerIfNotExists(controller);
47
+ const data = SwaggerRegistry.registry.get(controller);
48
+
49
+ // delete undefined keys
50
+ Object.keys(params).forEach(
51
+ (key) => params[key] === undefined && delete params[key]
52
+ );
53
+
54
+ const route = data.routes.find(
55
+ (route) => route.propertyKey === params.propertyKey
56
+ );
57
+ if (route) {
58
+ Object.assign(route, params);
59
+ } else {
60
+ data.routes.push(params);
61
+ }
62
+
63
+ SwaggerRegistry.registry.set(controller, data);
64
+ }
65
+
66
+ public setControllerTags(controller: any, tags: string[]) {
67
+ this.initControllerIfNotExists(controller);
68
+ const data = SwaggerRegistry.registry.get(controller);
69
+ data.tags = tags;
70
+ SwaggerRegistry.registry.set(controller, data);
71
+ }
72
+
73
+ public generateSwaggerDocument() {
74
+ const paths: any = {};
75
+ SwaggerRegistry.registry.forEach((value) => {
76
+ const controllerData = value;
77
+
78
+ controllerData.routes.forEach((route) => {
79
+ route.path = `/api/v1${controllerData.prefix}${route.path}`;
80
+
81
+ if (!paths[route.path]) {
82
+ paths[route.path] = {};
83
+ }
84
+
85
+ paths[route.path][route.method] = {
86
+ security: [
87
+ {
88
+ bearerAuth: [],
89
+ },
90
+ ],
91
+ tags: controllerData.tags,
92
+ responses: {
93
+ 200: {
94
+ description: "Success",
95
+ content: {
96
+ "application/json": {
97
+ schema: route.response,
98
+ },
99
+ },
100
+ },
101
+ },
102
+ };
103
+
104
+ if (route.request) {
105
+ paths[route.path][route.method].requestBody = {
106
+ content: {
107
+ "application/json": {
108
+ schema: route.request,
109
+ },
110
+ },
111
+ };
112
+ }
113
+
114
+ if (!paths[route.path].summary) {
115
+ paths[route.path].summary = route.propertyKey;
116
+ }
117
+
118
+ if (!paths[route.path].description) {
119
+ paths[route.path].description = route.propertyKey;
120
+ }
121
+
122
+ if (!paths[route.path].parameters) {
123
+ paths[route.path].parameters = [];
124
+ }
125
+
126
+ if (!paths[route.path].responses) {
127
+ paths[route.path].responses = [];
128
+ }
129
+ });
130
+ });
131
+
132
+ const document = {
133
+ openapi: "3.0.0",
134
+ info: {
135
+ title: "Express TypeScript Swagger",
136
+ version: "1.0.0",
137
+ description:
138
+ "API documentation using Swagger and Express with TypeScript.",
139
+ },
140
+ servers: [
141
+ {
142
+ url: "http://localhost:3000",
143
+ },
144
+ ],
145
+ security: [
146
+ {
147
+ bearerAuth: [],
148
+ },
149
+ ],
150
+ paths,
151
+ components: {
152
+ securitySchemes: {
153
+ bearerAuth: {
154
+ type: "http",
155
+ scheme: "bearer",
156
+ bearerFormat: "JWT",
157
+ },
158
+ },
159
+ },
160
+ };
161
+
162
+ return document;
163
+ }
164
+ }
165
+ export const swaggerRegistry = new SwaggerRegistry();
src/modules/console/modules/admins/controllers/admins.controller.docs.ts DELETED
@@ -1,41 +0,0 @@
1
- import { AdminSerialization } from "modules/console/common/serializers/admin.serialization";
2
- import { Tspec } from "tspec";
3
- import { ICreateAdmin } from "../validations/create-admin.validation";
4
- import { AdminsController } from "./admins.controller";
5
-
6
- export type AdminsControllerSpecs = Tspec.DefineApiSpec<{
7
- basePath: "/api/v1/console/admins";
8
- tags: ["console/admins"];
9
- paths: {
10
- "/": {
11
- get: {
12
- handler: AdminsController["list"];
13
- };
14
- post: {
15
- body: ICreateAdmin;
16
- handler: AdminsController["create"];
17
- };
18
- };
19
- "/{id}": {
20
- get: {
21
- path: {
22
- id: string;
23
- };
24
- handler: AdminsController["get"];
25
- };
26
- patch: {
27
- path: {
28
- id: string;
29
- };
30
- body: ICreateAdmin;
31
- handler: AdminsController["update"];
32
- };
33
- delete: {
34
- path: {
35
- id: string;
36
- };
37
- handler: AdminsController["delete"];
38
- };
39
- };
40
- }
41
- }>;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/modules/console/modules/admins/controllers/admins.controller.ts CHANGED
@@ -1,10 +1,13 @@
1
  import { asyncHandler } from "@helpers/async-handler";
2
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
3
  import { BaseController } from "@lib/controllers/controller.base";
4
- import { Prefix } from "@lib/decorators/prefix.decorator";
5
  import { Request, Response } from "express";
6
  import { AdminsService } from "../services/admins.service";
7
- import { ICreateAdmin, createAdminSchema } from "../validations/create-admin.validation";
 
 
 
8
  import { parsePaginationQuery } from "@helpers/pagination";
9
  import { JsonResponse } from "@lib/responses/json-response";
10
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
@@ -13,8 +16,16 @@ import { Role } from "@common/enums/role.enum";
13
  import { serialize } from "@helpers/serialize";
14
  import { AdminSerialization } from "modules/console/common/serializers/admin.serialization";
15
  import { IJSONSuccessResponse } from "@lib/responses/json-responses";
 
 
 
 
 
 
 
 
16
 
17
- @Prefix("/console/admins")
18
  @ControllerMiddleware(AdminGuardMiddleware({ roles: [Role.SUPER_ADMIN] }))
19
  export class AdminsController extends BaseController {
20
  private adminsService = new AdminsService();
@@ -40,6 +51,8 @@ export class AdminsController extends BaseController {
40
  );
41
  }
42
 
 
 
43
  list = async (
44
  req: Request,
45
  res: Response<IJSONSuccessResponse<AdminSerialization[]>>
@@ -59,6 +72,8 @@ export class AdminsController extends BaseController {
59
  );
60
  };
61
 
 
 
62
  get = async (
63
  req: Request<{ id: string }>,
64
  res: Response<IJSONSuccessResponse<AdminSerialization>>
@@ -75,6 +90,9 @@ export class AdminsController extends BaseController {
75
  );
76
  };
77
 
 
 
 
78
  create = async (
79
  req: Request<{}, {}, ICreateAdmin>,
80
  res: Response<IJSONSuccessResponse<AdminSerialization>>
@@ -90,6 +108,9 @@ export class AdminsController extends BaseController {
90
  );
91
  };
92
 
 
 
 
93
  update = async (
94
  req: Request<{ id: string }, {}, ICreateAdmin>,
95
  res: Response<IJSONSuccessResponse<AdminSerialization>>
@@ -109,6 +130,8 @@ export class AdminsController extends BaseController {
109
  );
110
  };
111
 
 
 
112
  delete = async (
113
  req: Request<{ id: string }>,
114
  res: Response<IJSONSuccessResponse<AdminSerialization>>
 
1
  import { asyncHandler } from "@helpers/async-handler";
2
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
3
  import { BaseController } from "@lib/controllers/controller.base";
4
+ import { Controller } from "@lib/decorators/prefix.decorator";
5
  import { Request, Response } from "express";
6
  import { AdminsService } from "../services/admins.service";
7
+ import {
8
+ ICreateAdmin,
9
+ createAdminSchema,
10
+ } from "../validations/create-admin.validation";
11
  import { parsePaginationQuery } from "@helpers/pagination";
12
  import { JsonResponse } from "@lib/responses/json-response";
13
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
 
16
  import { serialize } from "@helpers/serialize";
17
  import { AdminSerialization } from "modules/console/common/serializers/admin.serialization";
18
  import { IJSONSuccessResponse } from "@lib/responses/json-responses";
19
+ import {
20
+ SwaggerDelete,
21
+ SwaggerGet,
22
+ SwaggerPatch,
23
+ SwaggerPost,
24
+ } from "@lib/decorators/swagger-routes.decorator";
25
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
26
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
27
 
28
+ @Controller("/console/admins")
29
  @ControllerMiddleware(AdminGuardMiddleware({ roles: [Role.SUPER_ADMIN] }))
30
  export class AdminsController extends BaseController {
31
  private adminsService = new AdminsService();
 
51
  );
52
  }
53
 
54
+ @SwaggerGet()
55
+ @SwaggerResponse([AdminSerialization])
56
  list = async (
57
  req: Request,
58
  res: Response<IJSONSuccessResponse<AdminSerialization[]>>
 
72
  );
73
  };
74
 
75
+ @SwaggerGet("/:id")
76
+ @SwaggerResponse(AdminSerialization)
77
  get = async (
78
  req: Request<{ id: string }>,
79
  res: Response<IJSONSuccessResponse<AdminSerialization>>
 
90
  );
91
  };
92
 
93
+ @SwaggerPost()
94
+ @SwaggerResponse(AdminSerialization)
95
+ @SwaggerRequest(createAdminSchema)
96
  create = async (
97
  req: Request<{}, {}, ICreateAdmin>,
98
  res: Response<IJSONSuccessResponse<AdminSerialization>>
 
108
  );
109
  };
110
 
111
+ @SwaggerPatch("/:id")
112
+ @SwaggerResponse(AdminSerialization)
113
+ @SwaggerRequest(createAdminSchema)
114
  update = async (
115
  req: Request<{ id: string }, {}, ICreateAdmin>,
116
  res: Response<IJSONSuccessResponse<AdminSerialization>>
 
130
  );
131
  };
132
 
133
+ @SwaggerDelete("/:id")
134
+ @SwaggerResponse(AdminSerialization)
135
  delete = async (
136
  req: Request<{ id: string }>,
137
  res: Response<IJSONSuccessResponse<AdminSerialization>>
src/modules/console/modules/auth/controllers/auth.controller.ts CHANGED
@@ -2,14 +2,17 @@ import { asyncHandler } from "@helpers/async-handler";
2
  import { serialize } from "@helpers/serialize";
3
  import { bodyValidator } from "@helpers/validation.helper";
4
  import { BaseController } from "@lib/controllers/controller.base";
5
- import { Prefix } from "@lib/decorators/prefix.decorator";
6
  import { JsonResponse } from "@lib/responses/json-response";
7
  import { Request, Response } from "express";
8
  import { loginValidationSchema } from "modules/users/modules/auth/validation/login.validation";
9
  import { ConsoleAuthService } from "../services/auth.service";
10
  import { AdminSerialization } from "modules/console/common/serializers/admin.serialization";
 
 
 
11
 
12
- @Prefix("/console/auth")
13
  export class ConsoleAuthController extends BaseController {
14
  private authService = new ConsoleAuthService();
15
 
@@ -21,6 +24,9 @@ export class ConsoleAuthController extends BaseController {
21
  );
22
  }
23
 
 
 
 
24
  login = async (req: Request, res: Response): Promise<Response> => {
25
  const { admin, token } = await this.authService.login(req.body);
26
 
 
2
  import { serialize } from "@helpers/serialize";
3
  import { bodyValidator } from "@helpers/validation.helper";
4
  import { BaseController } from "@lib/controllers/controller.base";
5
+ import { Controller } from "@lib/decorators/prefix.decorator";
6
  import { JsonResponse } from "@lib/responses/json-response";
7
  import { Request, Response } from "express";
8
  import { loginValidationSchema } from "modules/users/modules/auth/validation/login.validation";
9
  import { ConsoleAuthService } from "../services/auth.service";
10
  import { AdminSerialization } from "modules/console/common/serializers/admin.serialization";
11
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
12
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
13
+ import { SwaggerPost } from "@lib/decorators/swagger-routes.decorator";
14
 
15
+ @Controller("/console/auth")
16
  export class ConsoleAuthController extends BaseController {
17
  private authService = new ConsoleAuthService();
18
 
 
24
  );
25
  }
26
 
27
+ @SwaggerPost('/login')
28
+ @SwaggerRequest(loginValidationSchema)
29
+ @SwaggerResponse(AdminSerialization)
30
  login = async (req: Request, res: Response): Promise<Response> => {
31
  const { admin, token } = await this.authService.login(req.body);
32
 
src/modules/console/modules/equipments/controllers/equipments.controller.ts CHANGED
@@ -4,7 +4,7 @@ import { parsePaginationQuery } from "@helpers/pagination";
4
  import { asyncHandler } from "@helpers/async-handler";
5
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { BaseController } from "@lib/controllers/controller.base";
7
- import { Prefix } from "@lib/decorators/prefix.decorator";
8
  import { serialize } from "@helpers/serialize";
9
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
10
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
@@ -12,90 +12,112 @@ import { EquipmentsService } from "../services/equipments.service";
12
  import { createEquipmentchema } from "../validations/create-equipment.validation";
13
  import { updateEquipmentSchema } from "../validations/update-equipment.validation";
14
  import { EquipmentSerialization } from "@common/serializers/muscle.serialization";
 
 
 
 
 
 
 
 
15
 
16
- @Prefix("/console/equipments")
17
  @ControllerMiddleware(AdminGuardMiddleware({}))
18
  export class EquipmentsController extends BaseController {
19
- private equipmentsService = new EquipmentsService();
20
 
21
- setRoutes() {
22
- this.router.get("/", asyncHandler(this.list));
23
- this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
24
- this.router.post("/",
25
- bodyValidator(createEquipmentchema),
26
- asyncHandler(this.create));
27
- this.router.patch(
28
- "/:id",
29
- paramsValidator("id"),
30
- bodyValidator(updateEquipmentSchema),
31
- asyncHandler(this.update)
32
- );
33
- this.router.delete(
34
- "/:id",
35
- paramsValidator("id"),
36
- asyncHandler(this.delete)
37
- );
38
- }
 
 
39
 
40
- list = async (req: Request, res: Response) => {
41
- const paginationQuery = parsePaginationQuery(req.query);
42
- const { docs, paginationData } = await this.equipmentsService.list(
43
- {},
44
- paginationQuery
45
- );
 
 
46
 
47
- return JsonResponse.success(
48
- {
49
- data: serialize(docs, EquipmentSerialization),
50
- meta: paginationData,
51
- },
52
- res
53
- );
54
- };
55
 
56
- get = async (req: Request, res: Response) => {
57
- const data = await this.equipmentsService.findOneOrFail({
58
- _id: req.params.id,
59
- });
60
- return JsonResponse.success(
61
- {
62
- data: serialize(data.toJSON(), EquipmentSerialization),
63
- },
64
- res
65
- );
66
- };
 
 
67
 
68
- create = async (req: Request, res: Response) => {
69
- const data = await this.equipmentsService.create(req.body);
70
- return JsonResponse.success(
71
- {
72
- status: 201,
73
- data: serialize(data.toJSON(), EquipmentSerialization),
74
- },
75
- res
76
- );
77
- };
 
 
 
78
 
79
- update = async (req: Request, res: Response) => {
80
- const data = await this.equipmentsService.updateOne(
81
- { _id: req.params.id },
82
- req.body
83
- );
84
- return JsonResponse.success(
85
- {
86
- data: serialize(data.toJSON(), EquipmentSerialization),
87
- },
88
- res
89
- );
90
- };
 
 
 
91
 
92
- delete = async (req: Request, res: Response) => {
93
- const data = await this.equipmentsService.deleteOne({ _id: req.params.id });
94
- return JsonResponse.success(
95
- {
96
- data: serialize(data.toJSON(), EquipmentSerialization),
97
- },
98
- res
99
- );
100
- };
101
- };
 
 
 
4
  import { asyncHandler } from "@helpers/async-handler";
5
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { BaseController } from "@lib/controllers/controller.base";
7
+ import { Controller } from "@lib/decorators/prefix.decorator";
8
  import { serialize } from "@helpers/serialize";
9
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
10
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
 
12
  import { createEquipmentchema } from "../validations/create-equipment.validation";
13
  import { updateEquipmentSchema } from "../validations/update-equipment.validation";
14
  import { EquipmentSerialization } from "@common/serializers/muscle.serialization";
15
+ import {
16
+ SwaggerDelete,
17
+ SwaggerGet,
18
+ SwaggerPatch,
19
+ SwaggerPost,
20
+ } from "@lib/decorators/swagger-routes.decorator";
21
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
22
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
23
 
24
+ @Controller("/console/equipments")
25
  @ControllerMiddleware(AdminGuardMiddleware({}))
26
  export class EquipmentsController extends BaseController {
27
+ private equipmentsService = new EquipmentsService();
28
 
29
+ setRoutes() {
30
+ this.router.get("/", asyncHandler(this.list));
31
+ this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
32
+ this.router.post(
33
+ "/",
34
+ bodyValidator(createEquipmentchema),
35
+ asyncHandler(this.create)
36
+ );
37
+ this.router.patch(
38
+ "/:id",
39
+ paramsValidator("id"),
40
+ bodyValidator(updateEquipmentSchema),
41
+ asyncHandler(this.update)
42
+ );
43
+ this.router.delete(
44
+ "/:id",
45
+ paramsValidator("id"),
46
+ asyncHandler(this.delete)
47
+ );
48
+ }
49
 
50
+ @SwaggerGet()
51
+ @SwaggerResponse([EquipmentSerialization])
52
+ list = async (req: Request, res: Response) => {
53
+ const paginationQuery = parsePaginationQuery(req.query);
54
+ const { docs, paginationData } = await this.equipmentsService.list(
55
+ {},
56
+ paginationQuery
57
+ );
58
 
59
+ return JsonResponse.success(
60
+ {
61
+ data: serialize(docs, EquipmentSerialization),
62
+ meta: paginationData,
63
+ },
64
+ res
65
+ );
66
+ };
67
 
68
+ @SwaggerGet("/{id}")
69
+ @SwaggerResponse(EquipmentSerialization)
70
+ get = async (req: Request, res: Response) => {
71
+ const data = await this.equipmentsService.findOneOrFail({
72
+ _id: req.params.id,
73
+ });
74
+ return JsonResponse.success(
75
+ {
76
+ data: serialize(data.toJSON(), EquipmentSerialization),
77
+ },
78
+ res
79
+ );
80
+ };
81
 
82
+ @SwaggerPost()
83
+ @SwaggerResponse(EquipmentSerialization)
84
+ @SwaggerRequest(createEquipmentchema)
85
+ create = async (req: Request, res: Response) => {
86
+ const data = await this.equipmentsService.create(req.body);
87
+ return JsonResponse.success(
88
+ {
89
+ status: 201,
90
+ data: serialize(data.toJSON(), EquipmentSerialization),
91
+ },
92
+ res
93
+ );
94
+ };
95
 
96
+ @SwaggerPatch("/{id}")
97
+ @SwaggerResponse(EquipmentSerialization)
98
+ @SwaggerRequest(updateEquipmentSchema)
99
+ update = async (req: Request, res: Response) => {
100
+ const data = await this.equipmentsService.updateOne(
101
+ { _id: req.params.id },
102
+ req.body
103
+ );
104
+ return JsonResponse.success(
105
+ {
106
+ data: serialize(data.toJSON(), EquipmentSerialization),
107
+ },
108
+ res
109
+ );
110
+ };
111
 
112
+ @SwaggerDelete("/{id}")
113
+ @SwaggerResponse(EquipmentSerialization)
114
+ delete = async (req: Request, res: Response) => {
115
+ const data = await this.equipmentsService.deleteOne({ _id: req.params.id });
116
+ return JsonResponse.success(
117
+ {
118
+ data: serialize(data.toJSON(), EquipmentSerialization),
119
+ },
120
+ res
121
+ );
122
+ };
123
+ }
src/modules/console/modules/exercises/controllers/exercises.controller.ts CHANGED
@@ -4,7 +4,7 @@ import { parsePaginationQuery } from "@helpers/pagination";
4
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
5
  import { BaseController } from "@lib/controllers/controller.base";
6
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
7
- import { Prefix } from "@lib/decorators/prefix.decorator";
8
  import { JsonResponse } from "@lib/responses/json-response";
9
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
10
  import { ExercisesService } from "../services/exercises.service";
@@ -12,8 +12,11 @@ import { Request, Response } from "express";
12
  import { serialize } from "@helpers/serialize";
13
  import { createExerciseSchema } from "../validations/create-excercise.validation";
14
  import { updateExerciseSchema } from "../validations/update-excercise.validation";
 
 
 
15
 
16
- @Prefix("/console/exercises")
17
  @ControllerMiddleware(AdminGuardMiddleware({}))
18
  export class ExercisesController extends BaseController {
19
  private exercisesService = new ExercisesService();
@@ -39,6 +42,8 @@ export class ExercisesController extends BaseController {
39
  );
40
  }
41
 
 
 
42
  list = async (req: Request, res: Response) => {
43
  const paginationQuery = parsePaginationQuery(req.query);
44
  const { docs, paginationData } = await this.exercisesService.list(
@@ -55,6 +60,8 @@ export class ExercisesController extends BaseController {
55
  );
56
  };
57
 
 
 
58
  get = async (req: Request, res: Response) => {
59
  const data = await this.exercisesService.findOneOrFail({
60
  _id: req.params.id,
@@ -67,6 +74,9 @@ export class ExercisesController extends BaseController {
67
  );
68
  };
69
 
 
 
 
70
  create = async (req: Request, res: Response) => {
71
  const data = await this.exercisesService.create(req.body);
72
  return JsonResponse.success(
@@ -77,6 +87,9 @@ export class ExercisesController extends BaseController {
77
  );
78
  };
79
 
 
 
 
80
  update = async (req: Request, res: Response) => {
81
  const data = await this.exercisesService.updateOne(
82
  { _id: req.params.id },
@@ -90,6 +103,8 @@ export class ExercisesController extends BaseController {
90
  );
91
  };
92
 
 
 
93
  delete = async (req: Request, res: Response) => {
94
  await this.exercisesService.deleteOne({ _id: req.params.id });
95
  return JsonResponse.success({}, res);
 
4
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
5
  import { BaseController } from "@lib/controllers/controller.base";
6
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
7
+ import { Controller } from "@lib/decorators/prefix.decorator";
8
  import { JsonResponse } from "@lib/responses/json-response";
9
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
10
  import { ExercisesService } from "../services/exercises.service";
 
12
  import { serialize } from "@helpers/serialize";
13
  import { createExerciseSchema } from "../validations/create-excercise.validation";
14
  import { updateExerciseSchema } from "../validations/update-excercise.validation";
15
+ import { SwaggerDelete, SwaggerGet, SwaggerPatch, SwaggerPost } from "@lib/decorators/swagger-routes.decorator";
16
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
17
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
18
 
19
+ @Controller("/console/exercises")
20
  @ControllerMiddleware(AdminGuardMiddleware({}))
21
  export class ExercisesController extends BaseController {
22
  private exercisesService = new ExercisesService();
 
42
  );
43
  }
44
 
45
+ @SwaggerGet()
46
+ @SwaggerResponse([ExerciseSerialization])
47
  list = async (req: Request, res: Response) => {
48
  const paginationQuery = parsePaginationQuery(req.query);
49
  const { docs, paginationData } = await this.exercisesService.list(
 
60
  );
61
  };
62
 
63
+ @SwaggerGet("/:id")
64
+ @SwaggerResponse(ExerciseSerialization)
65
  get = async (req: Request, res: Response) => {
66
  const data = await this.exercisesService.findOneOrFail({
67
  _id: req.params.id,
 
74
  );
75
  };
76
 
77
+ @SwaggerPost()
78
+ @SwaggerResponse(ExerciseSerialization)
79
+ @SwaggerRequest(createExerciseSchema)
80
  create = async (req: Request, res: Response) => {
81
  const data = await this.exercisesService.create(req.body);
82
  return JsonResponse.success(
 
87
  );
88
  };
89
 
90
+ @SwaggerPatch("/:id")
91
+ @SwaggerRequest(updateExerciseSchema)
92
+ @SwaggerResponse(ExerciseSerialization)
93
  update = async (req: Request, res: Response) => {
94
  const data = await this.exercisesService.updateOne(
95
  { _id: req.params.id },
 
103
  );
104
  };
105
 
106
+ @SwaggerDelete("/:id")
107
+ @SwaggerResponse({})
108
  delete = async (req: Request, res: Response) => {
109
  await this.exercisesService.deleteOne({ _id: req.params.id });
110
  return JsonResponse.success({}, res);
src/modules/console/modules/muscles/controllers/muscles.controller.ts CHANGED
@@ -4,7 +4,7 @@ import { parsePaginationQuery } from "@helpers/pagination";
4
  import { asyncHandler } from "@helpers/async-handler";
5
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { BaseController } from "@lib/controllers/controller.base";
7
- import { Prefix } from "@lib/decorators/prefix.decorator";
8
  import { serialize } from "@helpers/serialize";
9
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
10
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
@@ -12,8 +12,11 @@ import { MusclesService } from "../services/muscles.service";
12
  import { createMusclechema } from "../validations/create-muscle.validation";
13
  import { updateMuscleSchema } from "../validations/update-muscle.validation";
14
  import { MuscleSerialization } from "@common/serializers/equipment.serialization";
 
 
 
15
 
16
- @Prefix("/console/muscles")
17
  @ControllerMiddleware(AdminGuardMiddleware({}))
18
  export class MusclesController extends BaseController {
19
  private musclesService = new MusclesService();
@@ -37,6 +40,8 @@ export class MusclesController extends BaseController {
37
  );
38
  }
39
 
 
 
40
  list = async (req: Request, res: Response) => {
41
  const paginationQuery = parsePaginationQuery(req.query);
42
  const { docs, paginationData } = await this.musclesService.list(
@@ -53,6 +58,8 @@ export class MusclesController extends BaseController {
53
  );
54
  };
55
 
 
 
56
  get = async (req: Request, res: Response) => {
57
  const data = await this.musclesService.findOneOrFail({
58
  _id: req.params.id,
@@ -65,6 +72,9 @@ export class MusclesController extends BaseController {
65
  );
66
  };
67
 
 
 
 
68
  create = async (req: Request, res: Response) => {
69
  const data = await this.musclesService.create(req.body);
70
  return JsonResponse.success(
@@ -76,6 +86,9 @@ export class MusclesController extends BaseController {
76
  );
77
  };
78
 
 
 
 
79
  update = async (req: Request, res: Response) => {
80
  const data = await this.musclesService.updateOne(
81
  { _id: req.params.id },
@@ -89,6 +102,8 @@ export class MusclesController extends BaseController {
89
  );
90
  };
91
 
 
 
92
  delete = async (req: Request, res: Response) => {
93
  const data = await this.musclesService.deleteOne({ _id: req.params.id });
94
  return JsonResponse.success(
 
4
  import { asyncHandler } from "@helpers/async-handler";
5
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { BaseController } from "@lib/controllers/controller.base";
7
+ import { Controller } from "@lib/decorators/prefix.decorator";
8
  import { serialize } from "@helpers/serialize";
9
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
10
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
 
12
  import { createMusclechema } from "../validations/create-muscle.validation";
13
  import { updateMuscleSchema } from "../validations/update-muscle.validation";
14
  import { MuscleSerialization } from "@common/serializers/equipment.serialization";
15
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
16
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
17
+ import { SwaggerGet, SwaggerPost, SwaggerPatch, SwaggerDelete } from "@lib/decorators/swagger-routes.decorator";
18
 
19
+ @Controller("/console/muscles")
20
  @ControllerMiddleware(AdminGuardMiddleware({}))
21
  export class MusclesController extends BaseController {
22
  private musclesService = new MusclesService();
 
40
  );
41
  }
42
 
43
+ @SwaggerGet()
44
+ @SwaggerResponse([MuscleSerialization])
45
  list = async (req: Request, res: Response) => {
46
  const paginationQuery = parsePaginationQuery(req.query);
47
  const { docs, paginationData } = await this.musclesService.list(
 
58
  );
59
  };
60
 
61
+ @SwaggerGet('/:id')
62
+ @SwaggerResponse(MuscleSerialization)
63
  get = async (req: Request, res: Response) => {
64
  const data = await this.musclesService.findOneOrFail({
65
  _id: req.params.id,
 
72
  );
73
  };
74
 
75
+ @SwaggerPost()
76
+ @SwaggerRequest(createMusclechema)
77
+ @SwaggerResponse(MuscleSerialization)
78
  create = async (req: Request, res: Response) => {
79
  const data = await this.musclesService.create(req.body);
80
  return JsonResponse.success(
 
86
  );
87
  };
88
 
89
+ @SwaggerPatch('/:id')
90
+ @SwaggerRequest(updateMuscleSchema)
91
+ @SwaggerResponse(MuscleSerialization)
92
  update = async (req: Request, res: Response) => {
93
  const data = await this.musclesService.updateOne(
94
  { _id: req.params.id },
 
102
  );
103
  };
104
 
105
+ @SwaggerDelete('/:id')
106
+ @SwaggerResponse(MuscleSerialization)
107
  delete = async (req: Request, res: Response) => {
108
  const data = await this.musclesService.deleteOne({ _id: req.params.id });
109
  return JsonResponse.success(
src/modules/console/modules/users/controllers/users.controller.ts CHANGED
@@ -3,11 +3,13 @@ import { JsonResponse } from "@lib/responses/json-response";
3
  import { Request, Response } from "express";
4
  import { asyncHandler } from "@helpers/async-handler";
5
  import { BaseController } from "@lib/controllers/controller.base";
6
- import { Prefix } from "@lib/decorators/prefix.decorator";
7
  import { serialize } from "@helpers/serialize";
8
  import { UserSerialization } from "@common/serializers/user.serialization";
 
 
9
 
10
- @Prefix("/console/users")
11
  export class AdminUsersController extends BaseController {
12
  private usersService: UsersService = new UsersService();
13
 
@@ -15,6 +17,8 @@ export class AdminUsersController extends BaseController {
15
  this.router.post("/create", asyncHandler(this.create));
16
  }
17
 
 
 
18
  create = async (req: Request, res: Response): Promise<Response> => {
19
  let user = await this.usersService.create(req.body);
20
 
 
3
  import { Request, Response } from "express";
4
  import { asyncHandler } from "@helpers/async-handler";
5
  import { BaseController } from "@lib/controllers/controller.base";
6
+ import { Controller } from "@lib/decorators/prefix.decorator";
7
  import { serialize } from "@helpers/serialize";
8
  import { UserSerialization } from "@common/serializers/user.serialization";
9
+ import { SwaggerPost } from "@lib/decorators/swagger-routes.decorator";
10
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
11
 
12
+ @Controller("/console/users")
13
  export class AdminUsersController extends BaseController {
14
  private usersService: UsersService = new UsersService();
15
 
 
17
  this.router.post("/create", asyncHandler(this.create));
18
  }
19
 
20
+ @SwaggerPost("/create")
21
+ @SwaggerResponse(UserSerialization)
22
  create = async (req: Request, res: Response): Promise<Response> => {
23
  let user = await this.usersService.create(req.body);
24
 
src/modules/console/modules/workouts/controllers/workouts.controller.ts CHANGED
@@ -7,95 +7,117 @@ import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
7
  import { createWorkoutSchema } from "../validations/create-workout.validation";
8
  import { updateWorkoutSchema } from "../validations/update-workout.validation";
9
  import { BaseController } from "@lib/controllers/controller.base";
10
- import { Prefix } from "@lib/decorators/prefix.decorator";
11
  import { serialize } from "@helpers/serialize";
12
  import { WorkoutSerialization } from "@common/serializers/workout.serialization";
13
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
14
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
 
 
 
 
 
 
 
 
15
 
16
- @Prefix("/console/workouts")
17
  @ControllerMiddleware(AdminGuardMiddleware({}))
18
  export class WorkoutController extends BaseController {
19
- private workoutsService = new WorkoutService();
20
 
21
- setRoutes() {
22
- this.router.get("/", asyncHandler(this.list));
23
- this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
24
- this.router.post("/",
25
- bodyValidator(createWorkoutSchema),
26
- asyncHandler(this.create));
27
- this.router.patch(
28
- "/:id",
29
- paramsValidator("id"),
30
- bodyValidator(updateWorkoutSchema),
31
- asyncHandler(this.update)
32
- );
33
- this.router.delete(
34
- "/:id",
35
- paramsValidator("id"),
36
- asyncHandler(this.delete)
37
- );
38
- }
 
 
39
 
40
- list = async (req: Request, res: Response) => {
41
- const paginationQuery = parsePaginationQuery(req.query);
42
- const { docs, paginationData } = await this.workoutsService.list(
43
- {},
44
- paginationQuery
45
- );
 
 
46
 
47
- return JsonResponse.success(
48
- {
49
- data: serialize(docs, WorkoutSerialization),
50
- meta: paginationData,
51
- },
52
- res
53
- );
54
- };
55
 
56
- get = async (req: Request, res: Response) => {
57
- const data = await this.workoutsService.findOneOrFail({
58
- _id: req.params.id,
59
- });
60
- return JsonResponse.success(
61
- {
62
- data: serialize(data.toJSON(), WorkoutSerialization),
63
- },
64
- res
65
- );
66
- };
 
 
67
 
68
- create = async (req: Request, res: Response) => {
69
- const data = await this.workoutsService.create(req.body);
70
- return JsonResponse.success(
71
- {
72
- status: 201,
73
- data: serialize(data.toJSON(), WorkoutSerialization),
74
- },
75
- res
76
- );
77
- };
 
 
 
78
 
79
- update = async (req: Request, res: Response) => {
80
- const data = await this.workoutsService.updateOne(
81
- { _id: req.params.id },
82
- req.body
83
- );
84
- return JsonResponse.success(
85
- {
86
- data: serialize(data.toJSON(), WorkoutSerialization),
87
- },
88
- res
89
- );
90
- };
 
 
 
91
 
92
- delete = async (req: Request, res: Response) => {
93
- const data = await this.workoutsService.deleteOne({ _id: req.params.id });
94
- return JsonResponse.success(
95
- {
96
- data: serialize(data.toJSON(), WorkoutSerialization),
97
- },
98
- res
99
- );
100
- };
101
- };
 
 
 
7
  import { createWorkoutSchema } from "../validations/create-workout.validation";
8
  import { updateWorkoutSchema } from "../validations/update-workout.validation";
9
  import { BaseController } from "@lib/controllers/controller.base";
10
+ import { Controller } from "@lib/decorators/prefix.decorator";
11
  import { serialize } from "@helpers/serialize";
12
  import { WorkoutSerialization } from "@common/serializers/workout.serialization";
13
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
14
  import { AdminGuardMiddleware } from "modules/console/common/guards/admins.guard";
15
+ import {
16
+ SwaggerDelete,
17
+ SwaggerGet,
18
+ SwaggerPatch,
19
+ SwaggerPost,
20
+ } from "@lib/decorators/swagger-routes.decorator";
21
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
22
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
23
 
24
+ @Controller("/console/workouts")
25
  @ControllerMiddleware(AdminGuardMiddleware({}))
26
  export class WorkoutController extends BaseController {
27
+ private workoutsService = new WorkoutService();
28
 
29
+ setRoutes() {
30
+ this.router.get("/", asyncHandler(this.list));
31
+ this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
32
+ this.router.post(
33
+ "/",
34
+ bodyValidator(createWorkoutSchema),
35
+ asyncHandler(this.create)
36
+ );
37
+ this.router.patch(
38
+ "/:id",
39
+ paramsValidator("id"),
40
+ bodyValidator(updateWorkoutSchema),
41
+ asyncHandler(this.update)
42
+ );
43
+ this.router.delete(
44
+ "/:id",
45
+ paramsValidator("id"),
46
+ asyncHandler(this.delete)
47
+ );
48
+ }
49
 
50
+ @SwaggerGet()
51
+ @SwaggerResponse([WorkoutSerialization])
52
+ list = async (req: Request, res: Response) => {
53
+ const paginationQuery = parsePaginationQuery(req.query);
54
+ const { docs, paginationData } = await this.workoutsService.list(
55
+ {},
56
+ paginationQuery
57
+ );
58
 
59
+ return JsonResponse.success(
60
+ {
61
+ data: serialize(docs, WorkoutSerialization),
62
+ meta: paginationData,
63
+ },
64
+ res
65
+ );
66
+ };
67
 
68
+ @SwaggerGet("/:id")
69
+ @SwaggerResponse(WorkoutSerialization)
70
+ get = async (req: Request, res: Response) => {
71
+ const data = await this.workoutsService.findOneOrFail({
72
+ _id: req.params.id,
73
+ });
74
+ return JsonResponse.success(
75
+ {
76
+ data: serialize(data.toJSON(), WorkoutSerialization),
77
+ },
78
+ res
79
+ );
80
+ };
81
 
82
+ @SwaggerPost()
83
+ @SwaggerResponse(WorkoutSerialization)
84
+ @SwaggerRequest(createWorkoutSchema)
85
+ create = async (req: Request, res: Response) => {
86
+ const data = await this.workoutsService.create(req.body);
87
+ return JsonResponse.success(
88
+ {
89
+ status: 201,
90
+ data: serialize(data.toJSON(), WorkoutSerialization),
91
+ },
92
+ res
93
+ );
94
+ };
95
 
96
+ @SwaggerPatch("/:id")
97
+ @SwaggerResponse(WorkoutSerialization)
98
+ @SwaggerRequest(updateWorkoutSchema)
99
+ update = async (req: Request, res: Response) => {
100
+ const data = await this.workoutsService.updateOne(
101
+ { _id: req.params.id },
102
+ req.body
103
+ );
104
+ return JsonResponse.success(
105
+ {
106
+ data: serialize(data.toJSON(), WorkoutSerialization),
107
+ },
108
+ res
109
+ );
110
+ };
111
 
112
+ @SwaggerDelete("/:id")
113
+ @SwaggerResponse(WorkoutSerialization)
114
+ delete = async (req: Request, res: Response) => {
115
+ const data = await this.workoutsService.deleteOne({ _id: req.params.id });
116
+ return JsonResponse.success(
117
+ {
118
+ data: serialize(data.toJSON(), WorkoutSerialization),
119
+ },
120
+ res
121
+ );
122
+ };
123
+ }
src/modules/users/modules/auth/controllers/auth.controller.ts CHANGED
@@ -8,12 +8,15 @@ import {
8
  import { asyncHandler } from "@helpers/async-handler";
9
  import { bodyValidator } from "@helpers/validation.helper";
10
  import { BaseController } from "@lib/controllers/controller.base";
11
- import { Prefix } from "@lib/decorators/prefix.decorator";
12
  import { serialize } from "@helpers/serialize";
13
  import { UserSerialization } from "@common/serializers/user.serialization";
14
  import { UsersAuthService } from "../services/users-auth.service";
 
 
 
15
 
16
- @Prefix("/user/auth")
17
  export class UsersAuthController extends BaseController {
18
  private authService = new UsersAuthService();
19
 
@@ -30,6 +33,9 @@ export class UsersAuthController extends BaseController {
30
  );
31
  }
32
 
 
 
 
33
  register = async (req: Request, res: Response) => {
34
  const user = await this.authService.register(req.body as IUserRegister);
35
 
@@ -41,6 +47,9 @@ export class UsersAuthController extends BaseController {
41
  );
42
  };
43
 
 
 
 
44
  login = async (req: Request, res: Response): Promise<Response> => {
45
  const { user, token } = await this.authService.login(req.body);
46
 
 
8
  import { asyncHandler } from "@helpers/async-handler";
9
  import { bodyValidator } from "@helpers/validation.helper";
10
  import { BaseController } from "@lib/controllers/controller.base";
11
+ import { Controller } from "@lib/decorators/prefix.decorator";
12
  import { serialize } from "@helpers/serialize";
13
  import { UserSerialization } from "@common/serializers/user.serialization";
14
  import { UsersAuthService } from "../services/users-auth.service";
15
+ import { SwaggerPost } from "@lib/decorators/swagger-routes.decorator";
16
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
17
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
18
 
19
+ @Controller("/user/auth")
20
  export class UsersAuthController extends BaseController {
21
  private authService = new UsersAuthService();
22
 
 
33
  );
34
  }
35
 
36
+ @SwaggerPost("/register")
37
+ @SwaggerRequest(userRegisterSchema)
38
+ @SwaggerResponse(UserSerialization)
39
  register = async (req: Request, res: Response) => {
40
  const user = await this.authService.register(req.body as IUserRegister);
41
 
 
47
  );
48
  };
49
 
50
+ @SwaggerPost("/login")
51
+ @SwaggerRequest(loginValidationSchema)
52
+ @SwaggerResponse(UserSerialization)
53
  login = async (req: Request, res: Response): Promise<Response> => {
54
  const { user, token } = await this.authService.login(req.body);
55
 
src/modules/users/modules/exercises/controllers/exercises.controller.ts CHANGED
@@ -5,13 +5,15 @@ import { parsePaginationQuery } from "@helpers/pagination";
5
  import { asyncHandler } from "@helpers/async-handler";
6
  import { paramsValidator } from "@helpers/validation.helper";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
- import { Prefix } from "@lib/decorators/prefix.decorator";
9
  import { serialize } from "@helpers/serialize";
10
  import { ExerciseSerialization } from "@common/serializers/exercise.serialization";
11
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
12
  import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
 
 
13
 
14
- @Prefix("/user/exercises")
15
  @ControllerMiddleware(UsersGuardMiddleware())
16
  export class ExerciseController extends BaseController {
17
  private exercisesService = new ExerciseService();
@@ -21,6 +23,8 @@ export class ExerciseController extends BaseController {
21
  this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
22
  }
23
 
 
 
24
  list = async (req: Request, res: Response): Promise<Response> => {
25
  const paginationQuery = parsePaginationQuery(req.query);
26
  const { docs, paginationData } = await this.exercisesService.list(
@@ -37,6 +41,8 @@ export class ExerciseController extends BaseController {
37
  );
38
  };
39
 
 
 
40
  get = async (req: Request, res: Response): Promise<Response> => {
41
  const data = await this.exercisesService.findOneOrFail({
42
  _id: req.params.id,
 
5
  import { asyncHandler } from "@helpers/async-handler";
6
  import { paramsValidator } from "@helpers/validation.helper";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
+ import { Controller } from "@lib/decorators/prefix.decorator";
9
  import { serialize } from "@helpers/serialize";
10
  import { ExerciseSerialization } from "@common/serializers/exercise.serialization";
11
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
12
  import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
13
+ import { SwaggerGet } from "@lib/decorators/swagger-routes.decorator";
14
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
15
 
16
+ @Controller("/user/exercises")
17
  @ControllerMiddleware(UsersGuardMiddleware())
18
  export class ExerciseController extends BaseController {
19
  private exercisesService = new ExerciseService();
 
23
  this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
24
  }
25
 
26
+ @SwaggerGet()
27
+ @SwaggerResponse([ExerciseSerialization])
28
  list = async (req: Request, res: Response): Promise<Response> => {
29
  const paginationQuery = parsePaginationQuery(req.query);
30
  const { docs, paginationData } = await this.exercisesService.list(
 
41
  );
42
  };
43
 
44
+ @SwaggerGet("/:id")
45
+ @SwaggerResponse(ExerciseSerialization)
46
  get = async (req: Request, res: Response): Promise<Response> => {
47
  const data = await this.exercisesService.findOneOrFail({
48
  _id: req.params.id,
src/modules/users/modules/user-registered-workouts/controllers/user-registered-workouts.controller.ts CHANGED
@@ -5,19 +5,25 @@ import { parsePaginationQuery } from "@helpers/pagination";
5
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { asyncHandler } from "@helpers/async-handler";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
- import { Prefix } from "@lib/decorators/prefix.decorator";
9
  import { serialize } from "@helpers/serialize";
10
  import { UserRegisteredWorkoutsSerialization } from "@common/serializers/user-registered-workout.serialization";
11
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
12
  import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
13
  import { createUserRegisteredWorkoutsSchema } from "../validations/create-user-registered-workouts.validation";
14
  import { updateUserRegisteredWorkoutsSchema } from "../validations/update-user-registered-workouts.validation";
 
 
 
 
 
 
15
 
16
  interface userRequest extends Request {
17
  jwtPayload?: any;
18
  }
19
 
20
- @Prefix("/user/myWorkouts")
21
  @ControllerMiddleware(UsersGuardMiddleware())
22
  export class userRegisteredWorkoutsController extends BaseController {
23
  private userRegisteredWorkoutsService = new UserRegisteredWorkoutsService();
@@ -25,23 +31,28 @@ export class userRegisteredWorkoutsController extends BaseController {
25
  setRoutes(): void {
26
  this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
27
  this.router.get("/", asyncHandler(this.list));
28
- this.router.post("/",
 
29
  bodyValidator(createUserRegisteredWorkoutsSchema),
30
- asyncHandler(this.create));
 
31
  }
32
 
 
 
33
  list = async (req: userRequest, res: Response) => {
34
  const paginationQuery = parsePaginationQuery(req.query);
35
- const { docs, paginationData } = await this.userRegisteredWorkoutsService.list(
36
- { user: req.jwtPayload.id },
37
- paginationQuery,
38
- {
39
- populateArray: [
40
- { path: "workout", select: "-templateWeeks -created_by" },
41
- { path: "weeks.days.exercises", select: "name media reps sets" },
42
- ]
43
- }
44
- );
 
45
 
46
  return JsonResponse.success(
47
  {
@@ -52,6 +63,8 @@ export class userRegisteredWorkoutsController extends BaseController {
52
  );
53
  };
54
 
 
 
55
  get = async (req: userRequest, res: Response) => {
56
  const data = await this.userRegisteredWorkoutsService.findOneOrFail(
57
  { _id: req.params.id },
@@ -59,7 +72,7 @@ export class userRegisteredWorkoutsController extends BaseController {
59
  populateArray: [
60
  { path: "workout", select: "-template_weeks -created_by" },
61
  { path: "weeks.days.exercises", select: "name media reps sets" },
62
- ]
63
  }
64
  );
65
  return JsonResponse.success(
@@ -70,6 +83,9 @@ export class userRegisteredWorkoutsController extends BaseController {
70
  );
71
  };
72
 
 
 
 
73
  create = async (req: userRequest, res: Response) => {
74
  const data = await this.userRegisteredWorkoutsService.create(req.body);
75
  return JsonResponse.success(
@@ -80,5 +96,4 @@ export class userRegisteredWorkoutsController extends BaseController {
80
  res
81
  );
82
  };
83
-
84
  }
 
5
  import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { asyncHandler } from "@helpers/async-handler";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
+ import { Controller } from "@lib/decorators/prefix.decorator";
9
  import { serialize } from "@helpers/serialize";
10
  import { UserRegisteredWorkoutsSerialization } from "@common/serializers/user-registered-workout.serialization";
11
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
12
  import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
13
  import { createUserRegisteredWorkoutsSchema } from "../validations/create-user-registered-workouts.validation";
14
  import { updateUserRegisteredWorkoutsSchema } from "../validations/update-user-registered-workouts.validation";
15
+ import {
16
+ SwaggerGet,
17
+ SwaggerPost,
18
+ } from "@lib/decorators/swagger-routes.decorator";
19
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
20
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";
21
 
22
  interface userRequest extends Request {
23
  jwtPayload?: any;
24
  }
25
 
26
+ @Controller("/user/myWorkouts")
27
  @ControllerMiddleware(UsersGuardMiddleware())
28
  export class userRegisteredWorkoutsController extends BaseController {
29
  private userRegisteredWorkoutsService = new UserRegisteredWorkoutsService();
 
31
  setRoutes(): void {
32
  this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
33
  this.router.get("/", asyncHandler(this.list));
34
+ this.router.post(
35
+ "/",
36
  bodyValidator(createUserRegisteredWorkoutsSchema),
37
+ asyncHandler(this.create)
38
+ );
39
  }
40
 
41
+ @SwaggerGet()
42
+ @SwaggerResponse([UserRegisteredWorkoutsSerialization])
43
  list = async (req: userRequest, res: Response) => {
44
  const paginationQuery = parsePaginationQuery(req.query);
45
+ const { docs, paginationData } =
46
+ await this.userRegisteredWorkoutsService.list(
47
+ { user: req.jwtPayload.id },
48
+ paginationQuery,
49
+ {
50
+ populateArray: [
51
+ { path: "workout", select: "-templateWeeks -created_by" },
52
+ { path: "weeks.days.exercises", select: "name media reps sets" },
53
+ ],
54
+ }
55
+ );
56
 
57
  return JsonResponse.success(
58
  {
 
63
  );
64
  };
65
 
66
+ @SwaggerGet("/:id")
67
+ @SwaggerResponse(UserRegisteredWorkoutsSerialization)
68
  get = async (req: userRequest, res: Response) => {
69
  const data = await this.userRegisteredWorkoutsService.findOneOrFail(
70
  { _id: req.params.id },
 
72
  populateArray: [
73
  { path: "workout", select: "-template_weeks -created_by" },
74
  { path: "weeks.days.exercises", select: "name media reps sets" },
75
+ ],
76
  }
77
  );
78
  return JsonResponse.success(
 
83
  );
84
  };
85
 
86
+ @SwaggerPost()
87
+ @SwaggerResponse(UserRegisteredWorkoutsSerialization)
88
+ @SwaggerRequest(createUserRegisteredWorkoutsSchema)
89
  create = async (req: userRequest, res: Response) => {
90
  const data = await this.userRegisteredWorkoutsService.create(req.body);
91
  return JsonResponse.success(
 
96
  res
97
  );
98
  };
 
99
  }
src/modules/users/modules/workouts/controllers/workouts.controller.ts CHANGED
@@ -5,13 +5,15 @@ import { parsePaginationQuery } from "@helpers/pagination";
5
  import { asyncHandler } from "@helpers/async-handler";
6
  import { paramsValidator } from "@helpers/validation.helper";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
- import { Prefix } from "@lib/decorators/prefix.decorator";
9
  import { serialize } from "@helpers/serialize";
10
  import { WorkoutSerialization } from "@common/serializers/workout.serialization";
11
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
12
  import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
 
 
13
 
14
- @Prefix("/user/workouts")
15
  @ControllerMiddleware(UsersGuardMiddleware())
16
  export class WorkoutController extends BaseController {
17
  private workoutsService = new WorkoutService();
@@ -21,6 +23,8 @@ export class WorkoutController extends BaseController {
21
  this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
22
  }
23
 
 
 
24
  list = async (req: Request, res: Response): Promise<Response> => {
25
  const paginationQuery = parsePaginationQuery(req.query);
26
  const { docs, paginationData } = await this.workoutsService.list(
@@ -37,6 +41,8 @@ export class WorkoutController extends BaseController {
37
  );
38
  };
39
 
 
 
40
  get = async (req: Request, res: Response): Promise<Response> => {
41
  const data = await this.workoutsService.findOneOrFail({
42
  _id: req.params.id,
 
5
  import { asyncHandler } from "@helpers/async-handler";
6
  import { paramsValidator } from "@helpers/validation.helper";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
+ import { Controller } from "@lib/decorators/prefix.decorator";
9
  import { serialize } from "@helpers/serialize";
10
  import { WorkoutSerialization } from "@common/serializers/workout.serialization";
11
  import { ControllerMiddleware } from "@lib/decorators/controller-middleware.decorator";
12
  import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
13
+ import { SwaggerGet } from "@lib/decorators/swagger-routes.decorator";
14
+ import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
15
 
16
+ @Controller("/user/workouts")
17
  @ControllerMiddleware(UsersGuardMiddleware())
18
  export class WorkoutController extends BaseController {
19
  private workoutsService = new WorkoutService();
 
23
  this.router.get("/:id", paramsValidator("id"), asyncHandler(this.get));
24
  }
25
 
26
+ @SwaggerGet()
27
+ @SwaggerResponse([WorkoutSerialization])
28
  list = async (req: Request, res: Response): Promise<Response> => {
29
  const paginationQuery = parsePaginationQuery(req.query);
30
  const { docs, paginationData } = await this.workoutsService.list(
 
41
  );
42
  };
43
 
44
+ @SwaggerGet("/:id")
45
+ @SwaggerResponse(WorkoutSerialization)
46
  get = async (req: Request, res: Response): Promise<Response> => {
47
  const data = await this.workoutsService.findOneOrFail({
48
  _id: req.params.id,
src/routes.ts CHANGED
@@ -2,11 +2,12 @@ import { Router, Express } from "express";
2
 
3
  import * as glob from "glob";
4
  import path from "path";
5
- import { TspecDocsMiddleware } from "tspec";
6
  import { BaseController } from "./lib/controllers/controller.base";
7
  import { validationErrorHandler } from "./helpers/validation.helper";
8
  import { JsonResponse } from "@lib/responses/json-response";
9
  import { errorHandlerMiddleware } from "middlewares/error-handler.middleware";
 
10
 
11
  /**
12
  * Sets the routes for the Express app.
@@ -45,23 +46,14 @@ const setCustomRoutes = async (router: Router) => {
45
  router.use(validationErrorHandler);
46
 
47
  // docs
48
- router.use("/docs", await TspecDocsMiddleware({
49
- openapi: {
50
- title: 'API Documentation',
51
- version: '0.0.1',
52
- securityDefinitions: {
53
- jwt: {
54
- type: 'http',
55
- scheme: 'bearer',
56
- bearerFormat: 'JWT',
57
- }
58
- }
59
- }
60
- }));
61
 
62
  // Invalid URL handler
63
  router.all("*", (req: any, res: any) => {
64
-
65
  JsonResponse.error(
66
  {
67
  error: "Invalid URL!",
 
2
 
3
  import * as glob from "glob";
4
  import path from "path";
5
+ import swaggerUi from "swagger-ui-express";
6
  import { BaseController } from "./lib/controllers/controller.base";
7
  import { validationErrorHandler } from "./helpers/validation.helper";
8
  import { JsonResponse } from "@lib/responses/json-response";
9
  import { errorHandlerMiddleware } from "middlewares/error-handler.middleware";
10
+ import { swaggerRegistry } from "@lib/swagger/swagger";
11
 
12
  /**
13
  * Sets the routes for the Express app.
 
46
  router.use(validationErrorHandler);
47
 
48
  // docs
49
+ router.use(
50
+ "/docs",
51
+ swaggerUi.serve,
52
+ swaggerUi.setup(swaggerRegistry.generateSwaggerDocument())
53
+ );
 
 
 
 
 
 
 
 
54
 
55
  // Invalid URL handler
56
  router.all("*", (req: any, res: any) => {
 
57
  JsonResponse.error(
58
  {
59
  error: "Invalid URL!",
tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "include": ["src/**/*"],
3
  "compilerOptions": {
4
  "module": "commonjs",
5
  "esModuleInterop": true,
 
1
  {
2
+ "include": ["src/**/*.ts"],
3
  "compilerOptions": {
4
  "module": "commonjs",
5
  "esModuleInterop": true,