diff --git a/backend/package-lock.json b/backend/package-lock.json index 2a75e24..40fc620 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -10,14 +10,75 @@ "license": "ISC", "dependencies": { "body-parser": "^1.20.0", + "child-process": "^1.0.2", + "cors": "^2.8.5", "dotenv": "^16.0.1", "express": "^4.18.1", - "mysql2": "^2.3.3" + "fs": "^0.0.1-security", + "ip": "^1.1.8", + "mysql": "^2.18.1", + "mysql2": "^2.3.3", + "node-fetch": "^2.7.0", + "os": "^0.1.2", + "path": "^0.12.7", + "swagger-jsdoc": "^6.2.8", + "swagger-ui-express": "^5.0.0" }, "devDependencies": { - "nodemon": "^2.0.18" + "nodemon": "^2.0.18", + "swagger-autogen": "^2.23.7" } }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.1.2.tgz", + "integrity": "sha512-r1w81DpR+KyRWd3f+rk6TNqMgedmAxZP5v5KWlXQWlgMUUtyEJch0DKEci1SorPMiSeM8XPl7MZ3miJ60JIpQg==", + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.6", + "call-me-maybe": "^1.0.1", + "js-yaml": "^4.1.0" + } + }, + "node_modules/@apidevtools/openapi-schemas": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", + "integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@apidevtools/swagger-methods": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", + "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==" + }, + "node_modules/@apidevtools/swagger-parser": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.0.3.tgz", + "integrity": "sha512-sNiLY51vZOmSPFZA5TF35KZ2HbgYklQnTSDnkghamzLb3EkNtcQnrBQEj5AOCxHpTtXpqMCRM1CrmV2rG6nw4g==", + "dependencies": { + "@apidevtools/json-schema-ref-parser": "^9.0.6", + "@apidevtools/openapi-schemas": "^2.0.4", + "@apidevtools/swagger-methods": "^3.0.2", + "@jsdevtools/ono": "^7.1.3", + "call-me-maybe": "^1.0.1", + "z-schema": "^5.0.1" + }, + "peerDependencies": { + "openapi-types": ">=7" + } + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" + }, + "node_modules/@types/json-schema": { + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==" + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -36,6 +97,18 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -49,6 +122,11 @@ "node": ">= 8" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -57,8 +135,15 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==", + "engines": { + "node": "*" + } }, "node_modules/binary-extensions": { "version": "2.2.0", @@ -96,7 +181,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -134,6 +218,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==" + }, + "node_modules/child-process": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/child-process/-/child-process-1.0.2.tgz", + "integrity": "sha512-e45+JmjvkV2XQsJ9rUJghiYJ7/9Uk8fyYi1UwfP071VmGKBu/oD1OIwuD0+jSwjMtQkV0a0FVpPTEW+XGlbSdw==" + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -161,11 +255,18 @@ "fsevents": "~2.3.2" } }, + "node_modules/commander": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", + "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", + "engines": { + "node": ">= 6" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/content-disposition": { "version": "0.5.4", @@ -199,6 +300,23 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -207,6 +325,15 @@ "ms": "2.0.0" } }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/denque": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", @@ -232,6 +359,17 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dotenv": { "version": "16.0.3", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", @@ -258,6 +396,14 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -352,6 +498,16 @@ "node": ">= 0.6" } }, + "node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -392,6 +548,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -467,11 +642,25 @@ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", "dev": true }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/ip": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -527,6 +716,49 @@ "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==" }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + }, "node_modules/long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", @@ -598,7 +830,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -611,6 +842,33 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/mysql": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "dependencies": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mysql/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/mysql/node_modules/sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mysql2": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz", @@ -667,6 +925,25 @@ "node": ">= 0.6" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/nodemon": { "version": "2.0.20", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", @@ -734,6 +1011,14 @@ "node": ">=0.10.0" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -753,6 +1038,25 @@ "node": ">= 0.8" } }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/openapi-types": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", + "peer": true + }, + "node_modules/os": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/os/-/os-0.1.2.tgz", + "integrity": "sha512-ZoXJkvAnljwvc56MbvhtKVWmSkzV712k42Is2mA0+0KTSRakq5XXuXpjZjgAt9ctzl51ojhQWakQQpmOvXWfjQ==" + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -761,6 +1065,23 @@ "node": ">= 0.8" } }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -778,6 +1099,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -832,6 +1166,25 @@ "node": ">= 0.8" } }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -979,6 +1332,19 @@ "node": ">= 0.8" } }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -991,6 +1357,87 @@ "node": ">=4" } }, + "node_modules/swagger-autogen": { + "version": "2.23.7", + "resolved": "https://registry.npmjs.org/swagger-autogen/-/swagger-autogen-2.23.7.tgz", + "integrity": "sha512-vr7uRmuV0DCxWc0wokLJAwX3GwQFJ0jwN+AWk0hKxre2EZwusnkGSGdVFd82u7fQLgwSTnbWkxUL7HXuz5LTZQ==", + "dev": true, + "dependencies": { + "acorn": "^7.4.1", + "deepmerge": "^4.2.2", + "glob": "^7.1.7", + "json5": "^2.2.3" + } + }, + "node_modules/swagger-autogen/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/swagger-jsdoc": { + "version": "6.2.8", + "resolved": "https://registry.npmjs.org/swagger-jsdoc/-/swagger-jsdoc-6.2.8.tgz", + "integrity": "sha512-VPvil1+JRpmJ55CgAtn8DIcpBs0bL5L3q5bVQvF4tAW/k/9JYSj7dCpaYCAv5rufe0vcCbBRQXGvzpkWjvLklQ==", + "dependencies": { + "commander": "6.2.0", + "doctrine": "3.0.0", + "glob": "7.1.6", + "lodash.mergewith": "^4.6.2", + "swagger-parser": "^10.0.3", + "yaml": "2.0.0-1" + }, + "bin": { + "swagger-jsdoc": "bin/swagger-jsdoc.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/swagger-parser": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/swagger-parser/-/swagger-parser-10.0.3.tgz", + "integrity": "sha512-nF7oMeL4KypldrQhac8RyHerJeGPD1p2xDh900GPvc+Nk7nWP6jX2FcC7WmkinMoAmoO774+AFXcWsW8gMWEIg==", + "dependencies": { + "@apidevtools/swagger-parser": "10.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/swagger-ui-dist": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.9.1.tgz", + "integrity": "sha512-5zAx+hUwJb9T3EAntc7TqYkV716CMqG6sZpNlAAMOMWkNXRYxGkN8ADIvD55dQZ10LxN90ZM/TQmN7y1gpICnw==" + }, + "node_modules/swagger-ui-express": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.0.tgz", + "integrity": "sha512-tsU9tODVvhyfkNSvf03E6FAk+z+5cU3lXAzMy6Pv4av2Gt2xA0++fogwC4qo19XuFf6hdxevPuVCSKFuMHJhFA==", + "dependencies": { + "swagger-ui-dist": ">=5.0.0" + }, + "engines": { + "node": ">= v0.10.32" + }, + "peerDependencies": { + "express": ">=4.0.0 || >=5.0.0-beta" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1023,6 +1470,11 @@ "nodetouch": "bin/nodetouch.js" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1049,6 +1501,24 @@ "node": ">= 0.8" } }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -1057,6 +1527,14 @@ "node": ">= 0.4.0" } }, + "node_modules/validator": { + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", + "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -1065,13 +1543,112 @@ "node": ">= 0.8" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/yaml": { + "version": "2.0.0-1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-1.tgz", + "integrity": "sha512-W7h5dEhywMKenDJh2iX/LABkbFnBxasD27oyXWDS/feDsxiw0dD5ncXdYXgkvAsXIY2MpW/ZKkr9IU30DBdMNQ==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/z-schema": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.5.tgz", + "integrity": "sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==", + "dependencies": { + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.5.0", + "validator": "^13.7.0" + }, + "bin": { + "z-schema": "bin/z-schema" + }, + "engines": { + "node": ">=8.0.0" + }, + "optionalDependencies": { + "commander": "^9.4.1" + } + }, + "node_modules/z-schema/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "optional": true, + "engines": { + "node": "^12.20.0 || >=14" + } } }, "dependencies": { + "@apidevtools/json-schema-ref-parser": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.1.2.tgz", + "integrity": "sha512-r1w81DpR+KyRWd3f+rk6TNqMgedmAxZP5v5KWlXQWlgMUUtyEJch0DKEci1SorPMiSeM8XPl7MZ3miJ60JIpQg==", + "requires": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.6", + "call-me-maybe": "^1.0.1", + "js-yaml": "^4.1.0" + } + }, + "@apidevtools/openapi-schemas": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", + "integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==" + }, + "@apidevtools/swagger-methods": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", + "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==" + }, + "@apidevtools/swagger-parser": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.0.3.tgz", + "integrity": "sha512-sNiLY51vZOmSPFZA5TF35KZ2HbgYklQnTSDnkghamzLb3EkNtcQnrBQEj5AOCxHpTtXpqMCRM1CrmV2rG6nw4g==", + "requires": { + "@apidevtools/json-schema-ref-parser": "^9.0.6", + "@apidevtools/openapi-schemas": "^2.0.4", + "@apidevtools/swagger-methods": "^3.0.2", + "@jsdevtools/ono": "^7.1.3", + "call-me-maybe": "^1.0.1", + "z-schema": "^5.0.1" + } + }, + "@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" + }, + "@types/json-schema": { + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==" + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -1087,6 +1664,12 @@ "negotiator": "0.6.3" } }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, "anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1097,6 +1680,11 @@ "picomatch": "^2.0.4" } }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -1105,8 +1693,12 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" }, "binary-extensions": { "version": "2.2.0", @@ -1137,7 +1729,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1166,6 +1757,16 @@ "get-intrinsic": "^1.0.2" } }, + "call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==" + }, + "child-process": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/child-process/-/child-process-1.0.2.tgz", + "integrity": "sha512-e45+JmjvkV2XQsJ9rUJghiYJ7/9Uk8fyYi1UwfP071VmGKBu/oD1OIwuD0+jSwjMtQkV0a0FVpPTEW+XGlbSdw==" + }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -1182,11 +1783,15 @@ "readdirp": "~3.6.0" } }, + "commander": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", + "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "content-disposition": { "version": "0.5.4", @@ -1211,6 +1816,20 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1219,6 +1838,12 @@ "ms": "2.0.0" } }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true + }, "denque": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", @@ -1234,6 +1859,14 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "requires": { + "esutils": "^2.0.2" + } + }, "dotenv": { "version": "16.0.3", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", @@ -1254,6 +1887,11 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -1330,6 +1968,16 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" }, + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, "fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -1360,6 +2008,19 @@ "has-symbols": "^1.0.3" } }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -1414,11 +2075,25 @@ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", "dev": true }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "ip": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -1459,6 +2134,40 @@ "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==" }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "requires": { + "argparse": "^2.0.1" + } + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + }, + "lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + }, "long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", @@ -1509,7 +2218,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1519,6 +2227,29 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "mysql": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "requires": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==" + } + } + }, "mysql2": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz", @@ -1564,6 +2295,14 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "nodemon": { "version": "2.0.20", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", @@ -1614,6 +2353,11 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, "object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -1627,11 +2371,44 @@ "ee-first": "1.1.1" } }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "openapi-types": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", + "peer": true + }, + "os": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/os/-/os-0.1.2.tgz", + "integrity": "sha512-ZoXJkvAnljwvc56MbvhtKVWmSkzV712k42Is2mA0+0KTSRakq5XXuXpjZjgAt9ctzl51ojhQWakQQpmOvXWfjQ==" + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -1643,6 +2420,16 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -1682,6 +2469,27 @@ "unpipe": "1.0.0" } }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -1792,6 +2600,21 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -1801,6 +2624,68 @@ "has-flag": "^3.0.0" } }, + "swagger-autogen": { + "version": "2.23.7", + "resolved": "https://registry.npmjs.org/swagger-autogen/-/swagger-autogen-2.23.7.tgz", + "integrity": "sha512-vr7uRmuV0DCxWc0wokLJAwX3GwQFJ0jwN+AWk0hKxre2EZwusnkGSGdVFd82u7fQLgwSTnbWkxUL7HXuz5LTZQ==", + "dev": true, + "requires": { + "acorn": "^7.4.1", + "deepmerge": "^4.2.2", + "glob": "^7.1.7", + "json5": "^2.2.3" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "swagger-jsdoc": { + "version": "6.2.8", + "resolved": "https://registry.npmjs.org/swagger-jsdoc/-/swagger-jsdoc-6.2.8.tgz", + "integrity": "sha512-VPvil1+JRpmJ55CgAtn8DIcpBs0bL5L3q5bVQvF4tAW/k/9JYSj7dCpaYCAv5rufe0vcCbBRQXGvzpkWjvLklQ==", + "requires": { + "commander": "6.2.0", + "doctrine": "3.0.0", + "glob": "7.1.6", + "lodash.mergewith": "^4.6.2", + "swagger-parser": "^10.0.3", + "yaml": "2.0.0-1" + } + }, + "swagger-parser": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/swagger-parser/-/swagger-parser-10.0.3.tgz", + "integrity": "sha512-nF7oMeL4KypldrQhac8RyHerJeGPD1p2xDh900GPvc+Nk7nWP6jX2FcC7WmkinMoAmoO774+AFXcWsW8gMWEIg==", + "requires": { + "@apidevtools/swagger-parser": "10.0.3" + } + }, + "swagger-ui-dist": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.9.1.tgz", + "integrity": "sha512-5zAx+hUwJb9T3EAntc7TqYkV716CMqG6sZpNlAAMOMWkNXRYxGkN8ADIvD55dQZ10LxN90ZM/TQmN7y1gpICnw==" + }, + "swagger-ui-express": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.0.tgz", + "integrity": "sha512-tsU9tODVvhyfkNSvf03E6FAk+z+5cU3lXAzMy6Pv4av2Gt2xA0++fogwC4qo19XuFf6hdxevPuVCSKFuMHJhFA==", + "requires": { + "swagger-ui-dist": ">=5.0.0" + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1824,6 +2709,11 @@ "nopt": "~1.0.10" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1844,20 +2734,88 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, + "validator": { + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", + "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "yaml": { + "version": "2.0.0-1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-1.tgz", + "integrity": "sha512-W7h5dEhywMKenDJh2iX/LABkbFnBxasD27oyXWDS/feDsxiw0dD5ncXdYXgkvAsXIY2MpW/ZKkr9IU30DBdMNQ==" + }, + "z-schema": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.5.tgz", + "integrity": "sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==", + "requires": { + "commander": "^9.4.1", + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.5.0", + "validator": "^13.7.0" + }, + "dependencies": { + "commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "optional": true + } + } } } } diff --git a/backend/package.json b/backend/package.json index 929af6e..529bbaf 100644 --- a/backend/package.json +++ b/backend/package.json @@ -18,11 +18,22 @@ "homepage": "https://github.com/Sunwoo0110/Express_Setup#readme", "dependencies": { "body-parser": "^1.20.0", + "child-process": "^1.0.2", + "cors": "^2.8.5", "dotenv": "^16.0.1", "express": "^4.18.1", - "mysql2": "^2.3.3" + "fs": "^0.0.1-security", + "ip": "^1.1.8", + "mysql": "^2.18.1", + "mysql2": "^2.3.3", + "node-fetch": "^2.7.0", + "os": "^0.1.2", + "path": "^0.12.7", + "swagger-jsdoc": "^6.2.8", + "swagger-ui-express": "^5.0.0" }, "devDependencies": { - "nodemon": "^2.0.18" + "nodemon": "^2.0.18", + "swagger-autogen": "^2.23.7" } -} \ No newline at end of file +} diff --git a/backend/src/app.js b/backend/src/app.js index 16ec7e4..ef3409f 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -1,4 +1,7 @@ const express = require("express"); +const swaggerUi = require("swagger-ui-express"); +const swaggereJsdoc = require("swagger-jsdoc"); +const cors = require('cors'); class App { constructor() { @@ -44,6 +47,35 @@ class App { res.status(500).send("Error Code 400"); }); } + + setCors() { + // this.app.use(cors({orgin: 'http://localhost:3000'})); + } + + // setSwagger() { + // const options = { + // definition: { + // openapi: "3.0.0", + // info: { + // title: "Swagger Express API for Team6", + // version: "0.1.0", + // description: "This is a sample server for Team6.", + // }, + // servers: [ + // { + // url: "http://localhost:8080", + // }, + // ], + // }, + // apis: ["./src/routes/*.js"], + // }; + // const specs = swaggereJsdoc(options); + // this.app.use( + // "/api-docs", + // swaggerUi.serve, + // swaggerUi.setup(specs, { explorer: true }) + // ); + // } } module.exports = new App().app; \ No newline at end of file diff --git a/backend/src/config/swagger.js b/backend/src/config/swagger.js new file mode 100644 index 0000000..e69de29 diff --git a/backend/src/data/CI_aggregated.csv b/backend/src/data/CI_aggregated.csv new file mode 100644 index 0000000..f3b3500 --- /dev/null +++ b/backend/src/data/CI_aggregated.csv @@ -0,0 +1,132 @@ +index,,,,in gCO2e/kWh,,"Country, Region or World", +location,continentName,countryName,regionName,carbonIntensity,Type,source,comments +ZA,Africa,South Africa,Any,928,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +CN,Asia,China,Any,555,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +CN-HK,Asia,China,Hong Kong,755,Region,carbonfootprint (June 2020 v1.4) and Hong Kong Electric Company (2019) and CLP Group (2019),Combined generation and T&D factor +IN,Asia,India,Any,708,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +ID,Asia,Indonesia,Any,761,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +JP,Asia,Japan,Any,506,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +KR,Asia,Korea,Any,500,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +SG,Asia,Singapore,Any,418.8,Country,carbonfootprint (June 2020 v1.4) and Singapore Energy Market Authority (EMA),Combined generation and T&D factor +TH,Asia,Thailand,Any,497,Country,carbonfootprint (June 2020 v1.4) and Energy Policy and Planning Office (EPPO) Thai Government Ministry of Energy,Combined generation and T&D factor +AU,Oceania,Australia,Any,880,Country,carbonfootprint (June 2020 v1.4) and Australian Government,Combined generation and T&D factor +NZ,Oceania,New Zealand,Any,105.1,Country,carbonfootprint (June 2020 v1.4) and Ministry for the Environment https://www.mfe.govt.nz/node/18670/,"Emission factors published in 2019, based on 2018 national inventory which is based on 2016 data." +SA,Asia,Saudi Arabia,Any,732,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +TR,Asia,Turkey,Any,481,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +AE,Asia,United Arab Emirates,Any,425.8,Country,carbonfootprint (June 2020 v1.4) and Dubai Electricity & Water Authority (sustainability report 2018),Generation factor only +CA,North America,Canada,Any,130,Country,carbonfootprint (June 2020 v1.4) and UN Framework Convention on Climate Change,Combined generation and T&D factor +MX,North America,Mexico,Any,449,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +US,North America,United States of America,Any,453.22,Country,carbonfootprint (June 2020 v1.4) and US Env Protection Agency (EPA) eGrid,Combined generation and T&D factor +AR,South America,Argentina,Any,313,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +BR,South America,Brazil,Any,74,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +AT,Europe,Austria,Any,132.86,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +BE,Europe,Belgium,Any,153.13,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +BG,Europe,Bulgaria,Any,437.37,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +HR,Europe,Croatia,Any,273.15,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +CY,Europe,Cyprus,Any,677.29,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +CZ,Europe,Czech Republic,Any,544.65,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +DK,Europe,Denmark,Any,154.44,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +EE,Europe,Estonia,Any,723.28,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +FI,Europe,Finland,Any,136.22,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +FR,Europe,France,Any,38.95,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +DE,Europe,Germany,Any,378.62,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +GR,Europe,Greece,Any,549.01,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +HU,Europe,Hungary,Any,252.98,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +IS,Europe,Iceland,Any,0.11,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +IE,Europe,Ireland,Any,348.04,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +IT,Europe,Italy,Any,338.54,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +LV,Europe,Latvia,Any,303.33,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +LT,Europe,Lithuania,Any,149.13,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +LU,Europe,Luxembourg,Any,139.39,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +MT,Europe,Malta,Any,370.6,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +NL,Europe,Netherlands,Any,452.07,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +NO,Europe,Norway,Any,11.18,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +PL,Europe,Poland,Any,791.07,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +PT,Europe,Portugal,Any,252.55,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +RO,Europe,Romania,Any,310.11,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +RU,Europe,Russian Federation,Any,325,Country,carbonfootprint (June 2020 v1.4) and Climate Transparency (2019 Report),Emissions intensity of the power sector +RS,Europe,Serbia,Any,762.53,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +SK,Europe,Slovakia,Any,151.1,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +SI,Europe,Slovenia,Any,243.85,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +ES,Europe,Spain,Any,220.26,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +SE,Europe,Sweden,Any,11.89,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB),Production mix factor +CH,Europe,Switzerland,Any,11.82,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB) ,Production mix factor +GB,Europe,United Kingdom,Any,253.19,Country,carbonfootprint (June 2020 v1.4) and Association of Issuing Bodies (AIB) ,Generation & transmission & distribution factors +US-AK,North America,United States of America,Alaska,435.97,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-AL,North America,United States of America,Alabama,414.05,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-AR,North America,United States of America,Arkansas,581.39,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-AZ,North America,United States of America,Arizona,463.3,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-CA,North America,United States of America,California,201.13,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-CO,North America,United States of America,Colorado,653.44,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-CT,North America,United States of America,Connecticut,243,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-DC,North America,United States of America,Washington DC,209.81,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-DE,North America,United States of America,Delaware,429.41,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-FL,North America,United States of America,Florida,451.98,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-GA,North America,United States of America,Georgia,444.38,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-HI,North America,United States of America,Hawaii,729.13,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-IA,North America,United States of America,Iowa,513.78,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-ID,North America,United States of America,Idaho,76.59,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-IL,North America,United States of America,Illinois,390.38,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-IN,North America,United States of America,Indiana,833.82,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-KS,North America,United States of America,Kansas,475.25,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-KY,North America,United States of America,Kentucky,875.34,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-LA,North America,United States of America,Louisiana,400.26,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MA,North America,United States of America,Massachusetts,349.97,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MD,North America,United States of America,Maryland,401.15,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-ME,North America,United States of America,Maine,127.86,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MI,North America,United States of America,Michigan,532.1,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MN,North America,United States of America,Minnesota,478.4,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MO,North America,United States of America,Missouri,816.85,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MS,North America,United States of America,Mississip,438.49,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-MT,North America,United States of America,Montana,555.56,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NC,North America,United States of America,North Carolina,383.42,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-ND,North America,United States of America,North Dakota,723.33,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NE,North America,United States of America,Nebraska,675.98,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NH,North America,United States of America,New Hampshire,145.82,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NJ,North America,United States of America,New Jersey,239.47,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NM,North America,United States of America,New Mexico,638.7,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NV,North America,United States of America,Nevada,355.76,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-NY,North America,United States of America,New York,199.61,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-OH,North America,United States of America,Ohio,634.21,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-OK,North America,United States of America,Oklahoma,426.03,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-OR,North America,United States of America,Oregon,149.7,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-PA,North America,United States of America,Pennsylvania,376.21,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-RI,North America,United States of America,Rhode Island,414.27,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-SC,North America,United States of America,South Carolina,302.63,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-SD,North America,United States of America,South Dakota,247.96,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-TN,North America,United States of America,Tennessee,356.85,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-TX,North America,United States of America,Texas,468.98,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-UT,North America,United States of America,Utah,766.79,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-VA,North America,United States of America,Virginia,354.25,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-VT,North America,United States of America,Vermont,27.38,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-WA,North America,United States of America,Washington,95.34,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-WI,North America,United States of America,Wisconsin,665.83,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-WV,North America,United States of America,West Virginia,935.4,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +US-WY,North America,United States of America,Wyoming,983.3,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-AB,North America,Canada,Alberta,680,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-BC,North America,Canada,British Columbia,12.8,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-MT,North America,Canada,Manitoba,1.4,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-NB,North America,Canada,New Brunswick,400,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-NL,North America,Canada,Newfoundland and Labrador,27,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-NS,North America,Canada,Nova Scotia,760,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-NT,North America,Canada,Northwest Territories,160,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-NU,North America,Canada,Nunavut,890,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-ON,North America,Canada,Ontario,30,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-PE,North America,Canada,Prince Edward Island,14,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-QC,North America,Canada,Quebec,1.7,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-SK,North America,Canada,Saskatchewan,710,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +CA-YT,North America,Canada,Yukon Territory,79,Region,carbonfootprint (June 2020 v1.4),Figures from 2018 (published in 2020) +AU-ACT,Oceania,Australia,Australian Capital Territory,900,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-NSW,Oceania,Australia,New South Wales,900,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-NT,Oceania,Australia,Northern Territory,710,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-NT2,Oceania,Australia,Northern Territory (Darwin Katherine Interconnected System),550,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-QLD,Oceania,Australia,Queensland,930,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-SA,Oceania,Australia,South Australia,540,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-TAS,Oceania,Australia,Tasmania,170,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-VIC,Oceania,Australia,Victoria,1120,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-WA1,Oceania,Australia,Western Australia (North Western Interconnected System),590,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +AU-WA2,Oceania,Australia,Western Australia (South West Interconnected System),730,Region,carbonfootprint (June 2020 v1.4),Figures from 2017/18 (published in 2019) +GM-BJL,Africa,"Gambia, The",Any,700,Region,"For Banjul region, Energy mix (https://www.irena.org/-/media/Files/IRENA/Agency/Publication/2013/RRA_Gambia.pdf) and GHG of HFO power plants (https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=13&cad=rja&uact=8&ved=2ahUKEwiP46WT_qjnAhXGOcAKHXnSB1AQFjAMegQIBRAB&url=https%3A%2F%2Fidbinvest.org%2Fen%2Fdownload%2F6253&usg=AOvVaw3_YnEh1UVtiuHlNyCvO4G2)", +WORLD,World,Any,Any,475,World,https://www.iea.org/reports/global-energy-co2-status-report-2019/emissions, +TW,Asia,China,Taiwan,509,Region,https://energypedia.info/wiki/Energy_Transition_in_Taiwan, +IL,Asia,Israel,Any,580,Country,https://www.electricitymap.org (06/10/2020), \ No newline at end of file diff --git a/backend/src/data/TDP_cpu.csv b/backend/src/data/TDP_cpu.csv new file mode 100644 index 0000000..0cf1068 --- /dev/null +++ b/backend/src/data/TDP_cpu.csv @@ -0,0 +1,81 @@ +index,in Watt,,, +model,TDP,n_cores,TDP_per_core,source +A8-7680,45,4,11.3,https://www.techpowerup.com/cpu-specs/ +A9-9425 SoC,15,2,7.5,https://www.techpowerup.com/cpu-specs/ +AMD 7552,200,48,4.2,https://www.amd.com/system/files/documents/AMD-EPYC-7002-Series-Datasheet.pdf +AMD EPYC 7251,120,8,15.0,https://www.amd.com/en/products/cpu/amd-epyc-7251 +Any,,,12.0, +Athlon 3000G,35,2,17.5,https://www.techpowerup.com/cpu-specs/ +Core 2 Quad Q6600,95,4,23.8,https://www.techpowerup.com/cpu-specs/ +Core i3-10100,65,4,16.3,https://www.techpowerup.com/cpu-specs/ +Core i3-10300,62,4,15.5,https://www.techpowerup.com/cpu-specs/ +Core i3-10320,91,4,22.8,https://www.techpowerup.com/cpu-specs/ +Core i3-10350K,91,4,22.8,https://www.techpowerup.com/cpu-specs/ +Core i3-9100,65,4,16.3,https://www.techpowerup.com/cpu-specs/ +Core i3-9100F,65,4,16.3,https://www.techpowerup.com/cpu-specs/ +Core i5-10400,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Core i5-10400F,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Core i5-10500,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Core i5-10600,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Core i5-10600K,95,6,15.8,https://www.techpowerup.com/cpu-specs/ +Core i5-3570K,77,4,19.3,https://www.techpowerup.com/cpu-specs/ +Core i5-4460,84,4,21.0,https://ark.intel.com/content/www/us/en/ark/products/80817/intel-core-i5-4460-processor-6m-cache-up-to-3-40-ghz.html +Core i5-9400,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Core i5-9400F,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Core i5-9600KF,95,6,15.8,https://www.techpowerup.com/cpu-specs/ +Core i7-10700,65,8,8.1,https://www.techpowerup.com/cpu-specs/ +Core i7-10700K,125,8,15.6,https://www.techpowerup.com/cpu-specs/ +Core i7-4930K,130,6,21.7,https://www.techpowerup.com/cpu-specs/ +Core i7-6700K,95,4,23.8,https://www.techpowerup.com/cpu-specs/ +Core i7-8700K,95,6,15.8,https://www.techpowerup.com/cpu-specs/ +Core i7-9700F,65,8,8.1,https://www.techpowerup.com/cpu-specs/ +Core i7-9700K,95,8,11.9,https://www.techpowerup.com/cpu-specs/ +Core i9-10900K,125,10,12.5,https://www.techpowerup.com/cpu-specs/ +Core i9-10900KF,105,10,10.5,https://www.techpowerup.com/cpu-specs/ +Core i9-10900XE,165,10,16.5,https://www.techpowerup.com/cpu-specs/ +Core i9-10920XE,165,12,13.8,https://www.techpowerup.com/cpu-specs/ +Core i9-9900K,95,8,11.9,https://www.techpowerup.com/cpu-specs/ +FX-6300,95,6,15.8,https://www.techpowerup.com/cpu-specs/ +FX-8350,125,8,15.6,https://www.techpowerup.com/cpu-specs/ +Ryzen 3 2200G,65,4,16.3,https://www.techpowerup.com/cpu-specs/ +Ryzen 3 3200G,65,4,16.3,https://www.techpowerup.com/cpu-specs/ +Ryzen 3 3200U,15,2,7.5,https://www.techpowerup.com/cpu-specs/ +Ryzen 5 1600,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Ryzen 5 2600,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Ryzen 5 3400G,65,4,16.3,https://www.techpowerup.com/cpu-specs/ +Ryzen 5 3500U,15,4,3.8,https://www.techpowerup.com/cpu-specs/ +Ryzen 5 3600,65,6,10.8,https://www.techpowerup.com/cpu-specs/ +Ryzen 5 3600X,95,6,15.8,https://www.techpowerup.com/cpu-specs/ +Ryzen 7 2700X,105,8,13.1,https://www.techpowerup.com/cpu-specs/ +Ryzen 7 3700X,65,8,8.1,https://www.techpowerup.com/cpu-specs/ +Ryzen 7 3800X,105,8,13.1,https://www.techpowerup.com/cpu-specs/ +Ryzen 9 3900X,125,12,10.4,https://www.techpowerup.com/cpu-specs/ +Ryzen 9 3950X,105,16,6.6,https://www.techpowerup.com/cpu-specs/ +Ryzen Threadripper 2990WX,250,32,7.8,https://www.techpowerup.com/cpu-specs/ +Ryzen Threadripper 3990X,280,64,4.4,https://www.techpowerup.com/cpu-specs/ +Xeon E5-2660 v3,105,10,10.5,https://ark.intel.com/content/www/us/en/ark/products/81706/intel-xeon-processor-e5-2660-v3-25m-cache-2-60-ghz.html +Xeon E5-2665,115,8,14.4,https://ark.intel.com/content/www/us/en/ark/products/64597/intel-xeon-processor-e5-2665-20m-cache-2-40-ghz-8-00-gt-s-intel-qpi.html +Xeon E5-2670,115,8,14.4,https://ark.intel.com/content/www/us/en/ark/products/64595/intel-xeon-processor-e5-2670-20m-cache-2-60-ghz-8-00-gt-s-intel-qpi.html +Xeon E5-2670 v2,115,10,11.5,https://ark.intel.com/content/www/us/en/ark/products/75275/intel-xeon-processor-e5-2670-v2-25m-cache-2-50-ghz.html +Xeon E5-2680 v3,120,12,10.0,https://www.intel.co.uk/content/www/uk/en/products/processors/xeon/e5-processors/e5-2680-v3.html +Xeon E5-2683 v4,120,16,7.5,https://www.intel.co.uk/content/www/uk/en/products/processors/xeon/e5-processors/e5-2683-v4.html +Xeon E5-2690 v2,130,10,13.0,https://ark.intel.com/content/www/us/en/ark/products/75279/intel-xeon-processor-e5-2690-v2-25m-cache-3-00-ghz.html +Xeon E5-2690 v3,135,12,11.3,https://ark.intel.com/content/www/us/en/ark/products/81713/intel-xeon-processor-e5-2690-v3-30m-cache-2-60-ghz.html +Xeon E5-2695 v4,120,18,6.7,https://ark.intel.com/content/www/us/en/ark/products/91316/intel-xeon-processor-e5-2695-v4-45m-cache-2-10-ghz.html +Xeon E5-2697 v4,145,18,8.1,https://ark.intel.com/content/www/us/en/ark/products/91755/intel-xeon-processor-e5-2697-v4-45m-cache-2-30-ghz.html +Xeon E5-2699 v3,145,18,8.1,https://ark.intel.com/content/www/us/en/ark/products/81061/intel-xeon-processor-e5-2699-v3-45m-cache-2-30-ghz.html +Xeon E5-2699 v4,145,22,6.6,https://ark.intel.com/content/www/us/en/ark/products/91317/intel-xeon-processor-e5-2699-v4-55m-cache-2-20-ghz.html +Xeon E5-4610 v4,105,10,10.5,https://ark.intel.com/content/www/us/en/ark/products/93812/intel-xeon-processor-e5-4610-v4-25m-cache-1-80-ghz.html +Xeon E5-4620,95,8,11.9,https://ark.intel.com/content/www/us/en/ark/products/64607/intel-xeon-processor-e5-4620-16m-cache-2-20-ghz-7-20-gt-s-intel-qpi.html +Xeon E5-4650L,115,8,14.4,https://ark.intel.com/content/www/us/en/ark/products/64606/intel-xeon-processor-e5-4650l-20m-cache-2-60-ghz-8-00-gt-s-intel-qpi.html +Xeon E7-8867 v3,165,16,10.3,https://ark.intel.com/content/www/us/en/ark/products/84681/intel-xeon-processor-e7-8867-v3-45m-cache-2-50-ghz.html +Xeon E7-8880 v4,150,22,6.8,https://www.intel.co.uk/content/www/uk/en/products/processors/xeon/e7-processors/e7-8880-v4.html +Xeon Gold 6142,150,16,9.4,https://ark.intel.com/content/www/us/en/ark/products/120487/intel-xeon-gold-6142-processor-22m-cache-2-60-ghz.html +Xeon Gold 6148,150,20,7.5,https://ark.intel.com/content/www/us/en/ark/products/120489/intel-xeon-gold-6148-processor-27-5m-cache-2-40-ghz.html +Xeon Gold 6248,150,20,7.5,https://ark.intel.com/content/www/us/en/ark/products/192446/intel-xeon-gold-6248-processor-27-5m-cache-2-50-ghz.html +Xeon Gold 6252,150,24,6.3,https://ark.intel.com/content/www/us/en/ark/products/192447/intel-xeon-gold-6252-processor-35-75m-cache-2-10-ghz.html +Xeon L5640 ,60,6,10.0,https://ark.intel.com/content/www/us/en/ark/products/47926/intel-xeon-processor-l5640-12m-cache-2-26-ghz-5-86-gt-s-intel-qpi.html +Xeon Phi 5110P,225,60,3.8,https://ark.intel.com/content/www/us/en/ark/products/71992/intel-xeon-phi-coprocessor-5110p-8gb-1-053-ghz-60-core.html +Xeon Platinum 9282,400,56,7.1,https://www.techpowerup.com/cpu-specs/ +Xeon X3430,95,4,23.8,https://ark.intel.com/content/www/us/en/ark/products/42927/intel-xeon-processor-x3430-8m-cache-2-40-ghz.html +Xeon X5660,95,6,15.8,https://ark.intel.com/content/www/us/en/ark/products/47921/intel-xeon-processor-x5660-12m-cache-2-80-ghz-6-40-gt-s-intel-qpi.html \ No newline at end of file diff --git a/backend/src/data/defaults_PUE.csv b/backend/src/data/defaults_PUE.csv new file mode 100644 index 0000000..607dda7 --- /dev/null +++ b/backend/src/data/defaults_PUE.csv @@ -0,0 +1,6 @@ +index,>1, +provider,PUE,source +Unknown,1.67,2019 https://journal.uptimeinstitute.com/is-pue-actually-going-up/ +gcp,1.11,https://www.google.co.uk/about/datacenters/efficiency/ +aws,1.2,https://aws.amazon.com/about-aws/sustainability/ +azure,1.125,but only for new datacentres https://azure.microsoft.com/en-gb/global-infrastructure/ \ No newline at end of file diff --git a/backend/src/routes/carbon/carbon.ctrl.js b/backend/src/routes/carbon/carbon.ctrl.js new file mode 100644 index 0000000..8b4fdec --- /dev/null +++ b/backend/src/routes/carbon/carbon.ctrl.js @@ -0,0 +1,262 @@ +const db = require("../db") +const fs = require('fs'); +const path = require('path'); +const fetch = require('node-fetch'); +const { exec } = require('child_process'); +const { pid, cpuUsage, cwd, arch, memoryUsage, ppid } = require('node:process'); +const os = require('os'); + +////////////////// 관련 식 정리 ////////////////// +/* +carbonEmissions = carbonIntensity * ( + runTime * ( + (PUE_used * n_CPUcores * CPUpower * usageCPU_used) #powerNeeded_core(powerNeeded_CPU) + + ( PUE_used * (memory * data_dict.refValues_dict['memoryPower']) ) #powerNeeded_memory + ) * PSF_used / 1000 +) +Carbonfootprint=energyneeded×carbonintensity +energy needed = runtime × (power draw for cores × usage + power draw for memory) × PUE ×PSF +carbonEmissions = energyNeeded * carbonIntensity +energyNeeded = runTime * powerNeeded * PSF_used / 1000 +powerNeeded = powerNeeded_core + powerNeeded_memory +powerNeeded_core = powerNeeded_CPU + powerNeeded_GPU (GPU신경 X) +powerNeeded_CPU = PUE_used * n_CPUcores * CPUpower * usageCPU_used +powerNeeded_memory = PUE_used * (memory * data_dict.refValues_dict['memoryPower']) +*/ + +////////////////// .csv 파일 경로 ////////////////// +/* +carbon intensity: data/v2.1/CI_aggregated.csv +PUE(Power Usage Effectiveness): data/v2.1/default_PUE.csv +PSF(Pragmatic Scaling Factor): blob/master/app.py#L399 --> default 1 +*/ + + +////////////////// declaring default values of variables ////////////////// +let carbonIntensity = 0.0; +let PUE = 1.0; +let PSF = 1; // static +let runTime = 0; +// CPU 관련 +let nCPUcores = 1; +let CPUpower = 12; // tdp per CPU core +let usageCPUUsed = 1.0; +// memory 관련 +let memory = 64; +let memoryPower = 0.3725; // static (by referenceValues.csv) +// 기타 +let countryName =''; +let provider = 'aws'; // AWS 환경일 경우, 'aws'인자로 넘기기 + +exports.get_carbon = async (req, res) => { + try { + let bodyData = req.body; + let userCode = bodyData.code; + let userName = bodyData.user; + + // 변수 값 설정 + setVariablesVal(); + + // 정규 표현식을 사용하여 클래스 이름 자동 추출 + let classNameMatch = userCode.match(/public\s+class\s+([A-Za-z_][A-Za-z0-9_]*)/); + if (!classNameMatch || classNameMatch.length < 2) { + return res.status(400).json({ error: 'Failed to extract class name from Java code' }); + } + // 추출한 클래스 이름 + let userClassName = classNameMatch[1]; + // .java 파일명 생성 및 파일 생성 + let javaFileName = `${userClassName}.java`; + fs.writeFileSync(javaFileName, userCode); + + // start to record runTime + const startTime = process.hrtime(); + + // Compile the user's Java code + exec(`javac ${javaFileName}`, (compileError, compileStdout, compileStderr) => { + if (compileError) { + console.error(`Compilation Error: ${compileError}`); + return res.status(500).json({ error: 'Failed to compile Java code' }); + } + + // Execute the compiled Java code + exec(`java ${userClassName}`, async (runError, runStdout, runStderr) => { + if (runError) { + console.error(`Execution Error: ${runError}`); + return res.status(500).json({ error: 'Failed to execute Java code' }); + } + + // end to record runTime + const endTime = process.hrtime(startTime); + + // 실행 시간 계산 (per millisecond) + const executionTimeInMilliseconds = (endTime[0] * 1000 + endTime[1] / 1e6); + // 실행 시간을 시간 단위로 환산 (per hour) + const executionTimeInHours = (executionTimeInMilliseconds / 3600000); + + runTime = executionTimeInHours; + + let output = runStdout.trim(); + + fs.unlinkSync(javaFileName); + fs.unlinkSync(`${userClassName}.class`); + + // calculating carbonEmission + let powerNeededCPU = PUE * nCPUcores * CPUpower * usageCPUUsed; + let powerNeededMemory = PUE * memory * memoryPower; + let powerNeeded = powerNeededCPU + powerNeededMemory; + let energyNeeded = runTime * powerNeeded * PSF / 1000; + let carbonEmission = energyNeeded * carbonIntensity; + + //TODO: carbonSample DB 값 불러오기 + let name = "자동차"; + let figure = "10"; + let description = "자동차와 비교했을 때의 탄소배출량"; + + // inserting data into DB + let sql = ` + INSERT INTO team6.tb_carbon + (user_id, carbon_emission, code, core_num, cpu_power, cpu_usage, memory, memory_power, location, runtime, PUE, PSF, carbon_intensity, provider) + VALUES ( + (SELECT id FROM team6.tb_user WHERE tb_user.name = "${userName}"), + ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? + ); + `; + let sqlVal = [userName, carbonEmission, userCode, nCPUcores, CPUpower, usageCPUUsed, memory, memoryPower, countryName, runTime, PUE, PSF, carbonIntensity, provider]; + db.query(sql, sqlVal, function (err, result) { + if (err) { + console.log("query is not executed: " + err); + res.send("error"); + } else { + res.status(200).send({ + carbonEmission: carbonEmission, + executionServerInfo: { + nCPUcores: nCPUcores, + CPUpower: CPUpower, + usageCPUUsed: usageCPUUsed, + memory: memory, + memoryPower: memoryPower, + countryName: countryName, + runTime: runTime, + PUE: PUE, + PSF: PSF, + carbonIntensity: carbonIntensity, + provider: provider, + }, + carbonSample: { + name: name, + figure: figure, + description: description, + }, + }); + } + }); + }); + }); + } catch (err) { + console.log(err); + res.send("error"); + } +}; + +exports.get_ranking = async (req, res) => { + try { + let sql = ` + SELECT tb_user.name, tb_carbon.carbon_emission + FROM team6.tb_user + INNER JOIN team6.tb_carbon + ON tb_user.id = tb_carbon.user_id + ORDER BY tb_carbon.carbon_emission ASC + LIMIT 5; + `; + db.query(sql, function (err, result) { + if (err) { + console.log("query is not executed: " + err); + res.send("error"); + } else { + res.status(200).send(result); + } + }); + } catch (err) { + console.log(err); + res.send("error"); + } +}; + +async function setVariablesVal() { + carbonIntensity = await getCarbonIntensityData(); + PUE = getPUE(provider); + nCPUcores = os.cpus().length; + let cpuUsage = os.cpus().map(core => { + let { user, sys, idle } = core.times; + let total = user + sys + idle; + let usage = (user + sys) / total; + return usage; + }); + let averageUsage = cpuUsage.reduce((acc, value) => acc + value, 0) / cpuUsage.length; + usageCPUUsed = averageUsage; + memory = os.totalmem()/(1024**3); +} + +async function getCarbonIntensityData() { + const filePath = path.join(__dirname, '../../data/CI_aggregated.csv'); + const carbonIntensityData = fs.readFileSync(filePath, 'utf8'); + const cILines = carbonIntensityData.split('\n').slice(1); // Skip the header + + const cI_dict_byLoc = {}; + const cI_dict_byName = {}; + + cILines.forEach((line) => { + let [location, continentName, countryName, regionName, carbonIntensity] = line.split(','); + + // Build cI_dict_byLoc + cI_dict_byLoc[location] = { + continentName, + countryName, + regionName, + carbonIntensity, + }; + + // Build CI_dict_byName + if (!cI_dict_byName[continentName]) { + cI_dict_byName[continentName] = {}; + } + if (!cI_dict_byName[continentName][countryName]) { + cI_dict_byName[continentName][countryName] = {}; + } + cI_dict_byName[continentName][countryName][regionName] = { + location, + carbonIntensity, + }; + }); + + const locationVar = await getCurLocation().then((res) => res); + // Access carbonIntensity from CI_dict_byLoc + const carbonIntensity = cI_dict_byLoc[locationVar].carbonIntensity; + countryName = cI_dict_byLoc[locationVar].countryName; + + return Promise.resolve(carbonIntensity); +}; + +async function getCurLocation() { + const locationInfo = await fetch(`https://api.ip.pe.kr/json/`); + const locationData = await locationInfo.json(); + const countryCode = locationData.country_code; + + return countryCode; +}; + +function getPUE(provider='Unknown') { + // 데이터 로드 + const filePath = path.join(__dirname, '../../data/defaults_PUE.csv'); + const pueContent = fs.readFileSync(filePath, 'utf8'); + const pueLines = pueContent.split('\n').slice(1); // 헤더 행 제외 + + // 필요한 데이터 추출 + const pueDefault_dict = {}; + pueLines.forEach((line) => { + const [provider, pue] = line.split(','); + pueDefault_dict[provider] = parseFloat(pue); + }); + + return pueDefault_dict[provider]; +}; diff --git a/backend/src/routes/carbon/index.js b/backend/src/routes/carbon/index.js new file mode 100644 index 0000000..812928a --- /dev/null +++ b/backend/src/routes/carbon/index.js @@ -0,0 +1,7 @@ +const router = require("express").Router(); +const ctrl = require("./carbon.ctrl"); + +router.post("/", ctrl.get_carbon); +router.get("/ranking", ctrl.get_ranking); + +module.exports = router; diff --git a/backend/src/routes/db.js b/backend/src/routes/db.js index 458d752..654ebe1 100644 --- a/backend/src/routes/db.js +++ b/backend/src/routes/db.js @@ -1,16 +1,19 @@ -const dotenv = require("dotenv"); -const config = require('../config/config'); -const mysql = require('mysql2'); +const mysql = require('mysql') +const dotenv = require('dotenv'); +dotenv.config(); +const { DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, PORT } = process.env; -dotenv.config(); //LOAD CONFIG +const db = mysql.createConnection({ + host: DB_HOST, + user: DB_USER, + password: DB_PASSWORD, + database: DB_DATABASE, + port: PORT, + multipleStatements : true, + }); + +db.connect(function (err) { + if (err) console.error("mysql connection error : " + err); +}); -const connection = mysql.createConnection(config); - -try { - connection.connect(); - console.log("[server] DB connection is sucessfull") -} catch (e) { - console.error(e); -} - -module.exports = connection \ No newline at end of file +module.exports = db; diff --git a/backend/src/routes/index.js b/backend/src/routes/index.js index 56e8a31..068d5e7 100644 --- a/backend/src/routes/index.js +++ b/backend/src/routes/index.js @@ -1,5 +1,7 @@ const router = require("express").Router(); -router.use("/test", require("./test")) +router.use("/test", require("./test")); +router.use("/carbon", require("./carbon")); +router.use("/user", require("./user")); module.exports = router; diff --git a/backend/src/routes/test/test.ctrl.js b/backend/src/routes/test/test.ctrl.js index 367cd50..3445bb2 100644 --- a/backend/src/routes/test/test.ctrl.js +++ b/backend/src/routes/test/test.ctrl.js @@ -1,21 +1,24 @@ /* Test API file */ -// const db = require("../db"); +const db = require("../db"); -// exports.get_root = (req,res) => { -// db.query('SELECT * from test', (error, rows) => { -// if (error) { -// throw error; -// } -// console.log(rows); -// res.send(rows); -// }); -// }; exports.get_root = async (req,res) => { try { - res.status(200).send("Helloe World"); + var sql = "SELECT * FROM team6.tb_user"; + db.query(sql, function (err, result) { + if (err) console.log("query is not excuted: " + err); + else res.status(200).send(result); + }); } catch (err) { console.log(err); res.send("error"); - } + } }; +// exports.get_root = async (req,res) => { +// try { +// res.status(200).send("Helloe World"); +// } catch (err) { +// console.log(err); +// res.send("error"); +// } +// }; diff --git a/backend/src/routes/user/index.js b/backend/src/routes/user/index.js new file mode 100644 index 0000000..5f0137c --- /dev/null +++ b/backend/src/routes/user/index.js @@ -0,0 +1,6 @@ +const router = require("express").Router(); +const ctrl = require("./user.ctrl"); + +router.get("/login", ctrl.login); + +module.exports = router; diff --git a/backend/src/routes/user/user.ctrl.js b/backend/src/routes/user/user.ctrl.js new file mode 100644 index 0000000..e128061 --- /dev/null +++ b/backend/src/routes/user/user.ctrl.js @@ -0,0 +1,29 @@ +const db = require("../db"); + +exports.login = async (req, res) => { + try { + let userName = req.query.user; + + let sql = ` + INSERT INTO team6.tb_user (name) + VALUES (?) + ON DUPLICATE KEY UPDATE name = name; + + SELECT id FROM team6.tb_user WHERE name = (?); + `; + let sqlVal = [userName, userName]; + + db.query(sql, sqlVal, function (err, result) { + if (err) { + console.log("query is not executed: " + err); + res.send("error"); + } else { + res.status(200).send(result[1][0]); + } + }); + } + catch (err) { + console.log(err); + res.send("error"); + } +} \ No newline at end of file diff --git a/backend/src/server.js b/backend/src/server.js index e0495e1..506cfec 100644 --- a/backend/src/server.js +++ b/backend/src/server.js @@ -2,6 +2,5 @@ const app = require("./app.js"); const port = 8080; const server = app.listen(port, () => { - console.log(`[server] Express listening on port: ${port}`); - console.log(`[baseURL] http://localhost:${port}`); + console.log(`[server] Express Server listening on port: ${port}`); }); \ No newline at end of file