From 9fb12e8ea75337b6d686fce7ca742b094c3da883 Mon Sep 17 00:00:00 2001 From: withSang Date: Wed, 23 Feb 2022 21:19:44 +0900 Subject: [PATCH 001/108] Initial commit --- .gitignore | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 106 insertions(+) create mode 100644 .gitignore create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..67045665 --- /dev/null +++ b/.gitignore @@ -0,0 +1,104 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port diff --git a/README.md b/README.md new file mode 100644 index 00000000..56d3de71 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# taxiSampleGenerator +sample data generator for SPARCS Taxi project From ed3f287ab91e826a595ffb761911c5b2e80f9dd0 Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 23 Feb 2022 22:35:55 +0900 Subject: [PATCH 002/108] done --- index.js | 34 + package-lock.json | 1897 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 27 + security.js | 12 + src/db/mongo.js | 80 ++ src/testData.js | 86 ++ 6 files changed, 2136 insertions(+) create mode 100644 index.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 security.js create mode 100644 src/db/mongo.js create mode 100644 src/testData.js diff --git a/index.js b/index.js new file mode 100644 index 00000000..11bc3f0f --- /dev/null +++ b/index.js @@ -0,0 +1,34 @@ +const { + generateUser, + generateRoom, + generateSampleLocations, + generateChats, +} = require("./src/testData"); + +const security = require("./security"); + +const main = async () => { + const userIds = ["sunday", "monday", "tuesday", "wednesday"]; + const numberOfRooms = security.numberOfRooms; + const numberOfChats = security.numberOfChats; + const userOids = []; + const roomOids = []; + for (const userId in userIds) { + const userOid = await generateUser(userId); + userOids.push(userOid); + } + + const { fromOid, toOid } = await generateSampleLocations(); + + for (const i of Array(numberOfRooms).keys()) { + const roomOid = await generateRoom(fromOid, toOid, i + 1, userOids, 7); + roomOids.push(roomOid); + } + + for (const roomOid of roomOids) { + await generateChats(roomOid, numberOfChats); + } + console.log("๋!"); +}; + +main(); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..14061525 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1897 @@ +{ + "name": "taxisamplegenerator", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "taxisamplegenerator", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "dotenv": "^16.0.0", + "eslint": "^8.9.0", + "mongoose": "^6.2.3" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", + "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.1", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.3.tgz", + "integrity": "sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==", + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" + }, + "node_modules/@types/node": { + "version": "17.0.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.20.tgz", + "integrity": "sha512-Q15Clj3lZSLnhVA6yKw1G7SQz46DeL9gO1TEgfK1OQGvMdQ6TUWmCeWf1QBUNkw2BDfV52i2YuYd9OF3ZwGhjw==" + }, + "node_modules/@types/webidl-conversions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", + "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" + }, + "node_modules/@types/whatwg-url": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz", + "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==", + "dependencies": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "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/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/bson": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.1.tgz", + "integrity": "sha512-I1LQ7Hz5zgwR4QquilLNZwbhPw0Apx7i7X9kGMBTsqPdml/03Q9NBtD9nt/19ahjlphktQImrnderxqpzeVDjw==", + "dependencies": { + "buffer": "^5.6.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "node_modules/denque": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", + "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==", + "engines": { + "node": ">=0.10" + } + }, + "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.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", + "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==", + "engines": { + "node": ">=12" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", + "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", + "dependencies": { + "@eslint/eslintrc": "^1.1.0", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/espree": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "dependencies": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "engines": { + "node": ">=4.0" + } + }, + "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/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "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": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.12.1", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", + "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "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.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "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/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" + }, + "node_modules/kareem": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.4.tgz", + "integrity": "sha512-Vcrt8lcpVl0s8ePx634BxwRqmFo+5DcOhlmNadehxreMTIQi/9hOL/B3hZQQbK5DgMS7Lem3xABXV7/S3jy+7g==" + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mongodb": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.3.1.tgz", + "integrity": "sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==", + "dependencies": { + "bson": "^4.6.1", + "denque": "^2.0.1", + "mongodb-connection-string-url": "^2.4.1", + "socks": "^2.6.1" + }, + "engines": { + "node": ">=12.9.0" + }, + "optionalDependencies": { + "saslprep": "^1.0.3" + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.4.2.tgz", + "integrity": "sha512-mZUXF6nUzRWk5J3h41MsPv13ukWlH4jOMSk6astVeoZ1EbdTJyF5I3wxKkvqBAOoVtzLgyEYUvDjrGdcPlKjAw==", + "dependencies": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, + "node_modules/mongoose": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.3.tgz", + "integrity": "sha512-FxF2D0MGGIw9bAJ57nSyM4Hs4tDHbu6dn9gQwT1J/lxmRB8jfaWWJ3FSJXTmeYlQ6BpyKeIaT8fj6SAX0YMNBA==", + "dependencies": { + "bson": "^4.2.2", + "kareem": "2.3.4", + "mongodb": "4.3.1", + "mpath": "0.8.4", + "mquery": "4.0.2", + "ms": "2.1.3", + "sift": "16.0.0" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mongoose" + } + }, + "node_modules/mpath": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", + "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mquery": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz", + "integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==", + "dependencies": { + "debug": "4.x" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "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": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/sift": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", + "integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz", + "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==", + "dependencies": { + "ip": "^1.1.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", + "optional": true, + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + }, + "dependencies": { + "@eslint/eslintrc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", + "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.1", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.3.tgz", + "integrity": "sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==", + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" + }, + "@types/node": { + "version": "17.0.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.20.tgz", + "integrity": "sha512-Q15Clj3lZSLnhVA6yKw1G7SQz46DeL9gO1TEgfK1OQGvMdQ6TUWmCeWf1QBUNkw2BDfV52i2YuYd9OF3ZwGhjw==" + }, + "@types/webidl-conversions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", + "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" + }, + "@types/whatwg-url": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz", + "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==", + "requires": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "bson": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.1.tgz", + "integrity": "sha512-I1LQ7Hz5zgwR4QquilLNZwbhPw0Apx7i7X9kGMBTsqPdml/03Q9NBtD9nt/19ahjlphktQImrnderxqpzeVDjw==", + "requires": { + "buffer": "^5.6.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "denque": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", + "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==" + }, + "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.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", + "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==" + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "eslint": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", + "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", + "requires": { + "@eslint/eslintrc": "^1.1.0", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==" + }, + "espree": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "requires": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.3.0" + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "requires": { + "flat-cache": "^3.0.4" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "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": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.12.1", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", + "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "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.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "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" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" + }, + "kareem": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.4.tgz", + "integrity": "sha512-Vcrt8lcpVl0s8ePx634BxwRqmFo+5DcOhlmNadehxreMTIQi/9hOL/B3hZQQbK5DgMS7Lem3xABXV7/S3jy+7g==" + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mongodb": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.3.1.tgz", + "integrity": "sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==", + "requires": { + "bson": "^4.6.1", + "denque": "^2.0.1", + "mongodb-connection-string-url": "^2.4.1", + "saslprep": "^1.0.3", + "socks": "^2.6.1" + } + }, + "mongodb-connection-string-url": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.4.2.tgz", + "integrity": "sha512-mZUXF6nUzRWk5J3h41MsPv13ukWlH4jOMSk6astVeoZ1EbdTJyF5I3wxKkvqBAOoVtzLgyEYUvDjrGdcPlKjAw==", + "requires": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, + "mongoose": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.3.tgz", + "integrity": "sha512-FxF2D0MGGIw9bAJ57nSyM4Hs4tDHbu6dn9gQwT1J/lxmRB8jfaWWJ3FSJXTmeYlQ6BpyKeIaT8fj6SAX0YMNBA==", + "requires": { + "bson": "^4.2.2", + "kareem": "2.3.4", + "mongodb": "4.3.1", + "mpath": "0.8.4", + "mquery": "4.0.2", + "ms": "2.1.3", + "sift": "16.0.0" + } + }, + "mpath": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", + "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==" + }, + "mquery": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz", + "integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==", + "requires": { + "debug": "4.x" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "requires": { + "callsites": "^3.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==" + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "optional": true, + "requires": { + "sparse-bitfield": "^3.0.3" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "sift": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", + "integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==" + }, + "smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" + }, + "socks": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz", + "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==", + "requires": { + "ip": "^1.1.5", + "smart-buffer": "^4.2.0" + } + }, + "sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", + "optional": true, + "requires": { + "memory-pager": "^1.0.2" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "requires": { + "punycode": "^2.1.1" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==" + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" + }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..f28cc6d7 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "taxisamplegenerator", + "version": "1.0.0", + "description": "sample generator", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/withSang/taxiSampleGenerator.git" + }, + "keywords": [ + "test" + ], + "author": "withSang", + "license": "ISC", + "bugs": { + "url": "https://github.com/withSang/taxiSampleGenerator/issues" + }, + "homepage": "https://github.com/withSang/taxiSampleGenerator#readme", + "dependencies": { + "dotenv": "^16.0.0", + "eslint": "^8.9.0", + "mongoose": "^6.2.3" + } +} diff --git a/security.js b/security.js new file mode 100644 index 00000000..921ddb58 --- /dev/null +++ b/security.js @@ -0,0 +1,12 @@ +require("dotenv").config(); + +const env = { + mongo: process.env.DB_PATH, + taxiBackDir: process.env.TAXI_BACK_DIR, + numberOfRooms: (process.env.NUM_OF_ROOMS *= 1), + numberOfChats: (process.env.NUM_OF_CHATS *= 1), +}; + +console.log(env); + +module.exports = env; diff --git a/src/db/mongo.js b/src/db/mongo.js new file mode 100644 index 00000000..b0fe26ff --- /dev/null +++ b/src/db/mongo.js @@ -0,0 +1,80 @@ +const mongoose = require("mongoose"); +const Schema = mongoose.Schema; +const security = require("../../security"); + +const userSchema = Schema({ + name: { type: String, required: true }, //์‹ค๋ช… + nickname: { type: String, required: true }, //๋‹‰๋„ค์ž„ + id: { type: String, required: true, unique: true }, //ํƒ์‹œ ์„œ๋น„์Šค์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” id + profileImageUrl: { type: String, required: true }, //๋ฐฑ์—”๋“œ์—์„œ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ + room: [{ type: Schema.Types.ObjectId, ref: "Room" }], //์ฐธ์—ฌ์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด + withdraw: { type: Boolean, default: false }, + ban: { type: Boolean, default: false }, + joinat: { type: Date, required: true }, + subinfo: { + kaist: { type: String, default: "" }, + sparcs: { type: String, default: "" }, + facebook: { type: String, default: "" }, + twitter: { type: String, default: "" }, + }, +}); +const roomSchema = Schema({ + name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ" }, + from: { type: Schema.Types.ObjectId, ref: "Location", required: true }, + to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, + time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ + part: [{ type: Schema.Types.ObjectId, ref: "User" }], // ์ฐธ์—ฌ ๋ฉค๋ฒ„ + madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ + //FIXME: ๊ฒฐ์ œ ์˜ˆ์ •์ž, ์ •์‚ฐ ์—ฌ๋ถ€ (์›นํŽ˜์ด์ง€์—์„œ ์ด๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ฒƒ์ธ์ง€ ์ถ”๊ฐ€ ๋…ผ์˜๊ฐ€ ํ•„์š”ํ•จ) +}); +const locationSchema = Schema({ + name: { type: String, required: true }, + // latitude: { type: Number, required: true }, + // longitude: { type: Number, required: true } +}); +const chatSchema = Schema({ + roomId: { type: Schema.Types.ObjectId, required: true }, + authorId: { type: String }, // ์ž‘์„ฑ์ž id (null: ์ „์ฒด ๋ฉ”์‹œ์ง€) + authorName: { type: String }, + text: { type: String, default: "" }, + time: { type: Date, required: true }, +}); + +const database = mongoose.connection; + +const userModel = mongoose.model("User", userSchema); +const roomModel = mongoose.model("Room", roomSchema); +const locationModel = mongoose.model("Location", locationSchema); +const chatModel = mongoose.model("Chat", chatSchema); + +database.on("error", console.error.bind(console, "mongoose connection error.")); +database.on("open", () => { + userModel.collection.drop(); + roomModel.collection.drop(); + locationModel.collection.drop(); + chatModel.collection.drop(); + console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); +}); +database.on("error", function (err) { + console.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ ์—๋Ÿฌ ๋ฐœ์ƒ: " + err); + mongoose.disconnect(); +}); +database.on("disconnected", function () { + console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); + mongoose.connect(security.mongo, { + useNewUrlParser: true, + useUnifiedTopology: true, + }); +}); + +mongoose.connect(security.mongo, { + useNewUrlParser: true, + useUnifiedTopology: true, +}); + +module.exports = { + userModel, + roomModel, + locationModel, + chatModel, +}; diff --git a/src/testData.js b/src/testData.js new file mode 100644 index 00000000..59ff9793 --- /dev/null +++ b/src/testData.js @@ -0,0 +1,86 @@ +const { + userModel, + roomModel, + locationModel, + chatModel, +} = require("./db/mongo"); +const security = require("../security"); + +const generateUser = async (id) => { + const newUser = new userModel({ + name: `${id}-name`, + nickname: `${id}-nickname`, + id: id, + profileImageUrl: + security.taxiBackDir + "/public/profile-images/default/sample.png", //hardcoded + room: [], + joinat: Date.now(), + }); + await newUser.save(); + return newUser._id; +}; + +const generateSampleLocations = async () => { + const newFrom = new locationModel({ + name: "ํƒ์‹œ์Šน๊ฐ•์žฅ", + }); + const newTo = new locationModel({ + name: "๋Œ€์ „์—ญ", + }); + await newFrom.save(); + await newTo.save(); + + return { + fromOid: newFrom._id, + toOid: newTo._id, + }; +}; + +const generateRoom = async (from, to, num, users, daysAfter) => { + const date = new Date(); + date.setDate(date.getDate() + daysAfter); + const newRoom = new roomModel({ + name: `test-${num}`, + from: from, + to: to, + time: date, + part: users, + madeat: Date.now(), + }); + await newRoom.save(); + return newRoom._id; +}; + +const generateChats = async (roomId, numOfChats) => { + const extractLocationName = (location) => location.name; + const roomPopulateQuery = [ + { path: "part", select: "id name nickname -_id" }, + { path: "from", transform: extractLocationName }, + { path: "to", transform: extractLocationName }, + ]; + const room = await roomModel.findById(roomId).exec(); + await room.populate(roomPopulateQuery); + let lastTime = Date.now(); + const someMinutes = 1000 * 60; //1 mins + + for (const i of Array(numOfChats).keys()) { + const authorIdx = Math.floor(Math.random() * room.part.length); + lastTime += Math.floor(Math.random() * someMinutes); + const newChat = new chatModel({ + roomId: roomId, + authorId: room.part[authorIdx].id, + authorName: room.part[authorIdx].nickname, + text: `์•ˆ๋…•ํ•˜์„ธ์š”! (${i}๋ฒˆ์งธ ๋ฉ”์‹œ์ง€)`, + time: lastTime, + }); + await newChat.save(); + } + return; +}; + +module.exports = { + generateUser, + generateRoom, + generateSampleLocations, + generateChats, +}; From 76d6a65928f5f1d31c6a01565109b9358725762c Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 23 Feb 2022 22:48:00 +0900 Subject: [PATCH 003/108] Fix big bugs --- index.js | 2 +- security.js | 2 -- src/testData.js | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/index.js b/index.js index 11bc3f0f..fdd9e82c 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ const main = async () => { const numberOfChats = security.numberOfChats; const userOids = []; const roomOids = []; - for (const userId in userIds) { + for (const userId of userIds) { const userOid = await generateUser(userId); userOids.push(userOid); } diff --git a/security.js b/security.js index 921ddb58..4e72e13f 100644 --- a/security.js +++ b/security.js @@ -7,6 +7,4 @@ const env = { numberOfChats: (process.env.NUM_OF_CHATS *= 1), }; -console.log(env); - module.exports = env; diff --git a/src/testData.js b/src/testData.js index 59ff9793..3e8fd207 100644 --- a/src/testData.js +++ b/src/testData.js @@ -62,7 +62,6 @@ const generateChats = async (roomId, numOfChats) => { await room.populate(roomPopulateQuery); let lastTime = Date.now(); const someMinutes = 1000 * 60; //1 mins - for (const i of Array(numOfChats).keys()) { const authorIdx = Math.floor(Math.random() * room.part.length); lastTime += Math.floor(Math.random() * someMinutes); From ab1be3b589d9d1dfd1bd020dc542657d48330c80 Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 23 Feb 2022 23:01:05 +0900 Subject: [PATCH 004/108] Fix profileImageUrkl --- src/testData.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/testData.js b/src/testData.js index 3e8fd207..4bf2283e 100644 --- a/src/testData.js +++ b/src/testData.js @@ -11,8 +11,7 @@ const generateUser = async (id) => { name: `${id}-name`, nickname: `${id}-nickname`, id: id, - profileImageUrl: - security.taxiBackDir + "/public/profile-images/default/sample.png", //hardcoded + profileImageUrl: "public/profile-images/default/sample.png", //hardcoded room: [], joinat: Date.now(), }); From d3160da8c3f38687d0532977579f297ea9e4de33 Mon Sep 17 00:00:00 2001 From: withSang Date: Wed, 23 Feb 2022 23:22:54 +0900 Subject: [PATCH 005/108] Update README.md --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 56d3de71..2bc8eb03 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ # taxiSampleGenerator -sample data generator for SPARCS Taxi project +This program generates simple sample data for SPARCS Taxi project. + +**SETUP** +1. Clone the repostory +2. Install the dependencies (```npm install```) +3. Add .env +``` +DB_PATH="mongodb PATH" +NUM_OF_CHATS="number of chats per room e.g.) 200" +NUM_OF_ROOMS="number of rooms e.g.) 1" +``` +4. Edit ```index.js``` to modify the list of sample users (edit constant ```userIds```, they should follow the rules of SPARCSSSO Ids) +5. Edit ```src/testData.js``` to modify maximum time intervals between the chats(edit constant ```someMinutes```, in milliseconds) +6. Generate sample users, rooms, chats by executing ```node index.js``` From dff3d4638364de1dbac47a478ad3fd96aaba3097 Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 23 Feb 2022 23:34:33 +0900 Subject: [PATCH 006/108] remove unnecessary URI --- security.js | 1 - src/db/mongo.js | 8 ++++++-- src/testData.js | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/security.js b/security.js index 4e72e13f..7c16937b 100644 --- a/security.js +++ b/security.js @@ -2,7 +2,6 @@ require("dotenv").config(); const env = { mongo: process.env.DB_PATH, - taxiBackDir: process.env.TAXI_BACK_DIR, numberOfRooms: (process.env.NUM_OF_ROOMS *= 1), numberOfChats: (process.env.NUM_OF_CHATS *= 1), }; diff --git a/src/db/mongo.js b/src/db/mongo.js index b0fe26ff..ea6423be 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -47,12 +47,16 @@ const roomModel = mongoose.model("Room", roomSchema); const locationModel = mongoose.model("Location", locationSchema); const chatModel = mongoose.model("Chat", chatSchema); -database.on("error", console.error.bind(console, "mongoose connection error.")); -database.on("open", () => { +const initailizeDB = () => { userModel.collection.drop(); roomModel.collection.drop(); locationModel.collection.drop(); chatModel.collection.drop(); +}; + +database.on("error", console.error.bind(console, "mongoose connection error.")); +database.on("open", () => { + initializeDB(); console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); }); database.on("error", function (err) { diff --git a/src/testData.js b/src/testData.js index 4bf2283e..4bb6a7f3 100644 --- a/src/testData.js +++ b/src/testData.js @@ -4,7 +4,6 @@ const { locationModel, chatModel, } = require("./db/mongo"); -const security = require("../security"); const generateUser = async (id) => { const newUser = new userModel({ From 882be6e11923b47de0dd9033270a0ccbe255ca73 Mon Sep 17 00:00:00 2001 From: withsang Date: Fri, 25 Feb 2022 01:09:50 +0900 Subject: [PATCH 007/108] Merge from main --- src/testData.js | 75 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/src/testData.js b/src/testData.js index 4bb6a7f3..2d3961df 100644 --- a/src/testData.js +++ b/src/testData.js @@ -49,28 +49,71 @@ const generateRoom = async (from, to, num, users, daysAfter) => { return newRoom._id; }; +const generateNormalChat = async (i, roomId, user, time) => { + const newChat = new chatModel({ + roomId: roomId, + authorId: user.id, + authorName: user.nickname, + text: `์•ˆ๋…•ํ•˜์„ธ์š”! (${i}๋ฒˆ์งธ ๋ฉ”์‹œ์ง€)`, + time: time, + }); + await newChat.save(); +}; + +const generateJoinAbortChat = async (roomId, user, isJoining, time) => { + const newChat = new chatModel({ + roomId: roomId, + authorId: null, + authorName: null, + text: `${user.id}๋‹˜์ด ${isJoining ? "์ž…์žฅ" : "ํ‡ด์žฅ"}ํ–ˆ์Šต๋‹ˆ๋‹ค.`, + time: time, + }); + await newChat.save(); +}; + const generateChats = async (roomId, numOfChats) => { - const extractLocationName = (location) => location.name; - const roomPopulateQuery = [ - { path: "part", select: "id name nickname -_id" }, - { path: "from", transform: extractLocationName }, - { path: "to", transform: extractLocationName }, - ]; + const roomPopulateQuery = [{ path: "part", select: "id name nickname -_id" }]; const room = await roomModel.findById(roomId).exec(); await room.populate(roomPopulateQuery); + + const userIdsInRoom = []; + const userIdsOutRoom = room.part.map((user) => user.id); + let lastTime = Date.now(); - const someMinutes = 1000 * 60; //1 mins + const someMinutes = 1000 * 20; //20 seconds + let occurenceOfJoin = 0.05; //5% + let occurenceOfAbort = 0.05; //5%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 10% + for (const i of Array(numOfChats).keys()) { - const authorIdx = Math.floor(Math.random() * room.part.length); lastTime += Math.floor(Math.random() * someMinutes); - const newChat = new chatModel({ - roomId: roomId, - authorId: room.part[authorIdx].id, - authorName: room.part[authorIdx].nickname, - text: `์•ˆ๋…•ํ•˜์„ธ์š”! (${i}๋ฒˆ์งธ ๋ฉ”์‹œ์ง€)`, - time: lastTime, - }); - await newChat.save(); + const event = Math.random(); + + if (event > occurenceOfJoin + occurenceOfAbort) { + // ๋ฐฉ์ด ๋น„์–ด์žˆ์ง€ ์•Š์„ ๊ฒฝ์šฐ, ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ฆ + if (userIdsInRoom.length !== 0) { + const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); + const user = room.part[authorIdx]; + await generateNormalChat(i, roomId, user, lastTime); + } + } else if (event < occurenceOfJoin) { + // ๋” ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋” ๋“ค์–ด์˜ด + if (userIdsOutRoom.length !== 0) { + const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); + const user = userIdsOutRoom[authorIdx]; + generateJoinAbortChat(roomId, user, true, lastTime); + userIdsInRoom.push(user); + userIdsOutRoom.splice(authorIdx, 1); + } + } else { + // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋‚˜๊ฐ + if (userIdsInRoom.length > 1) { + const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); + const user = userIdsOutRoom[authorIdx]; + generateJoinAbortChat(roomId, user, false, lastTime); + userIdsOutRoom.push(user); + userIdsInRoom.splice(authorIdx, 1); + } + } } return; }; From 8ccaa08d18c00b9c2715533957562d169a8d9be9 Mon Sep 17 00:00:00 2001 From: withsang Date: Sat, 26 Feb 2022 06:04:09 +0900 Subject: [PATCH 008/108] Add join/abort event and remove hardcoded vars --- README.md | 30 ++++++++++++++++------ index.js | 4 +-- security.js | 16 ++++++++---- src/db/mongo.js | 12 +++++---- src/testData.js | 67 ++++++++++++++++++++++++++----------------------- 5 files changed, 79 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 2bc8eb03..8009ce11 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,31 @@ # taxiSampleGenerator + This program generates simple sample data for SPARCS Taxi project. **SETUP** + 1. Clone the repostory -2. Install the dependencies (```npm install```) +2. Install the dependencies (`npm install`) 3. Add .env + ``` -DB_PATH="mongodb PATH" -NUM_OF_CHATS="number of chats per room e.g.) 200" -NUM_OF_ROOMS="number of rooms e.g.) 1" +#mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) +DB_PATH= +#๋ฐฉ์— ์ฐธ์—ฌํ•˜๋Š” ์‚ฌ์šฉ์ž ๋ชฉ๋ก. ์ฝค๋งˆ๋กœ ๊ตฌ๋ถ„ +USERS="sunday, monday, tuesday, wednesday" +#์ถœ๋ฐœ์ง€์™€ ๋„์ฐฉ์ง€ +FROM_LOCATION=ํƒ์‹œ์Šน๊ฐ•์žฅ +TO_LOCATION=๋Œ€์ „์—ญ +#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ +NUM_OF_ROOMS=1 +NUM_OF_CHATS=200 +#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) +MAXIMUM_INTERVAL_BETWEEN_CHATS=20 +#์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) +OCCURENCE_OF_JOIN=0.1 +OCCURENCE_OF_ABORT=0.1 ``` -4. Edit ```index.js``` to modify the list of sample users (edit constant ```userIds```, they should follow the rules of SPARCSSSO Ids) -5. Edit ```src/testData.js``` to modify maximum time intervals between the chats(edit constant ```someMinutes```, in milliseconds) -6. Generate sample users, rooms, chats by executing ```node index.js``` + +1. Edit `index.js` to modify the list of sample users +2. Edit `src/testData.js` to modify maximum time intervals between the chats +3. Generate sample users, rooms, chats by executing `node index.js` diff --git a/index.js b/index.js index fdd9e82c..cf3ad9a6 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ const { const security = require("./security"); const main = async () => { - const userIds = ["sunday", "monday", "tuesday", "wednesday"]; + const userIds = security.users; const numberOfRooms = security.numberOfRooms; const numberOfChats = security.numberOfChats; const userOids = []; @@ -21,7 +21,7 @@ const main = async () => { const { fromOid, toOid } = await generateSampleLocations(); for (const i of Array(numberOfRooms).keys()) { - const roomOid = await generateRoom(fromOid, toOid, i + 1, userOids, 7); + const roomOid = await generateRoom(fromOid, toOid, i + 1, userOids, 7); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. roomOids.push(roomOid); } diff --git a/security.js b/security.js index 7c16937b..003d9db9 100644 --- a/security.js +++ b/security.js @@ -1,9 +1,15 @@ require("dotenv").config(); -const env = { +module.exports = { mongo: process.env.DB_PATH, - numberOfRooms: (process.env.NUM_OF_ROOMS *= 1), - numberOfChats: (process.env.NUM_OF_CHATS *= 1), + users: process.env.USERS.split(", "), + fromLocation: process.env.FROM_LOCATION, + toLocation: process.env.TO_LOCATION, + numberOfRooms: parseInt(process.env.NUM_OF_ROOMS), + numberOfChats: parseInt(process.env.NUM_OF_CHATS), + maximumIntervalBtwChats: parseFloat( + process.env.MAXIMUM_INTERVAL_BETWEEN_CHATS + ), + occurenceOfJoin: parseFloat(process.env.OCCURENCE_OF_JOIN), + occurenceOfAbort: parseFloat(process.env.OCCURENCE_OF_ABORT), }; - -module.exports = env; diff --git a/src/db/mongo.js b/src/db/mongo.js index ea6423be..cc15c1a9 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -47,11 +47,13 @@ const roomModel = mongoose.model("Room", roomSchema); const locationModel = mongoose.model("Location", locationSchema); const chatModel = mongoose.model("Chat", chatSchema); -const initailizeDB = () => { - userModel.collection.drop(); - roomModel.collection.drop(); - locationModel.collection.drop(); - chatModel.collection.drop(); +const initializeDB = () => { + const models = [userModel, roomModel, locationModel, chatModel]; + for (const model of models) { + if (model.collection) { + model.collection.drop(); + } + } }; database.on("error", console.error.bind(console, "mongoose connection error.")); diff --git a/src/testData.js b/src/testData.js index 2d3961df..1134d34d 100644 --- a/src/testData.js +++ b/src/testData.js @@ -4,6 +4,7 @@ const { locationModel, chatModel, } = require("./db/mongo"); +const security = require("../security"); const generateUser = async (id) => { const newUser = new userModel({ @@ -20,10 +21,10 @@ const generateUser = async (id) => { const generateSampleLocations = async () => { const newFrom = new locationModel({ - name: "ํƒ์‹œ์Šน๊ฐ•์žฅ", + name: security.fromLocation, }); const newTo = new locationModel({ - name: "๋Œ€์ „์—ญ", + name: security.toLocation, }); await newFrom.save(); await newTo.save(); @@ -65,7 +66,7 @@ const generateJoinAbortChat = async (roomId, user, isJoining, time) => { roomId: roomId, authorId: null, authorName: null, - text: `${user.id}๋‹˜์ด ${isJoining ? "์ž…์žฅ" : "ํ‡ด์žฅ"}ํ–ˆ์Šต๋‹ˆ๋‹ค.`, + text: `${user.nickname}๋‹˜์ด ${isJoining ? "์ž…์žฅ" : "ํ‡ด์žฅ"}ํ–ˆ์Šต๋‹ˆ๋‹ค.`, time: time, }); await newChat.save(); @@ -73,46 +74,50 @@ const generateJoinAbortChat = async (roomId, user, isJoining, time) => { const generateChats = async (roomId, numOfChats) => { const roomPopulateQuery = [{ path: "part", select: "id name nickname -_id" }]; - const room = await roomModel.findById(roomId).exec(); - await room.populate(roomPopulateQuery); + const room = await roomModel + .findById(roomId) + .lean() + .populate(roomPopulateQuery); const userIdsInRoom = []; - const userIdsOutRoom = room.part.map((user) => user.id); - + const userIdsOutRoom = room.part; let lastTime = Date.now(); - const someMinutes = 1000 * 20; //20 seconds - let occurenceOfJoin = 0.05; //5% - let occurenceOfAbort = 0.05; //5%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 10% + const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds + let occurenceOfJoin = security.occurenceOfJoin; //Default: 10% + let occurenceOfAbort = security.occurenceOfAbort; //Default: 10%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 20% for (const i of Array(numOfChats).keys()) { - lastTime += Math.floor(Math.random() * someMinutes); + lastTime += Math.floor(Math.random() * maximumIntervalBtwChats); const event = Math.random(); - if (event > occurenceOfJoin + occurenceOfAbort) { + if ( + userIdsInRoom.length === 0 || + (event < occurenceOfJoin && userIdsOutRoom.length !== 0) + ) { + // ๋” ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋” ๋“ค์–ด์˜ด + const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); + const user = userIdsOutRoom[authorIdx]; + await generateJoinAbortChat(roomId, user, true, lastTime); + userIdsInRoom.push(user); + userIdsOutRoom.splice(authorIdx, 1); + } else if ( + occurenceOfJoin <= event && + event < occurenceOfJoin + occurenceOfAbort && + userIdsInRoom.length > 1 + ) { + // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋‚˜๊ฐ + const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); + const user = userIdsInRoom[authorIdx]; + await generateJoinAbortChat(roomId, user, false, lastTime); + userIdsOutRoom.push(user); + userIdsInRoom.splice(authorIdx, 1); + } else { // ๋ฐฉ์ด ๋น„์–ด์žˆ์ง€ ์•Š์„ ๊ฒฝ์šฐ, ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ฆ if (userIdsInRoom.length !== 0) { const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); - const user = room.part[authorIdx]; + const user = userIdsInRoom[authorIdx]; await generateNormalChat(i, roomId, user, lastTime); } - } else if (event < occurenceOfJoin) { - // ๋” ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋” ๋“ค์–ด์˜ด - if (userIdsOutRoom.length !== 0) { - const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); - const user = userIdsOutRoom[authorIdx]; - generateJoinAbortChat(roomId, user, true, lastTime); - userIdsInRoom.push(user); - userIdsOutRoom.splice(authorIdx, 1); - } - } else { - // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋‚˜๊ฐ - if (userIdsInRoom.length > 1) { - const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); - const user = userIdsOutRoom[authorIdx]; - generateJoinAbortChat(roomId, user, false, lastTime); - userIdsOutRoom.push(user); - userIdsInRoom.splice(authorIdx, 1); - } } } return; From 107cd5ee9454a2de0e5fa5393f79e468942558c0 Mon Sep 17 00:00:00 2001 From: withsang Date: Sat, 26 Feb 2022 20:19:28 +0900 Subject: [PATCH 009/108] Add npm start script --- README.md | 20 +++++++++++--------- index.js | 2 +- package.json | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8009ce11..54e340a5 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ # taxiSampleGenerator -This program generates simple sample data for SPARCS Taxi project. +์ด node ํ”„๋กœ๊ทธ๋žจ์€ SPARCS-Taxi ํ”„๋กœ์ ํŠธ๋ฅผ ์œ„ํ•œ ์ƒ˜ํ”Œ ์‚ฌ์šฉ์ž, ๋ฐฉ, ์ฑ„ํŒ… ๋ชฉ๋ก์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. +ํ˜„์žฌ ์ด ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ์ƒ์„ฑ๋œ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋Š” ์ž…, ํ‡ด์žฅ ๋ฉ”์‹œ์ง€๋“ค๊ณผ ์ผ๋ฐ˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋“ค๋กœ๋งŒ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. + +**WARNING** +์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰ ์‹œ ๊ธฐ์กด์— MongoDB์— ์ €์žฅ๋œ ์‚ฌ์šฉ์ž, ๋ฐฉ, ์ฑ„ํŒ… ์ •๋ณด๋Š” **์‚ญ์ œ**๋ฉ๋‹ˆ๋‹ค! **SETUP** -1. Clone the repostory -2. Install the dependencies (`npm install`) -3. Add .env +1. ๋กœ์ปฌ ์ €์žฅ์†Œ์— ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋ฅผ ํด๋ก ํ•ฉ๋‹ˆ๋‹ค. +2. `npm install`๋กœ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. +3. ํด๋ก ํ•œ ๋””๋ ‰ํ† ๋ฆฌ(index.js๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ``` #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) @@ -16,16 +20,14 @@ USERS="sunday, monday, tuesday, wednesday" #์ถœ๋ฐœ์ง€์™€ ๋„์ฐฉ์ง€ FROM_LOCATION=ํƒ์‹œ์Šน๊ฐ•์žฅ TO_LOCATION=๋Œ€์ „์—ญ -#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ +#์ƒ์„ฑํ•  ๋ฐฉ์˜ ๊ฐœ์ˆ˜์™€ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ NUM_OF_ROOMS=1 NUM_OF_CHATS=200 -#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) +#๊ฐ ์ฑ„ํŒ… ์‚ฌ์ด์˜ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ; ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) MAXIMUM_INTERVAL_BETWEEN_CHATS=20 #์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) OCCURENCE_OF_JOIN=0.1 OCCURENCE_OF_ABORT=0.1 ``` -1. Edit `index.js` to modify the list of sample users -2. Edit `src/testData.js` to modify maximum time intervals between the chats -3. Generate sample users, rooms, chats by executing `node index.js` +4. `npm start`๋˜๋Š” `node app.js`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. diff --git a/index.js b/index.js index cf3ad9a6..0efe5a33 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ const main = async () => { for (const roomOid of roomOids) { await generateChats(roomOid, numberOfChats); } - console.log("๋!"); + console.log("๋! ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์„ ์ค‘๋‹จํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค."); }; main(); diff --git a/package.json b/package.json index f28cc6d7..425d8078 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "sample generator", "main": "index.js", "scripts": { + "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { From 7e58c62341615b878c4b76b1c7f84a981660f04e Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 13 Apr 2022 00:08:29 +0900 Subject: [PATCH 010/108] Add student ID and email to userSchema --- index.js | 9 +++++---- src/db/mongo.js | 1 + src/testData.js | 12 +++++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 0efe5a33..6aad8255 100644 --- a/index.js +++ b/index.js @@ -13,15 +13,16 @@ const main = async () => { const numberOfChats = security.numberOfChats; const userOids = []; const roomOids = []; - for (const userId of userIds) { - const userOid = await generateUser(userId); + + for (const [index, userId] of userIds.entries()) { + const userOid = await generateUser(userId, index + 1); userOids.push(userOid); } const { fromOid, toOid } = await generateSampleLocations(); - for (const i of Array(numberOfRooms).keys()) { - const roomOid = await generateRoom(fromOid, toOid, i + 1, userOids, 7); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. + for (const index of Array(numberOfRooms).keys()) { + const roomOid = await generateRoom(fromOid, toOid, index + 1, userOids, 7); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. roomOids.push(roomOid); } diff --git a/src/db/mongo.js b/src/db/mongo.js index cc15c1a9..78541a0f 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -17,6 +17,7 @@ const userSchema = Schema({ facebook: { type: String, default: "" }, twitter: { type: String, default: "" }, }, + email: { type: String, required: true }, }); const roomSchema = Schema({ name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ" }, diff --git a/src/testData.js b/src/testData.js index 1134d34d..a5b737a0 100644 --- a/src/testData.js +++ b/src/testData.js @@ -6,14 +6,20 @@ const { } = require("./db/mongo"); const security = require("../security"); -const generateUser = async (id) => { +const generateUser = async (id, num) => { const newUser = new userModel({ + id: id, name: `${id}-name`, nickname: `${id}-nickname`, - id: id, profileImageUrl: "public/profile-images/default/sample.png", //hardcoded - room: [], joinat: Date.now(), + subinfo: { + kaist: new String(20220000 + num), + sparcs: "", + facebook: "", + twitter: "", + }, + email: `${id}@kaist.ac.kr`, }); await newUser.save(); return newUser._id; From 21fff13d13930fc23c75c880d46c74080a2c0cc1 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 26 Apr 2022 23:01:31 +0900 Subject: [PATCH 011/108] Fix not showing user's rooms --- index.js | 4 ++-- src/testData.js | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index 6aad8255..f03ca62c 100644 --- a/index.js +++ b/index.js @@ -22,12 +22,12 @@ const main = async () => { const { fromOid, toOid } = await generateSampleLocations(); for (const index of Array(numberOfRooms).keys()) { - const roomOid = await generateRoom(fromOid, toOid, index + 1, userOids, 7); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. + const roomOid = await generateRoom(fromOid, toOid, index + 1, 7); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. roomOids.push(roomOid); } for (const roomOid of roomOids) { - await generateChats(roomOid, numberOfChats); + await generateChats(roomOid, userOids, numberOfChats); } console.log("๋! ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์„ ์ค‘๋‹จํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค."); }; diff --git a/src/testData.js b/src/testData.js index a5b737a0..1cda77fa 100644 --- a/src/testData.js +++ b/src/testData.js @@ -41,7 +41,7 @@ const generateSampleLocations = async () => { }; }; -const generateRoom = async (from, to, num, users, daysAfter) => { +const generateRoom = async (from, to, num, daysAfter) => { const date = new Date(); date.setDate(date.getDate() + daysAfter); const newRoom = new roomModel({ @@ -49,7 +49,7 @@ const generateRoom = async (from, to, num, users, daysAfter) => { from: from, to: to, time: date, - part: users, + part: [], madeat: Date.now(), }); await newRoom.save(); @@ -78,7 +78,7 @@ const generateJoinAbortChat = async (roomId, user, isJoining, time) => { await newChat.save(); }; -const generateChats = async (roomId, numOfChats) => { +const generateChats = async (roomId, userOids, numOfChats) => { const roomPopulateQuery = [{ path: "part", select: "id name nickname -_id" }]; const room = await roomModel .findById(roomId) @@ -86,7 +86,7 @@ const generateChats = async (roomId, numOfChats) => { .populate(roomPopulateQuery); const userIdsInRoom = []; - const userIdsOutRoom = room.part; + const userIdsOutRoom = userOids; let lastTime = Date.now(); const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds let occurenceOfJoin = security.occurenceOfJoin; //Default: 10% @@ -101,24 +101,40 @@ const generateChats = async (roomId, numOfChats) => { (event < occurenceOfJoin && userIdsOutRoom.length !== 0) ) { // ๋” ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋” ๋“ค์–ด์˜ด + // ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); - const user = userIdsOutRoom[authorIdx]; - await generateJoinAbortChat(roomId, user, true, lastTime); - userIdsInRoom.push(user); + const userOid = userIdsOutRoom[authorIdx]; + + // ์ž…์žฅ ๋ฉ”์‹œ์ง€ ์ƒ์„ฑ + await generateJoinAbortChat(roomId, userOid, true, lastTime); + + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + userIdsInRoom.push(userOid); userIdsOutRoom.splice(authorIdx, 1); + const user = await userModel.findById(userOid, "room"); + user.room.push(roomId); + await user.save(); } else if ( occurenceOfJoin <= event && event < occurenceOfJoin + occurenceOfAbort && userIdsInRoom.length > 1 ) { // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋‚˜๊ฐ + // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); - const user = userIdsInRoom[authorIdx]; - await generateJoinAbortChat(roomId, user, false, lastTime); - userIdsOutRoom.push(user); + const userOid = userIdsInRoom[authorIdx]; + + // ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ƒ์„ฑ + await generateJoinAbortChat(roomId, userOid, false, lastTime); + + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + userIdsOutRoom.push(userOid); userIdsInRoom.splice(authorIdx, 1); + const user = await userModel.findById(userOid, "room"); + user.room.splice(user.room.indexOf(roomId), 1); + await user.save(); } else { - // ๋ฐฉ์ด ๋น„์–ด์žˆ์ง€ ์•Š์„ ๊ฒฝ์šฐ, ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ฆ + // ๋ฐฉ์ด ๋น„์–ด์žˆ์ง€ ์•Š์„ ๊ฒฝ์šฐ, ์ผ๋ฐ˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ฆ if (userIdsInRoom.length !== 0) { const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); const user = userIdsInRoom[authorIdx]; @@ -126,6 +142,8 @@ const generateChats = async (roomId, numOfChats) => { } } } + // ํ˜„์žฌ ์ฐธ์—ฌ์ค‘์ธ ์‚ฌ์šฉ์ž ๊ธฐ์ค€์œผ๋กœ ๋ฐฉ์˜ part ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•จ + room.part = userIdsInRoom; return; }; From a109743e6c31c46bfa265280d06526b41a4d2b17 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 24 May 2022 22:30:32 +0900 Subject: [PATCH 012/108] Fix: update room participants --- src/testData.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/testData.js b/src/testData.js index 1cda77fa..18de5d77 100644 --- a/src/testData.js +++ b/src/testData.js @@ -144,6 +144,7 @@ const generateChats = async (roomId, userOids, numOfChats) => { } // ํ˜„์žฌ ์ฐธ์—ฌ์ค‘์ธ ์‚ฌ์šฉ์ž ๊ธฐ์ค€์œผ๋กœ ๋ฐฉ์˜ part ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•จ room.part = userIdsInRoom; + await room.save(); return; }; From 19cd93368fd05dc73d4c9edd335e5462231a1738 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 24 May 2022 23:08:03 +0900 Subject: [PATCH 013/108] Fix: update outdated schemas --- index.js | 11 +++++++++-- src/db/mongo.js | 24 +++++++++++++++++++++--- src/testData.js | 14 ++++++++------ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index f03ca62c..da1fffad 100644 --- a/index.js +++ b/index.js @@ -15,14 +15,21 @@ const main = async () => { const roomOids = []; for (const [index, userId] of userIds.entries()) { - const userOid = await generateUser(userId, index + 1); + const isAdmin = index === 0; + const userOid = await generateUser(userId, index + 1, isAdmin); userOids.push(userOid); } const { fromOid, toOid } = await generateSampleLocations(); for (const index of Array(numberOfRooms).keys()) { - const roomOid = await generateRoom(fromOid, toOid, index + 1, 7); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. + const roomOid = await generateRoom( + fromOid, + toOid, + index + 1, + 7, + userOids[0] + ); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. roomOids.push(roomOid); } diff --git a/src/db/mongo.js b/src/db/mongo.js index 78541a0f..2e312a29 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -9,8 +9,9 @@ const userSchema = Schema({ profileImageUrl: { type: String, required: true }, //๋ฐฑ์—”๋“œ์—์„œ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ room: [{ type: Schema.Types.ObjectId, ref: "Room" }], //์ฐธ์—ฌ์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด withdraw: { type: Boolean, default: false }, - ban: { type: Boolean, default: false }, - joinat: { type: Date, required: true }, + ban: { type: Boolean, default: false }, //๊ณ„์ • ์ •์ง€ ์—ฌ๋ถ€ + joinat: { type: Date, required: true }, //๊ฐ€์ž… ์‹œ๊ฐ + agreeOnTermsOfService: { type: Boolean, default: false }, //์ด์šฉ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€ subinfo: { kaist: { type: String, default: "" }, sparcs: { type: String, default: "" }, @@ -18,14 +19,31 @@ const userSchema = Schema({ twitter: { type: String, default: "" }, }, email: { type: String, required: true }, + isAdmin: { type: Boolean, default: false }, //๊ด€๋ฆฌ์ž ์—ฌ๋ถ€ }); + +const settlementSchema = Schema({ + studentId: { type: Schema.Types.ObjectId, ref: "User", required: true }, + isSettlement: { type: Boolean, required: true }, +}); + const roomSchema = Schema({ - name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ" }, + name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ", text: true }, from: { type: Schema.Types.ObjectId, ref: "Location", required: true }, to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ part: [{ type: Schema.Types.ObjectId, ref: "User" }], // ์ฐธ์—ฌ ๋ฉค๋ฒ„ madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ + settlement: { + type: [settlementSchema], + default: [ + { + isSettlement: false, + }, + ], + }, + settlementTotal: { type: Number, default: 0, required: true }, + isOver: { type: Boolean, default: false, required: true }, //FIXME: ๊ฒฐ์ œ ์˜ˆ์ •์ž, ์ •์‚ฐ ์—ฌ๋ถ€ (์›นํŽ˜์ด์ง€์—์„œ ์ด๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ฒƒ์ธ์ง€ ์ถ”๊ฐ€ ๋…ผ์˜๊ฐ€ ํ•„์š”ํ•จ) }); const locationSchema = Schema({ diff --git a/src/testData.js b/src/testData.js index 18de5d77..12edbb70 100644 --- a/src/testData.js +++ b/src/testData.js @@ -6,7 +6,7 @@ const { } = require("./db/mongo"); const security = require("../security"); -const generateUser = async (id, num) => { +const generateUser = async (id, num, isAdmin) => { const newUser = new userModel({ id: id, name: `${id}-name`, @@ -20,6 +20,7 @@ const generateUser = async (id, num) => { twitter: "", }, email: `${id}@kaist.ac.kr`, + isAdmin: isAdmin, }); await newUser.save(); return newUser._id; @@ -41,7 +42,7 @@ const generateSampleLocations = async () => { }; }; -const generateRoom = async (from, to, num, daysAfter) => { +const generateRoom = async (from, to, num, daysAfter, creatorId) => { const date = new Date(); date.setDate(date.getDate() + daysAfter); const newRoom = new roomModel({ @@ -51,6 +52,10 @@ const generateRoom = async (from, to, num, daysAfter) => { time: date, part: [], madeat: Date.now(), + settlement: { + studentId: creatorId, + isSettlement: false, + }, }); await newRoom.save(); return newRoom._id; @@ -80,10 +85,7 @@ const generateJoinAbortChat = async (roomId, user, isJoining, time) => { const generateChats = async (roomId, userOids, numOfChats) => { const roomPopulateQuery = [{ path: "part", select: "id name nickname -_id" }]; - const room = await roomModel - .findById(roomId) - .lean() - .populate(roomPopulateQuery); + const room = await roomModel.findById(roomId).populate(roomPopulateQuery); const userIdsInRoom = []; const userIdsOutRoom = userOids; From eaca78b009344fe93511287919a7b797b2f69d8b Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 24 May 2022 23:50:40 +0900 Subject: [PATCH 014/108] Fix: ObjectID to User document --- src/testData.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/testData.js b/src/testData.js index 12edbb70..7d152744 100644 --- a/src/testData.js +++ b/src/testData.js @@ -61,7 +61,8 @@ const generateRoom = async (from, to, num, daysAfter, creatorId) => { return newRoom._id; }; -const generateNormalChat = async (i, roomId, user, time) => { +const generateNormalChat = async (i, roomId, userOid, time) => { + const user = await userModel.findById(userOid); const newChat = new chatModel({ roomId: roomId, authorId: user.id, @@ -72,7 +73,8 @@ const generateNormalChat = async (i, roomId, user, time) => { await newChat.save(); }; -const generateJoinAbortChat = async (roomId, user, isJoining, time) => { +const generateJoinAbortChat = async (roomId, userOid, isJoining, time) => { + const user = await userModel.findById(userOid); const newChat = new chatModel({ roomId: roomId, authorId: null, @@ -88,7 +90,7 @@ const generateChats = async (roomId, userOids, numOfChats) => { const room = await roomModel.findById(roomId).populate(roomPopulateQuery); const userIdsInRoom = []; - const userIdsOutRoom = userOids; + const userIdsOutRoom = userOids.map((userOid) => userOid); let lastTime = Date.now(); const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds let occurenceOfJoin = security.occurenceOfJoin; //Default: 10% From 1265c157d338c2f7fc60cf8966120c6b1aebd8df Mon Sep 17 00:00:00 2001 From: withsang Date: Thu, 28 Jul 2022 03:43:34 +0900 Subject: [PATCH 015/108] Add: randomize location --- index.js | 5 ++--- security.js | 3 +-- src/db/mongo.js | 15 ++++++--------- src/testData.js | 43 +++++++++++++++++++++++++++---------------- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index da1fffad..9108eaba 100644 --- a/index.js +++ b/index.js @@ -20,12 +20,11 @@ const main = async () => { userOids.push(userOid); } - const { fromOid, toOid } = await generateSampleLocations(); + const sampleLocationOids = await generateSampleLocations(security.locations); for (const index of Array(numberOfRooms).keys()) { const roomOid = await generateRoom( - fromOid, - toOid, + sampleLocationOids, index + 1, 7, userOids[0] diff --git a/security.js b/security.js index 003d9db9..9f528e5b 100644 --- a/security.js +++ b/security.js @@ -3,8 +3,7 @@ require("dotenv").config(); module.exports = { mongo: process.env.DB_PATH, users: process.env.USERS.split(", "), - fromLocation: process.env.FROM_LOCATION, - toLocation: process.env.TO_LOCATION, + locations: process.env.LOCATIONS.split(", "), numberOfRooms: parseInt(process.env.NUM_OF_ROOMS), numberOfChats: parseInt(process.env.NUM_OF_CHATS), maximumIntervalBtwChats: parseFloat( diff --git a/src/db/mongo.js b/src/db/mongo.js index 2e312a29..8031ecfc 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -44,6 +44,7 @@ const roomSchema = Schema({ }, settlementTotal: { type: Number, default: 0, required: true }, isOver: { type: Boolean, default: false, required: true }, + maxPartLength: { type: Number, require: true, default: 4 }, //FIXME: ๊ฒฐ์ œ ์˜ˆ์ •์ž, ์ •์‚ฐ ์—ฌ๋ถ€ (์›นํŽ˜์ด์ง€์—์„œ ์ด๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ฒƒ์ธ์ง€ ์ถ”๊ฐ€ ๋…ผ์˜๊ฐ€ ํ•„์š”ํ•จ) }); const locationSchema = Schema({ @@ -66,18 +67,14 @@ const roomModel = mongoose.model("Room", roomSchema); const locationModel = mongoose.model("Location", locationSchema); const chatModel = mongoose.model("Chat", chatSchema); -const initializeDB = () => { - const models = [userModel, roomModel, locationModel, chatModel]; - for (const model of models) { - if (model.collection) { - model.collection.drop(); - } - } +const initializeDB = async () => { + // drop all collections + await mongoose.connection.db.dropDatabase(); }; database.on("error", console.error.bind(console, "mongoose connection error.")); -database.on("open", () => { - initializeDB(); +database.on("open", async () => { + await initializeDB(); console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); }); database.on("error", function (err) { diff --git a/src/testData.js b/src/testData.js index 7d152744..1bf35334 100644 --- a/src/testData.js +++ b/src/testData.js @@ -26,29 +26,39 @@ const generateUser = async (id, num, isAdmin) => { return newUser._id; }; -const generateSampleLocations = async () => { - const newFrom = new locationModel({ - name: security.fromLocation, - }); - const newTo = new locationModel({ - name: security.toLocation, - }); - await newFrom.save(); - await newTo.save(); +const generateSampleLocations = async (locations) => { + if (locations.length === 0) { + console.log("Please provide location(s)!"); + } + + for (const location of locations) { + const locationDocument = new locationModel({ + name: location, + }); + await locationDocument.save(); + } - return { - fromOid: newFrom._id, - toOid: newTo._id, - }; + const locationDocuments = await locationModel.find().lean(); + console.log(locationDocuments.length); + return locationDocuments.map((locationDocument) => locationDocument._id); }; -const generateRoom = async (from, to, num, daysAfter, creatorId) => { +const generateRoom = async (sampleLocationOids, num, daysAfter, creatorId) => { const date = new Date(); date.setDate(date.getDate() + daysAfter); + + let fromIdx = 0; + let toIdx = 0; + + while (fromIdx === toIdx) { + fromIdx = Math.floor(Math.random() * sampleLocationOids.length); + toIdx = Math.floor(Math.random() * sampleLocationOids.length); + } + const newRoom = new roomModel({ name: `test-${num}`, - from: from, - to: to, + from: sampleLocationOids[fromIdx], + to: sampleLocationOids[toIdx], time: date, part: [], madeat: Date.now(), @@ -56,6 +66,7 @@ const generateRoom = async (from, to, num, daysAfter, creatorId) => { studentId: creatorId, isSettlement: false, }, + maxPartLength: 4, }); await newRoom.save(); return newRoom._id; From b5d8f8462e7668fdb44ba9c64aa5e0dc09512f63 Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 3 Aug 2022 23:18:39 +0900 Subject: [PATCH 016/108] Add: Update location model and provide sample data --- index.js | 18 ++++++++++-------- sampleData.json | 42 ++++++++++++++++++++++++++++++++++++++++++ security.js | 7 +++++-- src/db/mongo.js | 17 +++++++++++++++-- src/testData.js | 4 ++-- 5 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 sampleData.json diff --git a/index.js b/index.js index 9108eaba..9b22658c 100644 --- a/index.js +++ b/index.js @@ -5,22 +5,23 @@ const { generateChats, } = require("./src/testData"); -const security = require("./security"); +const { + users, + numberOfRooms, + numberOfChats, + locations, +} = require("./security"); const main = async () => { - const userIds = security.users; - const numberOfRooms = security.numberOfRooms; - const numberOfChats = security.numberOfChats; const userOids = []; const roomOids = []; - for (const [index, userId] of userIds.entries()) { - const isAdmin = index === 0; - const userOid = await generateUser(userId, index + 1, isAdmin); + for (const [index, user] of users.entries()) { + const userOid = await generateUser(user.id, index + 1, user.isAdmin); userOids.push(userOid); } - const sampleLocationOids = await generateSampleLocations(security.locations); + const sampleLocationOids = await generateSampleLocations(locations); for (const index of Array(numberOfRooms).keys()) { const roomOid = await generateRoom( @@ -36,6 +37,7 @@ const main = async () => { await generateChats(roomOid, userOids, numberOfChats); } console.log("๋! ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์„ ์ค‘๋‹จํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค."); + process.exit(0); }; main(); diff --git a/sampleData.json b/sampleData.json new file mode 100644 index 00000000..ac2ed1de --- /dev/null +++ b/sampleData.json @@ -0,0 +1,42 @@ +{ + "users": [ + { + "id": "sunday", + "isAdmin": true + }, + { + "id": "monday", + "isAdmin": true + }, + { + "id": "tuesday", + "isAdmin": true + }, + { + "id": "wednesday", + "isAdmin": true + } + ], + "locations": [ + { + "koName": "ํƒ์‹œ์Šน๊ฐ•์žฅ", + "enName": "Taxi Stand" + }, + { + "koName": "๊ฐค๋Ÿฌ๋ฆฌ์•„ ํƒ€์ž„์›”๋“œ", + "enName": "Galleria Timeworld" + }, + { + "koName": "์„œ๋Œ€์ „์—ญ", + "enName": "Seodaejeon Station" + }, + { + "koName": "๋Œ€์ „์—ญ", + "enName": "Daejeon Station" + }, + { + "koName": "์ •๋ถ€์ฒญ์‚ฌ", + "enName": "Government Complex Daejeon" + } + ] +} diff --git a/security.js b/security.js index 9f528e5b..9514cab3 100644 --- a/security.js +++ b/security.js @@ -1,9 +1,12 @@ require("dotenv").config(); +const fs = require("fs"); +const path = require("path"); +sampleData = JSON.parse(fs.readFileSync(path.resolve(".", "sampleData.json"))); module.exports = { mongo: process.env.DB_PATH, - users: process.env.USERS.split(", "), - locations: process.env.LOCATIONS.split(", "), + users: sampleData.users, + locations: sampleData.locations, numberOfRooms: parseInt(process.env.NUM_OF_ROOMS), numberOfChats: parseInt(process.env.NUM_OF_CHATS), maximumIntervalBtwChats: parseFloat( diff --git a/src/db/mongo.js b/src/db/mongo.js index 8031ecfc..b3741ca4 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -32,7 +32,19 @@ const roomSchema = Schema({ from: { type: Schema.Types.ObjectId, ref: "Location", required: true }, to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ - part: [{ type: Schema.Types.ObjectId, ref: "User" }], // ์ฐธ์—ฌ ๋ฉค๋ฒ„ + part: { + type: [ + { + type: Schema.Types.ObjectId, + ref: "User", + }, + ], + validate: [ + function (value) { + return value.length <= this.maxPartLength; + }, + ], + }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ settlement: { type: [settlementSchema], @@ -48,7 +60,8 @@ const roomSchema = Schema({ //FIXME: ๊ฒฐ์ œ ์˜ˆ์ •์ž, ์ •์‚ฐ ์—ฌ๋ถ€ (์›นํŽ˜์ด์ง€์—์„œ ์ด๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ฒƒ์ธ์ง€ ์ถ”๊ฐ€ ๋…ผ์˜๊ฐ€ ํ•„์š”ํ•จ) }); const locationSchema = Schema({ - name: { type: String, required: true }, + enName: { type: String, required: true }, + koName: { type: String, required: true }, // latitude: { type: Number, required: true }, // longitude: { type: Number, required: true } }); diff --git a/src/testData.js b/src/testData.js index 1bf35334..4a427613 100644 --- a/src/testData.js +++ b/src/testData.js @@ -33,13 +33,13 @@ const generateSampleLocations = async (locations) => { for (const location of locations) { const locationDocument = new locationModel({ - name: location, + koName: location.koName, + enName: location.enName, }); await locationDocument.save(); } const locationDocuments = await locationModel.find().lean(); - console.log(locationDocuments.length); return locationDocuments.map((locationDocument) => locationDocument._id); }; From 14a149265e93ce47094d91f2cfb528ff5004ffa7 Mon Sep 17 00:00:00 2001 From: withsang Date: Thu, 4 Aug 2022 02:23:18 +0900 Subject: [PATCH 017/108] Add: update environment setting docs --- .env.example | 10 ++++++++++ README.md | 15 +++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..e1b82344 --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +#mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) +DB_PATH=mongodb://localhost:27017/local +#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ +NUM_OF_ROOMS=2 +NUM_OF_CHATS=200 +#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) +MAXIMUM_INTERVAL_BETWEEN_CHATS=20 +#์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) +OCCURENCE_OF_JOIN=0.1 +OCCURENCE_OF_ABORT=0.1 \ No newline at end of file diff --git a/README.md b/README.md index 54e340a5..1725c915 100644 --- a/README.md +++ b/README.md @@ -14,20 +14,15 @@ ``` #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) -DB_PATH= -#๋ฐฉ์— ์ฐธ์—ฌํ•˜๋Š” ์‚ฌ์šฉ์ž ๋ชฉ๋ก. ์ฝค๋งˆ๋กœ ๊ตฌ๋ถ„ -USERS="sunday, monday, tuesday, wednesday" -#์ถœ๋ฐœ์ง€์™€ ๋„์ฐฉ์ง€ -FROM_LOCATION=ํƒ์‹œ์Šน๊ฐ•์žฅ -TO_LOCATION=๋Œ€์ „์—ญ -#์ƒ์„ฑํ•  ๋ฐฉ์˜ ๊ฐœ์ˆ˜์™€ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ -NUM_OF_ROOMS=1 +DB_PATH=mongodb://localhost:27017/local +#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ +NUM_OF_ROOMS=2 NUM_OF_CHATS=200 -#๊ฐ ์ฑ„ํŒ… ์‚ฌ์ด์˜ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ; ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) +#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) MAXIMUM_INTERVAL_BETWEEN_CHATS=20 #์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) OCCURENCE_OF_JOIN=0.1 OCCURENCE_OF_ABORT=0.1 ``` -4. `npm start`๋˜๋Š” `node app.js`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +1. `npm start`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. From 89da1d3f4706b38872f6d0e7a8200b0750c21f53 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 9 Aug 2022 02:57:17 +0900 Subject: [PATCH 018/108] Add: update chatSchema --- src/db/mongo.js | 10 ++++++---- src/testData.js | 14 ++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/db/mongo.js b/src/db/mongo.js index b3741ca4..6683f29d 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -66,12 +66,14 @@ const locationSchema = Schema({ // longitude: { type: Number, required: true } }); const chatSchema = Schema({ - roomId: { type: Schema.Types.ObjectId, required: true }, - authorId: { type: String }, // ์ž‘์„ฑ์ž id (null: ์ „์ฒด ๋ฉ”์‹œ์ง€) - authorName: { type: String }, - text: { type: String, default: "" }, + roomId: { type: Schema.Types.ObjectId, ref: "Room", required: true }, + type: { type: String }, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜ (text|in|out|s3img) + authorId: { type: Schema.Types.ObjectId, ref: "User", required: true }, // ์ž‘์„ฑ์ž id + content: { type: String, default: "" }, time: { type: Date, required: true }, + isValid: { type: Boolean, default: true }, }); +chatSchema.index({ roomId: 1, time: -1 }); const database = mongoose.connection; diff --git a/src/testData.js b/src/testData.js index 4a427613..da15ccae 100644 --- a/src/testData.js +++ b/src/testData.js @@ -76,10 +76,11 @@ const generateNormalChat = async (i, roomId, userOid, time) => { const user = await userModel.findById(userOid); const newChat = new chatModel({ roomId: roomId, - authorId: user.id, - authorName: user.nickname, - text: `์•ˆ๋…•ํ•˜์„ธ์š”! (${i}๋ฒˆ์งธ ๋ฉ”์‹œ์ง€)`, + type: "text", + authorId: user._id, + content: `์•ˆ๋…•ํ•˜์„ธ์š”! (${i}๋ฒˆ์งธ ๋ฉ”์‹œ์ง€)`, time: time, + inValid: false, }); await newChat.save(); }; @@ -88,10 +89,11 @@ const generateJoinAbortChat = async (roomId, userOid, isJoining, time) => { const user = await userModel.findById(userOid); const newChat = new chatModel({ roomId: roomId, - authorId: null, - authorName: null, - text: `${user.nickname}๋‹˜์ด ${isJoining ? "์ž…์žฅ" : "ํ‡ด์žฅ"}ํ–ˆ์Šต๋‹ˆ๋‹ค.`, + type: isJoining ? "in" : "out", + authorId: user._id, + content: user.id, time: time, + isValid: false, }); await newChat.save(); }; From 0f4036b7e3a89e54c67b20de97c6ff3af4b2df05 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 9 Aug 2022 20:35:09 +0900 Subject: [PATCH 019/108] Fix: generating proper profile url --- src/testData.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/testData.js b/src/testData.js index da15ccae..c6d049a2 100644 --- a/src/testData.js +++ b/src/testData.js @@ -4,14 +4,40 @@ const { locationModel, chatModel, } = require("./db/mongo"); +const crypto = require("crypto"); const security = require("../security"); +//์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ url๋“ค +const defaultProfile = [ + "CatGeoul.png", + "CatGreen.png", + "CatJabo.png", + "CatOTL.png", + "CatTaxi.png", + "GooseGeoul.png", + "GooseGreen.png", + "GooseJabo.png", + "GooseOTL.png", + "GooseTaxi.png", + "NupjukGeoul.png", + "NupjukGreen.png", + "NupjukJabo.png", + "NupjukOTL.png", + "NupjukTaxi.png", +]; + +// ๊ธฐ์กด ํ”„๋กœํ•„ ์‚ฌ์ง„์˜ URI ์ค‘ ํ•˜๋‚˜๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒํ•ด ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. +const generateProfileImageUrl = () => { + const ridx = crypto.randomInt(defaultProfile.length); + return `default/${defaultProfile[ridx]}`; +}; + const generateUser = async (id, num, isAdmin) => { const newUser = new userModel({ id: id, name: `${id}-name`, nickname: `${id}-nickname`, - profileImageUrl: "public/profile-images/default/sample.png", //hardcoded + profileImageUrl: generateProfileImageUrl(), joinat: Date.now(), subinfo: { kaist: new String(20220000 + num), From d588bc6b3979acc984fbe413f6718015eee2f965 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 9 Aug 2022 21:45:14 +0900 Subject: [PATCH 020/108] Add: dump and restore database --- .gitignore | 3 +++ README.md | 34 +++++++++++++++++++--------------- dump.js | 16 ++++++++++++++++ package.json | 4 +++- restore.js | 19 +++++++++++++++++++ 5 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 dump.js create mode 100644 restore.js diff --git a/.gitignore b/.gitignore index 67045665..147ebc06 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,6 @@ dist # TernJS port file .tern-port + +# MongoDB Dump +dump/ \ No newline at end of file diff --git a/README.md b/README.md index 1725c915..4651dac1 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,24 @@ **SETUP** 1. ๋กœ์ปฌ ์ €์žฅ์†Œ์— ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋ฅผ ํด๋ก ํ•ฉ๋‹ˆ๋‹ค. -2. `npm install`๋กœ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. -3. ํด๋ก ํ•œ ๋””๋ ‰ํ† ๋ฆฌ(index.js๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. - -``` -#mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) -DB_PATH=mongodb://localhost:27017/local -#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ -NUM_OF_ROOMS=2 -NUM_OF_CHATS=200 -#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) -MAXIMUM_INTERVAL_BETWEEN_CHATS=20 -#์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) -OCCURENCE_OF_JOIN=0.1 -OCCURENCE_OF_ABORT=0.1 -``` +1. `npm install`๋กœ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. +1. ํด๋ก ํ•œ ๋””๋ ‰ํ† ๋ฆฌ(index.js๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. + ``` + #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) + DB_PATH=mongodb://localhost:27017/local + #๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ + NUM_OF_ROOMS=2 + NUM_OF_CHATS=200 + #์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) + MAXIMUM_INTERVAL_BETWEEN_CHATS=20 + #์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) + OCCURENCE_OF_JOIN=0.1 + OCCURENCE_OF_ABORT=0.1 + ``` +1. sampleData.json์— ์žฅ์†Œ, ์œ ์ €, ๋ฐฉ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. + javascript `User { "id": "sampleId", ์‚ฌ์šฉ์ž id }` 1. `npm start`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. + +1. `npm run dumpDB`์œผ๋กœ ํ˜„์žฌ DB๋ฅผ ๋คํ”„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +1. `npm run restoreDB`๋กœ ๊ณผ๊ฑฐ DB๋ฅผ ๋คํ”„ ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ๋ณต์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. diff --git a/dump.js b/dump.js new file mode 100644 index 00000000..d1a5e91a --- /dev/null +++ b/dump.js @@ -0,0 +1,16 @@ +const util = require("util"); +const exec = util.promisify(require("child_process").exec); +const security = require("./security"); + +const main = async () => { + const { stdout, stderr } = await exec(`mongodump ${security.mongo}`); + process.exit(0); +}; + +try { + main(); +} catch (_) { + console.log( + "DB ์—ฐ๊ฒฐ ์ฃผ์†Œ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. DB ์—ฐ๊ฒฐ ์ฃผ์†Œ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”." + ); +} diff --git a/package.json b/package.json index 425d8078..2e0d2598 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main": "index.js", "scripts": { "start": "node index.js", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "dumpDB": "node dump.js", + "restoreDB": "node restore.js" }, "repository": { "type": "git", diff --git a/restore.js b/restore.js new file mode 100644 index 00000000..624eb59b --- /dev/null +++ b/restore.js @@ -0,0 +1,19 @@ +const util = require("util"); +const exec = util.promisify(require("child_process").exec); +const security = require("./security"); + +const main = async () => { + const dbName = security.mongo.split("/").pop(); + const { stdout, stderr } = await exec( + `mongorestore ${security.mongo} dump/${dbName}` + ); + process.exit(0); +}; + +try { + main(); +} catch (_) { + console.log( + "DB๋ฅผ ๋คํ”„ํ•ด์˜ฌ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”." + ); +} From bc131be63bb04ba18dde3fc262a40496af7a884f Mon Sep 17 00:00:00 2001 From: withsang Date: Mon, 15 Aug 2022 00:57:43 +0900 Subject: [PATCH 021/108] Refactor: upgrade mongoose version to 6.5.2 --- package-lock.json | 186 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14061525..be6e8ac5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "dotenv": "^16.0.0", "eslint": "^8.9.0", - "mongoose": "^6.2.3" + "mongoose": "^6.5.2" } }, "node_modules/@eslint/eslintrc": { @@ -60,9 +60,9 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" }, "node_modules/@types/node": { - "version": "17.0.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.20.tgz", - "integrity": "sha512-Q15Clj3lZSLnhVA6yKw1G7SQz46DeL9gO1TEgfK1OQGvMdQ6TUWmCeWf1QBUNkw2BDfV52i2YuYd9OF3ZwGhjw==" + "version": "18.7.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.3.tgz", + "integrity": "sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w==" }, "node_modules/@types/webidl-conversions": { "version": "6.1.1", @@ -70,9 +70,9 @@ "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" }, "node_modules/@types/whatwg-url": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz", - "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", "dependencies": { "@types/node": "*", "@types/webidl-conversions": "*" @@ -173,9 +173,9 @@ } }, "node_modules/bson": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.1.tgz", - "integrity": "sha512-I1LQ7Hz5zgwR4QquilLNZwbhPw0Apx7i7X9kGMBTsqPdml/03Q9NBtD9nt/19ahjlphktQImrnderxqpzeVDjw==", + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.5.tgz", + "integrity": "sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==", "dependencies": { "buffer": "^5.6.0" }, @@ -290,9 +290,9 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "node_modules/denque": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", - "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", "engines": { "node": ">=0.10" } @@ -644,9 +644,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" }, "node_modules/is-extglob": { "version": "2.1.1", @@ -694,9 +694,9 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, "node_modules/kareem": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.4.tgz", - "integrity": "sha512-Vcrt8lcpVl0s8ePx634BxwRqmFo+5DcOhlmNadehxreMTIQi/9hOL/B3hZQQbK5DgMS7Lem3xABXV7/S3jy+7g==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz", + "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==" }, "node_modules/levn": { "version": "0.4.1", @@ -733,14 +733,14 @@ } }, "node_modules/mongodb": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.3.1.tgz", - "integrity": "sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", + "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", "dependencies": { - "bson": "^4.6.1", + "bson": "^4.6.5", "denque": "^2.0.1", - "mongodb-connection-string-url": "^2.4.1", - "socks": "^2.6.1" + "mongodb-connection-string-url": "^2.5.2", + "socks": "^2.6.2" }, "engines": { "node": ">=12.9.0" @@ -750,24 +750,24 @@ } }, "node_modules/mongodb-connection-string-url": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.4.2.tgz", - "integrity": "sha512-mZUXF6nUzRWk5J3h41MsPv13ukWlH4jOMSk6astVeoZ1EbdTJyF5I3wxKkvqBAOoVtzLgyEYUvDjrGdcPlKjAw==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", + "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", "dependencies": { "@types/whatwg-url": "^8.2.1", "whatwg-url": "^11.0.0" } }, "node_modules/mongoose": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.3.tgz", - "integrity": "sha512-FxF2D0MGGIw9bAJ57nSyM4Hs4tDHbu6dn9gQwT1J/lxmRB8jfaWWJ3FSJXTmeYlQ6BpyKeIaT8fj6SAX0YMNBA==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.5.2.tgz", + "integrity": "sha512-3CFDrSLtK2qjM1pZeZpLTUyqPRkc11Iuh74ZrwS4IwEJ3K2PqGnmyPLw7ex4Kzu37ujIMp3MAuiBlUjfrcb6hw==", "dependencies": { - "bson": "^4.2.2", - "kareem": "2.3.4", - "mongodb": "4.3.1", - "mpath": "0.8.4", - "mquery": "4.0.2", + "bson": "^4.6.5", + "kareem": "2.4.1", + "mongodb": "4.8.1", + "mpath": "0.9.0", + "mquery": "4.0.3", "ms": "2.1.3", "sift": "16.0.0" }, @@ -780,17 +780,17 @@ } }, "node_modules/mpath": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", - "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", "engines": { "node": ">=4.0.0" } }, "node_modules/mquery": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz", - "integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz", + "integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==", "dependencies": { "debug": "4.x" }, @@ -954,11 +954,11 @@ } }, "node_modules/socks": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz", - "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", + "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", "dependencies": { - "ip": "^1.1.5", + "ip": "^2.0.0", "smart-buffer": "^4.2.0" }, "engines": { @@ -969,7 +969,7 @@ "node_modules/sparse-bitfield": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", "optional": true, "dependencies": { "memory-pager": "^1.0.2" @@ -1147,9 +1147,9 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" }, "@types/node": { - "version": "17.0.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.20.tgz", - "integrity": "sha512-Q15Clj3lZSLnhVA6yKw1G7SQz46DeL9gO1TEgfK1OQGvMdQ6TUWmCeWf1QBUNkw2BDfV52i2YuYd9OF3ZwGhjw==" + "version": "18.7.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.3.tgz", + "integrity": "sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w==" }, "@types/webidl-conversions": { "version": "6.1.1", @@ -1157,9 +1157,9 @@ "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" }, "@types/whatwg-url": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz", - "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", "requires": { "@types/node": "*", "@types/webidl-conversions": "*" @@ -1225,9 +1225,9 @@ } }, "bson": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.1.tgz", - "integrity": "sha512-I1LQ7Hz5zgwR4QquilLNZwbhPw0Apx7i7X9kGMBTsqPdml/03Q9NBtD9nt/19ahjlphktQImrnderxqpzeVDjw==", + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.5.tgz", + "integrity": "sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==", "requires": { "buffer": "^5.6.0" } @@ -1304,9 +1304,9 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "denque": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", - "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==" }, "doctrine": { "version": "3.0.0", @@ -1553,9 +1553,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" }, "is-extglob": { "version": "2.1.1", @@ -1594,9 +1594,9 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, "kareem": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.4.tgz", - "integrity": "sha512-Vcrt8lcpVl0s8ePx634BxwRqmFo+5DcOhlmNadehxreMTIQi/9hOL/B3hZQQbK5DgMS7Lem3xABXV7/S3jy+7g==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz", + "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==" }, "levn": { "version": "0.4.1", @@ -1627,49 +1627,49 @@ } }, "mongodb": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.3.1.tgz", - "integrity": "sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", + "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", "requires": { - "bson": "^4.6.1", + "bson": "^4.6.5", "denque": "^2.0.1", - "mongodb-connection-string-url": "^2.4.1", + "mongodb-connection-string-url": "^2.5.2", "saslprep": "^1.0.3", - "socks": "^2.6.1" + "socks": "^2.6.2" } }, "mongodb-connection-string-url": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.4.2.tgz", - "integrity": "sha512-mZUXF6nUzRWk5J3h41MsPv13ukWlH4jOMSk6astVeoZ1EbdTJyF5I3wxKkvqBAOoVtzLgyEYUvDjrGdcPlKjAw==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", + "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", "requires": { "@types/whatwg-url": "^8.2.1", "whatwg-url": "^11.0.0" } }, "mongoose": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.3.tgz", - "integrity": "sha512-FxF2D0MGGIw9bAJ57nSyM4Hs4tDHbu6dn9gQwT1J/lxmRB8jfaWWJ3FSJXTmeYlQ6BpyKeIaT8fj6SAX0YMNBA==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.5.2.tgz", + "integrity": "sha512-3CFDrSLtK2qjM1pZeZpLTUyqPRkc11Iuh74ZrwS4IwEJ3K2PqGnmyPLw7ex4Kzu37ujIMp3MAuiBlUjfrcb6hw==", "requires": { - "bson": "^4.2.2", - "kareem": "2.3.4", - "mongodb": "4.3.1", - "mpath": "0.8.4", - "mquery": "4.0.2", + "bson": "^4.6.5", + "kareem": "2.4.1", + "mongodb": "4.8.1", + "mpath": "0.9.0", + "mquery": "4.0.3", "ms": "2.1.3", "sift": "16.0.0" } }, "mpath": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", - "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==" + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==" }, "mquery": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz", - "integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz", + "integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==", "requires": { "debug": "4.x" } @@ -1784,18 +1784,18 @@ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" }, "socks": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz", - "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", + "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", "requires": { - "ip": "^1.1.5", + "ip": "^2.0.0", "smart-buffer": "^4.2.0" } }, "sparse-bitfield": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", "optional": true, "requires": { "memory-pager": "^1.0.2" diff --git a/package.json b/package.json index 2e0d2598..a9a22742 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,6 @@ "dependencies": { "dotenv": "^16.0.0", "eslint": "^8.9.0", - "mongoose": "^6.2.3" + "mongoose": "^6.5.2" } } From aa95712306527edd6f9e3ac449d56fdfb040ffb5 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 16 Aug 2022 22:24:58 +0900 Subject: [PATCH 022/108] Fix: fix inconsistency of settlement array --- src/testData.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/testData.js b/src/testData.js index c6d049a2..2cd062bc 100644 --- a/src/testData.js +++ b/src/testData.js @@ -187,6 +187,9 @@ const generateChats = async (roomId, userOids, numOfChats) => { } // ํ˜„์žฌ ์ฐธ์—ฌ์ค‘์ธ ์‚ฌ์šฉ์ž ๊ธฐ์ค€์œผ๋กœ ๋ฐฉ์˜ part ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•จ room.part = userIdsInRoom; + room.settlement = userIdsInRoom.map((userOid) => { + return { studentId: userOid, isSettlement: false }; + }); await room.save(); return; }; From 8d23e3cc935a5e68e7713e851c613f005c5bf980 Mon Sep 17 00:00:00 2001 From: withsang Date: Fri, 19 Aug 2022 23:50:45 +0900 Subject: [PATCH 023/108] Add: separate Socket.io URL environment variable --- dump.js | 3 ++- restore.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dump.js b/dump.js index d1a5e91a..114a787c 100644 --- a/dump.js +++ b/dump.js @@ -4,12 +4,13 @@ const security = require("./security"); const main = async () => { const { stdout, stderr } = await exec(`mongodump ${security.mongo}`); + console.log("dump ๋””๋ ‰ํ† ๋ฆฌ์— ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ๋คํ”„ํ–ˆ์Šต๋‹ˆ๋‹ค."); process.exit(0); }; try { main(); -} catch (_) { +} catch { console.log( "DB ์—ฐ๊ฒฐ ์ฃผ์†Œ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. DB ์—ฐ๊ฒฐ ์ฃผ์†Œ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”." ); diff --git a/restore.js b/restore.js index 624eb59b..257e2b07 100644 --- a/restore.js +++ b/restore.js @@ -7,12 +7,15 @@ const main = async () => { const { stdout, stderr } = await exec( `mongorestore ${security.mongo} dump/${dbName}` ); + console.log( + "dump ๋””๋ ‰ํ† ๋ฆฌ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ๋ณต์›ํ–ˆ์Šต๋‹ˆ๋‹ค." + ); process.exit(0); }; try { main(); -} catch (_) { +} catch { console.log( "DB๋ฅผ ๋คํ”„ํ•ด์˜ฌ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”." ); From 50ad05bb524d1c75b22dc241035f3a81f975e723 Mon Sep 17 00:00:00 2001 From: withsang Date: Sat, 20 Aug 2022 00:26:05 +0900 Subject: [PATCH 024/108] Refactor: edit roomSchama and corresponding ft.s --- package.json | 4 +- src/db/mongo.js | 30 +++++-------- src/testData.js | 81 ++++++++++++++++++++-------------- dump.js => tools/dump.js | 7 ++- restore.js => tools/restore.js | 5 ++- 5 files changed, 70 insertions(+), 57 deletions(-) rename dump.js => tools/dump.js (68%) rename restore.js => tools/restore.js (79%) diff --git a/package.json b/package.json index a9a22742..67401bdf 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1", - "dumpDB": "node dump.js", - "restoreDB": "node restore.js" + "dumpDB": "node tools/dump.js", + "restoreDB": "node tools/restore.js" }, "repository": { "type": "git", diff --git a/src/db/mongo.js b/src/db/mongo.js index 6683f29d..fea188bf 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -22,9 +22,14 @@ const userSchema = Schema({ isAdmin: { type: Boolean, default: false }, //๊ด€๋ฆฌ์ž ์—ฌ๋ถ€ }); -const settlementSchema = Schema({ - studentId: { type: Schema.Types.ObjectId, ref: "User", required: true }, - isSettlement: { type: Boolean, required: true }, +const participantSchema = Schema({ + user: { type: Schema.Types.ObjectId, ref: "User", required: true }, + settlementStatus: { + type: String, + required: true, + enum: ["not-departed", "paid", "send-required", "sent"], + default: "not-departed", + }, }); const roomSchema = Schema({ @@ -33,32 +38,19 @@ const roomSchema = Schema({ to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ part: { - type: [ - { - type: Schema.Types.ObjectId, - ref: "User", - }, - ], + type: [participantSchema], validate: [ function (value) { return value.length <= this.maxPartLength; }, ], - }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ + }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ ๋ฐ ์ •์‚ฐ ์—ฌ๋ถ€ madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ - settlement: { - type: [settlementSchema], - default: [ - { - isSettlement: false, - }, - ], - }, settlementTotal: { type: Number, default: 0, required: true }, isOver: { type: Boolean, default: false, required: true }, maxPartLength: { type: Number, require: true, default: 4 }, - //FIXME: ๊ฒฐ์ œ ์˜ˆ์ •์ž, ์ •์‚ฐ ์—ฌ๋ถ€ (์›นํŽ˜์ด์ง€์—์„œ ์ด๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ฒƒ์ธ์ง€ ์ถ”๊ฐ€ ๋…ผ์˜๊ฐ€ ํ•„์š”ํ•จ) }); + const locationSchema = Schema({ enName: { type: String, required: true }, koName: { type: String, required: true }, diff --git a/src/testData.js b/src/testData.js index 2cd062bc..0dff45b2 100644 --- a/src/testData.js +++ b/src/testData.js @@ -86,18 +86,44 @@ const generateRoom = async (sampleLocationOids, num, daysAfter, creatorId) => { from: sampleLocationOids[fromIdx], to: sampleLocationOids[toIdx], time: date, - part: [], + part: [{ user: creatorId }], madeat: Date.now(), - settlement: { - studentId: creatorId, - isSettlement: false, - }, maxPartLength: 4, }); await newRoom.save(); return newRoom._id; }; +const joinUserToRoom = async (userIdsInRoom, userIdsOutRoom, roomId) => { + // ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ + const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); + const userOid = userIdsOutRoom[authorIdx]; + + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + userIdsInRoom.push(userOid); + userIdsOutRoom.splice(authorIdx, 1); + const user = await userModel.findById(userOid, "room"); + user.room.push(roomId); + await user.save(); + + return { userIdsInRoom, userIdsOutRoom, userOid }; +}; + +const abortUserfromRoom = async (userIdsInRoom, userIdsOutRoom, roomId) => { + // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ + const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); + const userOid = userIdsInRoom[authorIdx]; + + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + userIdsOutRoom.push(userOid); + userIdsInRoom.splice(authorIdx, 1); + const user = await userModel.findById(userOid, "room"); + user.room.splice(user.room.indexOf(roomId), 1); + await user.save(); + + return { userIdsInRoom, userIdsOutRoom, userOid }; +}; + const generateNormalChat = async (i, roomId, userOid, time) => { const user = await userModel.findById(userOid); const newChat = new chatModel({ @@ -128,8 +154,8 @@ const generateChats = async (roomId, userOids, numOfChats) => { const roomPopulateQuery = [{ path: "part", select: "id name nickname -_id" }]; const room = await roomModel.findById(roomId).populate(roomPopulateQuery); - const userIdsInRoom = []; - const userIdsOutRoom = userOids.map((userOid) => userOid); + let userIdsInRoom = []; + let userIdsOutRoom = userOids.map((userOid) => userOid); let lastTime = Date.now(); const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds let occurenceOfJoin = security.occurenceOfJoin; //Default: 10% @@ -144,38 +170,30 @@ const generateChats = async (roomId, userOids, numOfChats) => { (event < occurenceOfJoin && userIdsOutRoom.length !== 0) ) { // ๋” ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋” ๋“ค์–ด์˜ด - // ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ - const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); - const userOid = userIdsOutRoom[authorIdx]; - + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + let userOid; + ({ userIdsInRoom, userIdsOutRoom, userOid } = await joinUserToRoom( + userIdsInRoom, + userIdsOutRoom, + roomId + )); // ์ž…์žฅ ๋ฉ”์‹œ์ง€ ์ƒ์„ฑ await generateJoinAbortChat(roomId, userOid, true, lastTime); - - // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  - userIdsInRoom.push(userOid); - userIdsOutRoom.splice(authorIdx, 1); - const user = await userModel.findById(userOid, "room"); - user.room.push(roomId); - await user.save(); } else if ( occurenceOfJoin <= event && event < occurenceOfJoin + occurenceOfAbort && userIdsInRoom.length > 1 ) { // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋‚˜๊ฐ - // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ - const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); - const userOid = userIdsInRoom[authorIdx]; - + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + let userOid; + ({ userIdsInRoom, userIdsOutRoom, userOid } = await abortUserfromRoom( + userIdsInRoom, + userIdsOutRoom, + roomId + )); // ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ƒ์„ฑ await generateJoinAbortChat(roomId, userOid, false, lastTime); - - // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  - userIdsOutRoom.push(userOid); - userIdsInRoom.splice(authorIdx, 1); - const user = await userModel.findById(userOid, "room"); - user.room.splice(user.room.indexOf(roomId), 1); - await user.save(); } else { // ๋ฐฉ์ด ๋น„์–ด์žˆ์ง€ ์•Š์„ ๊ฒฝ์šฐ, ์ผ๋ฐ˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ฆ if (userIdsInRoom.length !== 0) { @@ -186,9 +204,8 @@ const generateChats = async (roomId, userOids, numOfChats) => { } } // ํ˜„์žฌ ์ฐธ์—ฌ์ค‘์ธ ์‚ฌ์šฉ์ž ๊ธฐ์ค€์œผ๋กœ ๋ฐฉ์˜ part ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•จ - room.part = userIdsInRoom; - room.settlement = userIdsInRoom.map((userOid) => { - return { studentId: userOid, isSettlement: false }; + room.part = userIdsInRoom.map((userOid) => { + return { user: userOid }; }); await room.save(); return; diff --git a/dump.js b/tools/dump.js similarity index 68% rename from dump.js rename to tools/dump.js index 114a787c..544f2cfd 100644 --- a/dump.js +++ b/tools/dump.js @@ -1,9 +1,12 @@ const util = require("util"); +const path = require("path"); const exec = util.promisify(require("child_process").exec); -const security = require("./security"); +const security = require("../security"); const main = async () => { - const { stdout, stderr } = await exec(`mongodump ${security.mongo}`); + const { stdout, stderr } = await exec( + `mongodump ${security.mongo} --out ${path.resolve("dump")}` + ); console.log("dump ๋””๋ ‰ํ† ๋ฆฌ์— ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ๋คํ”„ํ–ˆ์Šต๋‹ˆ๋‹ค."); process.exit(0); }; diff --git a/restore.js b/tools/restore.js similarity index 79% rename from restore.js rename to tools/restore.js index 257e2b07..f5e8c977 100644 --- a/restore.js +++ b/tools/restore.js @@ -1,11 +1,12 @@ const util = require("util"); +const path = require("path"); const exec = util.promisify(require("child_process").exec); -const security = require("./security"); +const security = require("../security"); const main = async () => { const dbName = security.mongo.split("/").pop(); const { stdout, stderr } = await exec( - `mongorestore ${security.mongo} dump/${dbName}` + `mongorestore ${security.mongo} ${path.resolve("dump")}` ); console.log( "dump ๋””๋ ‰ํ† ๋ฆฌ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ๋ณต์›ํ–ˆ์Šต๋‹ˆ๋‹ค." From 98efa66f31658fb8f621f17c91cd4ba15ee345dc Mon Sep 17 00:00:00 2001 From: withsang Date: Sun, 4 Sep 2022 01:49:16 +0900 Subject: [PATCH 025/108] Fix: replace readFileSync --- index.js | 9 +++------ security.js | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 9b22658c..8edd94e6 100644 --- a/index.js +++ b/index.js @@ -5,14 +5,11 @@ const { generateChats, } = require("./src/testData"); -const { - users, - numberOfRooms, - numberOfChats, - locations, -} = require("./security"); +const { loadSampleData, numberOfRooms, numberOfChats } = require("./security"); const main = async () => { + const { users, locations } = await Promise.resolve(loadSampleData); + const userOids = []; const roomOids = []; diff --git a/security.js b/security.js index 9514cab3..ac43ea8e 100644 --- a/security.js +++ b/security.js @@ -1,12 +1,21 @@ require("dotenv").config(); const fs = require("fs"); const path = require("path"); -sampleData = JSON.parse(fs.readFileSync(path.resolve(".", "sampleData.json"))); +const sampleDataPath = path.resolve(".", "sampleData.json"); + +const loadSampleData = new Promise((resolve, reject) => { + fs.readFile(sampleDataPath, (err, data) => { + if (err) { + reject(err); + } else { + resolve(JSON.parse(data)); + } + }); +}); module.exports = { + loadSampleData, mongo: process.env.DB_PATH, - users: sampleData.users, - locations: sampleData.locations, numberOfRooms: parseInt(process.env.NUM_OF_ROOMS), numberOfChats: parseInt(process.env.NUM_OF_CHATS), maximumIntervalBtwChats: parseFloat( From 090baf8cb7e3f5ac19e06c30b175bcefb3aa2a9c Mon Sep 17 00:00:00 2001 From: withsang Date: Sat, 22 Oct 2022 23:30:39 +0900 Subject: [PATCH 026/108] Remove: remove isOver attribute from roomSchema --- src/db/mongo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/db/mongo.js b/src/db/mongo.js index fea188bf..d527b731 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -47,7 +47,6 @@ const roomSchema = Schema({ }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ ๋ฐ ์ •์‚ฐ ์—ฌ๋ถ€ madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ settlementTotal: { type: Number, default: 0, required: true }, - isOver: { type: Boolean, default: false, required: true }, maxPartLength: { type: Number, require: true, default: 4 }, }); From 4ee98ec3a2e0f3810f07aa07df8f0e1801eb1a89 Mon Sep 17 00:00:00 2001 From: withsang Date: Sat, 22 Oct 2022 23:51:44 +0900 Subject: [PATCH 027/108] Fix: restore room.isDone --- src/db/mongo.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db/mongo.js b/src/db/mongo.js index d527b731..fea188bf 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -47,6 +47,7 @@ const roomSchema = Schema({ }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ ๋ฐ ์ •์‚ฐ ์—ฌ๋ถ€ madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ settlementTotal: { type: Number, default: 0, required: true }, + isOver: { type: Boolean, default: false, required: true }, maxPartLength: { type: Number, require: true, default: 4 }, }); From 4bc03650d68859c0d086fbfff55606c6c270a672 Mon Sep 17 00:00:00 2001 From: withsang Date: Sun, 23 Oct 2022 03:23:43 +0900 Subject: [PATCH 028/108] Add: Separate user.room into ongoingRoom & doneRoom --- src/db/mongo.js | 3 ++- src/testData.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/db/mongo.js b/src/db/mongo.js index fea188bf..12c4aacb 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -7,7 +7,8 @@ const userSchema = Schema({ nickname: { type: String, required: true }, //๋‹‰๋„ค์ž„ id: { type: String, required: true, unique: true }, //ํƒ์‹œ ์„œ๋น„์Šค์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” id profileImageUrl: { type: String, required: true }, //๋ฐฑ์—”๋“œ์—์„œ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ - room: [{ type: Schema.Types.ObjectId, ref: "Room" }], //์ฐธ์—ฌ์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด + ongoingRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด + doneRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์™„๋ฃŒ๋œ ๋ฐฉ ๋ฐฐ์—ด withdraw: { type: Boolean, default: false }, ban: { type: Boolean, default: false }, //๊ณ„์ • ์ •์ง€ ์—ฌ๋ถ€ joinat: { type: Date, required: true }, //๊ฐ€์ž… ์‹œ๊ฐ diff --git a/src/testData.js b/src/testData.js index 0dff45b2..c7bf83a2 100644 --- a/src/testData.js +++ b/src/testData.js @@ -102,8 +102,8 @@ const joinUserToRoom = async (userIdsInRoom, userIdsOutRoom, roomId) => { // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  userIdsInRoom.push(userOid); userIdsOutRoom.splice(authorIdx, 1); - const user = await userModel.findById(userOid, "room"); - user.room.push(roomId); + const user = await userModel.findById(userOid, "ongoingRoom"); + user.ongoingRoom.push(roomId); await user.save(); return { userIdsInRoom, userIdsOutRoom, userOid }; @@ -117,8 +117,8 @@ const abortUserfromRoom = async (userIdsInRoom, userIdsOutRoom, roomId) => { // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  userIdsOutRoom.push(userOid); userIdsInRoom.splice(authorIdx, 1); - const user = await userModel.findById(userOid, "room"); - user.room.splice(user.room.indexOf(roomId), 1); + const user = await userModel.findById(userOid, "ongoingRoom"); + user.ongoingRoom.splice(user.ongoingRoom.indexOf(roomId), 1); await user.save(); return { userIdsInRoom, userIdsOutRoom, userOid }; From b66d0b4cc66715a829e0427ecaa2ef350b20e481 Mon Sep 17 00:00:00 2001 From: imYourChoi Date: Tue, 8 Nov 2022 23:44:58 +0900 Subject: [PATCH 029/108] Add: location --- sampleData.json | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/sampleData.json b/sampleData.json index ac2ed1de..aedacff4 100644 --- a/sampleData.json +++ b/sampleData.json @@ -22,21 +22,53 @@ "koName": "ํƒ์‹œ์Šน๊ฐ•์žฅ", "enName": "Taxi Stand" }, + { + "koName": "๋Œ€์ „์—ญ", + "enName": "Daejeon Station" + }, { "koName": "๊ฐค๋Ÿฌ๋ฆฌ์•„ ํƒ€์ž„์›”๋“œ", "enName": "Galleria Timeworld" }, + { + "koName": "๊ถ๋™ ๋กœ๋ฐ์˜ค๊ฑฐ๋ฆฌ", + "enName": "Gung-dong Rodeo Street " + }, + { + "koName": "๋Œ€์ „๋ณตํ•ฉํ„ฐ๋ฏธ๋„", + "enName": "Daejeon Terminal Complex" + }, { "koName": "์„œ๋Œ€์ „์—ญ", "enName": "Seodaejeon Station" }, { - "koName": "๋Œ€์ „์—ญ", - "enName": "Daejeon Station" + "koName": "์‹ ์„ธ๊ณ„๋ฐฑํ™”์ ", + "enName": "Shinsegae Department Store" + }, + { + "koName": "์˜ค๋ฆฌ์—ฐ๋ชป", + "enName": "Duck Pond" + }, + { + "koName": "์›”ํ‰์—ญ", + "enName": "Wolpyeong Station" + }, + { + "koName": "์œ ์„ฑ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Yuseong Express Bus Terminal" + }, + { + "koName": "์œ ์„ฑ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Yuseong Intercity Bus Terminal" + }, + { + "koName": "๋Œ€์ „์ฒญ์‚ฌ ๊ณ ์†ํ„ฐ๋ฏธ๋„", + "enName": "Government Complex Express Bus Terminal" }, { - "koName": "์ •๋ถ€์ฒญ์‚ฌ", - "enName": "Government Complex Daejeon" + "koName": "๋Œ€์ „์ฒญ์‚ฌ ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Government Complex Intercity Bus Terminal" } ] } From 9397c730698a0f803c4bf8857bbffda48477409f Mon Sep 17 00:00:00 2001 From: imYourChoi Date: Tue, 8 Nov 2022 23:47:01 +0900 Subject: [PATCH 030/108] Remove: white space --- sampleData.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sampleData.json b/sampleData.json index aedacff4..f889a1b1 100644 --- a/sampleData.json +++ b/sampleData.json @@ -32,7 +32,7 @@ }, { "koName": "๊ถ๋™ ๋กœ๋ฐ์˜ค๊ฑฐ๋ฆฌ", - "enName": "Gung-dong Rodeo Street " + "enName": "Gung-dong Rodeo Street" }, { "koName": "๋Œ€์ „๋ณตํ•ฉํ„ฐ๋ฏธ๋„", From cd9a1e3c29f596ac2f65c7bd52fb2a5c071c525d Mon Sep 17 00:00:00 2001 From: imYourChoi Date: Wed, 9 Nov 2022 22:05:27 +0900 Subject: [PATCH 031/108] Fix: location name --- sampleData.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sampleData.json b/sampleData.json index f889a1b1..4887bf46 100644 --- a/sampleData.json +++ b/sampleData.json @@ -55,15 +55,15 @@ "enName": "Wolpyeong Station" }, { - "koName": "์œ ์„ฑ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "koName": "์œ ์„ฑ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", "enName": "Yuseong Express Bus Terminal" }, { - "koName": "์œ ์„ฑ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "koName": "์œ ์„ฑ ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", "enName": "Yuseong Intercity Bus Terminal" }, { - "koName": "๋Œ€์ „์ฒญ์‚ฌ ๊ณ ์†ํ„ฐ๋ฏธ๋„", + "koName": "๋Œ€์ „์ฒญ์‚ฌ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", "enName": "Government Complex Express Bus Terminal" }, { From 0fbd761ece047791bad88b19400e06133f2f598a Mon Sep 17 00:00:00 2001 From: imYourChoi Date: Fri, 11 Nov 2022 14:39:08 +0900 Subject: [PATCH 032/108] Add: location --- sampleData.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sampleData.json b/sampleData.json index 4887bf46..eaa4f44a 100644 --- a/sampleData.json +++ b/sampleData.json @@ -38,6 +38,10 @@ "koName": "๋Œ€์ „๋ณตํ•ฉํ„ฐ๋ฏธ๋„", "enName": "Daejeon Terminal Complex" }, + { + "koName": "๋งŒ๋…„์ค‘ํ•™๊ต", + "enName": "Mannyon Middle School" + }, { "koName": "์„œ๋Œ€์ „์—ญ", "enName": "Seodaejeon Station" @@ -54,6 +58,10 @@ "koName": "์›”ํ‰์—ญ", "enName": "Wolpyeong Station" }, + { + "koName": "์œ ์„ฑ๊ตฌ์ฒญ", + "enName": "Yuseong-gu Office" + }, { "koName": "์œ ์„ฑ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", "enName": "Yuseong Express Bus Terminal" From ffaa0c7a4851814ef92709464995bff7d1356dae Mon Sep 17 00:00:00 2001 From: chlehdwon Date: Wed, 16 Nov 2022 22:11:16 +0900 Subject: [PATCH 033/108] Refactor: change parameters to default value --- .env.example | 8 -------- index.js | 4 +++- security.js | 7 ------- src/testData.js | 7 +++---- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/.env.example b/.env.example index e1b82344..450bc5cf 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,2 @@ #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) DB_PATH=mongodb://localhost:27017/local -#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ -NUM_OF_ROOMS=2 -NUM_OF_CHATS=200 -#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) -MAXIMUM_INTERVAL_BETWEEN_CHATS=20 -#์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) -OCCURENCE_OF_JOIN=0.1 -OCCURENCE_OF_ABORT=0.1 \ No newline at end of file diff --git a/index.js b/index.js index 8edd94e6..9965a27a 100644 --- a/index.js +++ b/index.js @@ -5,10 +5,12 @@ const { generateChats, } = require("./src/testData"); -const { loadSampleData, numberOfRooms, numberOfChats } = require("./security"); +const { loadSampleData } = require("./security"); const main = async () => { const { users, locations } = await Promise.resolve(loadSampleData); + const numberOfRooms = 2; + const numberOfChats = 200; const userOids = []; const roomOids = []; diff --git a/security.js b/security.js index ac43ea8e..6dd17260 100644 --- a/security.js +++ b/security.js @@ -16,11 +16,4 @@ const loadSampleData = new Promise((resolve, reject) => { module.exports = { loadSampleData, mongo: process.env.DB_PATH, - numberOfRooms: parseInt(process.env.NUM_OF_ROOMS), - numberOfChats: parseInt(process.env.NUM_OF_CHATS), - maximumIntervalBtwChats: parseFloat( - process.env.MAXIMUM_INTERVAL_BETWEEN_CHATS - ), - occurenceOfJoin: parseFloat(process.env.OCCURENCE_OF_JOIN), - occurenceOfAbort: parseFloat(process.env.OCCURENCE_OF_ABORT), }; diff --git a/src/testData.js b/src/testData.js index c7bf83a2..f21cec8c 100644 --- a/src/testData.js +++ b/src/testData.js @@ -5,7 +5,6 @@ const { chatModel, } = require("./db/mongo"); const crypto = require("crypto"); -const security = require("../security"); //์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ url๋“ค const defaultProfile = [ @@ -157,9 +156,9 @@ const generateChats = async (roomId, userOids, numOfChats) => { let userIdsInRoom = []; let userIdsOutRoom = userOids.map((userOid) => userOid); let lastTime = Date.now(); - const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds - let occurenceOfJoin = security.occurenceOfJoin; //Default: 10% - let occurenceOfAbort = security.occurenceOfAbort; //Default: 10%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 20% + const maximumIntervalBtwChats = 1000 * 20; //Default: 20,000 milliseconds + const occurenceOfJoin = 0.1; //Default: 10% + const occurenceOfAbort = 0.1; //Default: 10%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 20% for (const i of Array(numOfChats).keys()) { lastTime += Math.floor(Math.random() * maximumIntervalBtwChats); From 02fea924014b9a58c489a26f603d764bc832da67 Mon Sep 17 00:00:00 2001 From: chlehdwon Date: Sun, 20 Nov 2022 20:53:29 +0900 Subject: [PATCH 034/108] Refactor: set parameters to default values if undefined --- .env.example | 8 ++++++++ index.js | 4 +--- security.js | 7 +++++++ src/testData.js | 7 ++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 450bc5cf..e1b82344 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,10 @@ #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) DB_PATH=mongodb://localhost:27017/local +#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ +NUM_OF_ROOMS=2 +NUM_OF_CHATS=200 +#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) +MAXIMUM_INTERVAL_BETWEEN_CHATS=20 +#์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) +OCCURENCE_OF_JOIN=0.1 +OCCURENCE_OF_ABORT=0.1 \ No newline at end of file diff --git a/index.js b/index.js index 9965a27a..8edd94e6 100644 --- a/index.js +++ b/index.js @@ -5,12 +5,10 @@ const { generateChats, } = require("./src/testData"); -const { loadSampleData } = require("./security"); +const { loadSampleData, numberOfRooms, numberOfChats } = require("./security"); const main = async () => { const { users, locations } = await Promise.resolve(loadSampleData); - const numberOfRooms = 2; - const numberOfChats = 200; const userOids = []; const roomOids = []; diff --git a/security.js b/security.js index 6dd17260..9aed0268 100644 --- a/security.js +++ b/security.js @@ -16,4 +16,11 @@ const loadSampleData = new Promise((resolve, reject) => { module.exports = { loadSampleData, mongo: process.env.DB_PATH, + numberOfRooms: parseInt(process.env.NUM_OF_ROOMS ?? 2), + numberOfChats: parseInt(process.env.NUM_OF_CHATS ?? 200), + maximumIntervalBtwChats: parseFloat( + process.env.MAXIMUM_INTERVAL_BETWEEN_CHATS ?? 20 + ), + occurenceOfJoin: parseFloat(process.env.OCCURENCE_OF_JOIN ?? 0.1), + occurenceOfAbort: parseFloat(process.env.OCCURENCE_OF_ABORT ?? 0.1), }; diff --git a/src/testData.js b/src/testData.js index f21cec8c..dd8ecc9f 100644 --- a/src/testData.js +++ b/src/testData.js @@ -5,6 +5,7 @@ const { chatModel, } = require("./db/mongo"); const crypto = require("crypto"); +const security = require("../security"); //์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ url๋“ค const defaultProfile = [ @@ -156,9 +157,9 @@ const generateChats = async (roomId, userOids, numOfChats) => { let userIdsInRoom = []; let userIdsOutRoom = userOids.map((userOid) => userOid); let lastTime = Date.now(); - const maximumIntervalBtwChats = 1000 * 20; //Default: 20,000 milliseconds - const occurenceOfJoin = 0.1; //Default: 10% - const occurenceOfAbort = 0.1; //Default: 10%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 20% + const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds + const occurenceOfJoin = security.occurenceOfJoin; //Default: 10% + const occurenceOfAbort = security.occurenceOfAbort; //Default: 10%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 20% for (const i of Array(numOfChats).keys()) { lastTime += Math.floor(Math.random() * maximumIntervalBtwChats); From a47ef01d11172e5b9b11245de748700284d802d0 Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 23 Nov 2022 01:12:21 +0900 Subject: [PATCH 035/108] Fix: fix DB not initialized --- index.js | 7 +++- src/db/model.js | 80 +++++++++++++++++++++++++++++++++++++++++++ src/db/mongo.js | 90 +++---------------------------------------------- src/testData.js | 2 +- 4 files changed, 92 insertions(+), 87 deletions(-) create mode 100644 src/db/model.js diff --git a/index.js b/index.js index 8edd94e6..9f5a6a46 100644 --- a/index.js +++ b/index.js @@ -5,9 +5,13 @@ const { generateChats, } = require("./src/testData"); +const mongoose = require("./src/db/mongo"); + const { loadSampleData, numberOfRooms, numberOfChats } = require("./security"); const main = async () => { + await mongoose.connection.db.dropDatabase(); + const { users, locations } = await Promise.resolve(loadSampleData); const userOids = []; @@ -37,4 +41,5 @@ const main = async () => { process.exit(0); }; -main(); +const database = mongoose.connection; +database.on("open", main); diff --git a/src/db/model.js b/src/db/model.js new file mode 100644 index 00000000..d07e5fa4 --- /dev/null +++ b/src/db/model.js @@ -0,0 +1,80 @@ +const mongoose = require("./mongo"); +const Schema = mongoose.Schema; + +const userSchema = Schema({ + name: { type: String, required: true }, //์‹ค๋ช… + nickname: { type: String, required: true }, //๋‹‰๋„ค์ž„ + id: { type: String, required: true, unique: true }, //ํƒ์‹œ ์„œ๋น„์Šค์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” id + profileImageUrl: { type: String, required: true }, //๋ฐฑ์—”๋“œ์—์„œ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ + ongoingRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด + doneRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์™„๋ฃŒ๋œ ๋ฐฉ ๋ฐฐ์—ด + withdraw: { type: Boolean, default: false }, + ban: { type: Boolean, default: false }, //๊ณ„์ • ์ •์ง€ ์—ฌ๋ถ€ + joinat: { type: Date, required: true }, //๊ฐ€์ž… ์‹œ๊ฐ + agreeOnTermsOfService: { type: Boolean, default: false }, //์ด์šฉ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€ + subinfo: { + kaist: { type: String, default: "" }, + sparcs: { type: String, default: "" }, + facebook: { type: String, default: "" }, + twitter: { type: String, default: "" }, + }, + email: { type: String, required: true }, + isAdmin: { type: Boolean, default: false }, //๊ด€๋ฆฌ์ž ์—ฌ๋ถ€ +}); + +const participantSchema = Schema({ + user: { type: Schema.Types.ObjectId, ref: "User", required: true }, + settlementStatus: { + type: String, + required: true, + enum: ["not-departed", "paid", "send-required", "sent"], + default: "not-departed", + }, +}); + +const roomSchema = Schema({ + name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ", text: true }, + from: { type: Schema.Types.ObjectId, ref: "Location", required: true }, + to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, + time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ + part: { + type: [participantSchema], + validate: [ + function (value) { + return value.length <= this.maxPartLength; + }, + ], + }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ ๋ฐ ์ •์‚ฐ ์—ฌ๋ถ€ + madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ + settlementTotal: { type: Number, default: 0, required: true }, + isOver: { type: Boolean, default: false, required: true }, + maxPartLength: { type: Number, require: true, default: 4 }, +}); + +const locationSchema = Schema({ + enName: { type: String, required: true }, + koName: { type: String, required: true }, + // latitude: { type: Number, required: true }, + // longitude: { type: Number, required: true } +}); +const chatSchema = Schema({ + roomId: { type: Schema.Types.ObjectId, ref: "Room", required: true }, + type: { type: String }, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜ (text|in|out|s3img) + authorId: { type: Schema.Types.ObjectId, ref: "User", required: true }, // ์ž‘์„ฑ์ž id + content: { type: String, default: "" }, + time: { type: Date, required: true }, + isValid: { type: Boolean, default: true }, +}); +chatSchema.index({ roomId: 1, time: -1 }); + +const userModel = mongoose.model("User", userSchema); +const roomModel = mongoose.model("Room", roomSchema); +const locationModel = mongoose.model("Location", locationSchema); +const chatModel = mongoose.model("Chat", chatSchema); + +module.exports = { + userModel, + roomModel, + locationModel, + chatModel, +}; diff --git a/src/db/mongo.js b/src/db/mongo.js index 12c4aacb..b1ef7bbd 100644 --- a/src/db/mongo.js +++ b/src/db/mongo.js @@ -1,94 +1,19 @@ const mongoose = require("mongoose"); -const Schema = mongoose.Schema; const security = require("../../security"); -const userSchema = Schema({ - name: { type: String, required: true }, //์‹ค๋ช… - nickname: { type: String, required: true }, //๋‹‰๋„ค์ž„ - id: { type: String, required: true, unique: true }, //ํƒ์‹œ ์„œ๋น„์Šค์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” id - profileImageUrl: { type: String, required: true }, //๋ฐฑ์—”๋“œ์—์„œ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ - ongoingRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด - doneRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์™„๋ฃŒ๋œ ๋ฐฉ ๋ฐฐ์—ด - withdraw: { type: Boolean, default: false }, - ban: { type: Boolean, default: false }, //๊ณ„์ • ์ •์ง€ ์—ฌ๋ถ€ - joinat: { type: Date, required: true }, //๊ฐ€์ž… ์‹œ๊ฐ - agreeOnTermsOfService: { type: Boolean, default: false }, //์ด์šฉ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€ - subinfo: { - kaist: { type: String, default: "" }, - sparcs: { type: String, default: "" }, - facebook: { type: String, default: "" }, - twitter: { type: String, default: "" }, - }, - email: { type: String, required: true }, - isAdmin: { type: Boolean, default: false }, //๊ด€๋ฆฌ์ž ์—ฌ๋ถ€ -}); - -const participantSchema = Schema({ - user: { type: Schema.Types.ObjectId, ref: "User", required: true }, - settlementStatus: { - type: String, - required: true, - enum: ["not-departed", "paid", "send-required", "sent"], - default: "not-departed", - }, -}); - -const roomSchema = Schema({ - name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ", text: true }, - from: { type: Schema.Types.ObjectId, ref: "Location", required: true }, - to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, - time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ - part: { - type: [participantSchema], - validate: [ - function (value) { - return value.length <= this.maxPartLength; - }, - ], - }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ ๋ฐ ์ •์‚ฐ ์—ฌ๋ถ€ - madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ - settlementTotal: { type: Number, default: 0, required: true }, - isOver: { type: Boolean, default: false, required: true }, - maxPartLength: { type: Number, require: true, default: 4 }, -}); - -const locationSchema = Schema({ - enName: { type: String, required: true }, - koName: { type: String, required: true }, - // latitude: { type: Number, required: true }, - // longitude: { type: Number, required: true } -}); -const chatSchema = Schema({ - roomId: { type: Schema.Types.ObjectId, ref: "Room", required: true }, - type: { type: String }, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜ (text|in|out|s3img) - authorId: { type: Schema.Types.ObjectId, ref: "User", required: true }, // ์ž‘์„ฑ์ž id - content: { type: String, default: "" }, - time: { type: Date, required: true }, - isValid: { type: Boolean, default: true }, -}); -chatSchema.index({ roomId: 1, time: -1 }); - const database = mongoose.connection; -const userModel = mongoose.model("User", userSchema); -const roomModel = mongoose.model("Room", roomSchema); -const locationModel = mongoose.model("Location", locationSchema); -const chatModel = mongoose.model("Chat", chatSchema); - -const initializeDB = async () => { - // drop all collections - await mongoose.connection.db.dropDatabase(); -}; - database.on("error", console.error.bind(console, "mongoose connection error.")); -database.on("open", async () => { - await initializeDB(); + +database.on("connected", async () => { console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); }); + database.on("error", function (err) { console.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ ์—๋Ÿฌ ๋ฐœ์ƒ: " + err); mongoose.disconnect(); }); + database.on("disconnected", function () { console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); mongoose.connect(security.mongo, { @@ -102,9 +27,4 @@ mongoose.connect(security.mongo, { useUnifiedTopology: true, }); -module.exports = { - userModel, - roomModel, - locationModel, - chatModel, -}; +module.exports = mongoose; diff --git a/src/testData.js b/src/testData.js index dd8ecc9f..b54eddbc 100644 --- a/src/testData.js +++ b/src/testData.js @@ -3,7 +3,7 @@ const { roomModel, locationModel, chatModel, -} = require("./db/mongo"); +} = require("./db/model"); const crypto = require("crypto"); const security = require("../security"); From cff28f30a7b34868445de3f28208b8f26355b60a Mon Sep 17 00:00:00 2001 From: withsang Date: Wed, 23 Nov 2022 01:22:29 +0900 Subject: [PATCH 036/108] Refractor: remove unnecessary variables Co-authored-by: chlehdwon --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 9f5a6a46..f9e6391a 100644 --- a/index.js +++ b/index.js @@ -5,12 +5,12 @@ const { generateChats, } = require("./src/testData"); -const mongoose = require("./src/db/mongo"); +const database = require("./src/db/mongo").connection; const { loadSampleData, numberOfRooms, numberOfChats } = require("./security"); const main = async () => { - await mongoose.connection.db.dropDatabase(); + await database.db.dropDatabase(); const { users, locations } = await Promise.resolve(loadSampleData); @@ -41,5 +41,4 @@ const main = async () => { process.exit(0); }; -const database = mongoose.connection; database.on("open", main); From 32d350fcdf016ae52465741024c740a8e35060fe Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Mon, 5 Dec 2022 13:33:47 +0900 Subject: [PATCH 037/108] Add: dockerfile --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0bb8b037 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM mongo:4.4 + +# Copy repository +WORKDIR /usr/src/app +COPY . . + +# Install requirements +RUN npm ci From ec556649f9d5c6941bddbf8a05e85c3cd645f3b7 Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Mon, 5 Dec 2022 14:15:35 +0900 Subject: [PATCH 038/108] Refactor: dockerfile --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0bb8b037..0d25cd07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ FROM mongo:4.4 # Copy repository -WORKDIR /usr/src/app +WORKDIR /home COPY . . -# Install requirements -RUN npm ci +# +WORKDIR /home +ENTRYPOINT ["docker-entrypoint.sh"] +EXPOSE 27017 +CMD ["mongod"] From 0807147f5c28ce01466719b87836895c3f622b2f Mon Sep 17 00:00:00 2001 From: 14Kgun Date: Tue, 6 Dec 2022 00:26:47 +0900 Subject: [PATCH 039/108] Refactor: Dockerfile --- .dockerignore | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 15 +++++-- 2 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..147ebc06 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,107 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# MongoDB Dump +dump/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0d25cd07..9f7120fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,17 @@ FROM mongo:4.4 WORKDIR /home COPY . . -# -WORKDIR /home -ENTRYPOINT ["docker-entrypoint.sh"] +# Install +RUN apt-get -qq update +RUN apt-get -qq install curl +RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash +RUN source install_nvm + +# Install +RUN mongod & +RUN +RUN mongod --shutdown + +# Start service EXPOSE 27017 CMD ["mongod"] From 9c5cbec5c371ec9c29fcd9794717f8d54e0f9974 Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Tue, 20 Dec 2022 15:12:29 +0900 Subject: [PATCH 040/108] Refactor: Dockerfile --- Dockerfile | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9f7120fe..5d8900c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,18 +3,33 @@ FROM mongo:4.4 # Copy repository WORKDIR /home COPY . . +ENV DB_PATH mongodb://localhost:27017/local +ENV NUM_OF_ROOMS 2 +ENV NUM_OF_CHATS 200 +ENV MAXIMUM_INTERVAL_BETWEEN_CHATS 20 +ENV OCCURENCE_OF_JOIN 0.1 +ENV OCCURENCE_OF_ABORT 0.1 -# Install -RUN apt-get -qq update -RUN apt-get -qq install curl -RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash -RUN source install_nvm +# Download nvm +RUN apt-get -qq update; \ + apt-get -qq install curl; \ + curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash; \ + mv /data/db/.nvm /home/.nvm -# Install -RUN mongod & -RUN -RUN mongod --shutdown +# Start mongo service \ +# Install node (from nvm) \ +# Run taxi-sampleGenerator +ENV NODE_VERSION v16.15.0 +ENV DB_STORAGE /home/db +RUN mkdir $DB_STORAGE; \ + mongod --fork --syslog --dbpath $DB_STORAGE; \ + . /home/.nvm/nvm.sh; \ + nvm install $NODE_VERSION; \ + nvm use --delete-prefix $NODE_VERSION; \ + npm install; \ + npm start; \ + mongod --shutdown --dbpath $DB_STORAGE -# Start service +# Start mongo service EXPOSE 27017 -CMD ["mongod"] +CMD ["sh", "-c", "cp -rf /home/db /data && mongod"] From ddecbb7b93b2a30facdd7bd492df1a3fe27083a7 Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Tue, 20 Dec 2022 15:15:56 +0900 Subject: [PATCH 041/108] Refactor: Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5d8900c2..36faa7c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,4 +32,4 @@ RUN mkdir $DB_STORAGE; \ # Start mongo service EXPOSE 27017 -CMD ["sh", "-c", "cp -rf /home/db /data && mongod"] +CMD ["sh", "-c", "cp -rf $DB_STORAGE /data && mongod"] From b182d26d6a286f894d409db932c95baf068eddc5 Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Thu, 22 Dec 2022 07:54:01 +0900 Subject: [PATCH 042/108] Refactor: Dockerfile --- Dockerfile | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 36faa7c8..e8630583 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,29 @@ FROM mongo:4.4 -# Copy repository -WORKDIR /home -COPY . . -ENV DB_PATH mongodb://localhost:27017/local -ENV NUM_OF_ROOMS 2 -ENV NUM_OF_CHATS 200 -ENV MAXIMUM_INTERVAL_BETWEEN_CHATS 20 -ENV OCCURENCE_OF_JOIN 0.1 -ENV OCCURENCE_OF_ABORT 0.1 - -# Download nvm +# Install node & npm (from nvm) +ENV NODE_VERSION v16.15.0 RUN apt-get -qq update; \ apt-get -qq install curl; \ curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash; \ - mv /data/db/.nvm /home/.nvm - -# Start mongo service \ -# Install node (from nvm) \ -# Run taxi-sampleGenerator -ENV NODE_VERSION v16.15.0 -ENV DB_STORAGE /home/db -RUN mkdir $DB_STORAGE; \ - mongod --fork --syslog --dbpath $DB_STORAGE; \ - . /home/.nvm/nvm.sh; \ + . /data/db/.nvm/nvm.sh; \ nvm install $NODE_VERSION; \ - nvm use --delete-prefix $NODE_VERSION; \ - npm install; \ - npm start; \ - mongod --shutdown --dbpath $DB_STORAGE + nvm alias default $NODE_VERSION; \ + nvm use --delete-prefix default +ENV PATH /bin/versions/node/$NODE_VERSION/bin:$PATH + +# Copy repository and Set default environments +WORKDIR /home +COPY . . +ENV DB_PATH=mongodb://localhost:27017/local \ + NUM_OF_ROOMS=2 \ + NUM_OF_CHATS=200 \ + MAXIMUM_INTERVAL_BETWEEN_CHATS=20 \ + OCCURENCE_OF_JOIN=0.1 \ + OCCURENCE_OF_ABORT=0.1 + +# Install requirements +RUN npm install # Start mongo service EXPOSE 27017 -CMD ["sh", "-c", "cp -rf $DB_STORAGE /data && mongod"] +CMD ["sh", "-c", "mongod & npm start & tail -f /dev/null"] From 84005137bdd848687f2b81e2494aafc500f4d0cf Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Thu, 22 Dec 2022 07:54:49 +0900 Subject: [PATCH 043/108] Refactor: .dockerignore --- .dockerignore | 2 +- .gitignore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 147ebc06..2909449b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -104,4 +104,4 @@ dist .tern-port # MongoDB Dump -dump/ \ No newline at end of file +dump/ diff --git a/.gitignore b/.gitignore index 147ebc06..2909449b 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,4 @@ dist .tern-port # MongoDB Dump -dump/ \ No newline at end of file +dump/ From abf416413ae19e99d352998ad0cfc0e4f840dbe0 Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Thu, 22 Dec 2022 09:10:42 +0900 Subject: [PATCH 044/108] Add: push_image_ecr.yml --- .github/pull_request_template.md | 9 ++++++ .github/workflows/push_image_ecr.yml | 43 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/push_image_ecr.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..e0697e9a --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,9 @@ +# Summary + +It closes #issue_number + +# Images or Screenshots + +# Further Work + +- Do something... diff --git a/.github/workflows/push_image_ecr.yml b/.github/workflows/push_image_ecr.yml new file mode 100644 index 00000000..e4ee294f --- /dev/null +++ b/.github/workflows/push_image_ecr.yml @@ -0,0 +1,43 @@ +name: Push Image to Amazon ECR +on: + pull_request: + types: + - closed + branches: + - main + +env: + AWS_REGION: ap-northeast-2 + +jobs: + if_merged: + if: github.event.pull_request.merged == true + name: Push Image to Amazon ECR + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to AWS ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build and Push to AWS ECR + id: build_image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: taxi-mongo + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + echo "Push iamge : $ECR_REGISTRY/$ECR_REPOSITORY:latest" From ef921537517a798421a00f0c5b60e450c4b74f2b Mon Sep 17 00:00:00 2001 From: chlehdwon Date: Mon, 3 Apr 2023 13:17:31 +0000 Subject: [PATCH 045/108] Docs: auth.js --- src/routes/docs/auth.js | 47 ++++++++++++++++++++++++++++++++++ src/routes/docs/errors.js | 15 +++++++++++ src/routes/docs/reports.js | 26 +++---------------- src/routes/docs/swaggerDocs.js | 6 +++++ 4 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 src/routes/docs/auth.js create mode 100644 src/routes/docs/errors.js diff --git a/src/routes/docs/auth.js b/src/routes/docs/auth.js new file mode 100644 index 00000000..b4cf1ab5 --- /dev/null +++ b/src/routes/docs/auth.js @@ -0,0 +1,47 @@ +const errorsDocs = require("./errors"); + +const authDocs = { + "/auth/sparcssso": { + get: { + tags: ["auth"], + summary: "๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + responses: {}, + }, + }, + "/auth/sparcssso/callback": { + get: { + tags: ["auth"], + summary: "๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ๋˜์—ˆ์„ ๋•Œ ๋‹ค์‹œ ๋กœ๊ทธ์ธ ์‹œ๋„", + description: + "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ๋ถ€ํ„ฐ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋˜์—ˆ์„ ๋•Œ ๋กœ๊ทธ์ธ์„ ์‹œ๋„", + parameters: [], + responses: {}, + }, + }, + "/auth/logout": { + get: { + tags: ["auth"], + summary: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", + description: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", + responses: { + 200: { + content: { + schema: { + type: "object", + properties: { + ssoLogoutUrl: { + type: "string", + description: "SSO ๋กœ๊ทธ์•„์›ƒ URL", + }, + }, + }, + }, + }, + 500: errorsDocs["500"], + }, + }, + }, +}; + +module.exports = authDocs; diff --git a/src/routes/docs/errors.js b/src/routes/docs/errors.js new file mode 100644 index 00000000..cb7be6d6 --- /dev/null +++ b/src/routes/docs/errors.js @@ -0,0 +1,15 @@ +const errorsDocs = { + 500: { + description: "internal server error", + content: { + "text/plain": { + schema: { + type: "string", + example: "internal server error", + }, + }, + }, + }, +}; + +module.exports = errorsDocs; diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index 0210197e..cbbb105a 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -1,3 +1,5 @@ +const errorsDocs = require("./errors"); + const reportsDocs = { "/reports/create": { post: { @@ -26,17 +28,7 @@ const reportsDocs = { }, }, }, - 500: { - description: "internal server error", - content: { - "text/plain": { - schema: { - type: "string", - example: "internal server error", - }, - }, - }, - }, + 500: errorsDocs["500"], }, }, }, @@ -65,17 +57,7 @@ const reportsDocs = { }, }, }, - 500: { - description: "internal server error", - content: { - "text/plain": { - schema: { - type: "string", - example: "internal server error", - }, - }, - }, - }, + 500: errorsDocs["500"], }, }, }, diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index cf52ff2a..605031b8 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -2,6 +2,7 @@ const reportsSchema = require("./reportsSchema"); const reportsDocs = require("./reports"); const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); +const authDocs = require("./auth"); const swaggerDocs = { openapi: "3.0.3", @@ -23,6 +24,10 @@ const swaggerDocs = { name: "reports", description: "์‚ฌ์šฉ์ž ์‹ ๊ณ  ๋ฐ ์‹ ๊ณ  ๊ธฐ๋ก ์กฐํšŒ", }, + { + name: "auth", + description: "์‚ฌ์šฉ์ž ์ƒํƒœ ๊ด€๋ฆฌ ์ง€์›", + }, ], consumes: ["application/json"], produces: ["application/json"], @@ -30,6 +35,7 @@ const swaggerDocs = { ...reportsDocs, ...logininfoDocs, ...locationsDocs, + ...authDocs, }, components: { schemas: { From fa3c2c63fb008ec6caed9b6d3a1c2ea1c6c10780 Mon Sep 17 00:00:00 2001 From: chlehdwon Date: Tue, 4 Apr 2023 12:06:25 +0000 Subject: [PATCH 046/108] Docs: add format --- src/routes/docs/auth.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/routes/docs/auth.js b/src/routes/docs/auth.js index b4cf1ab5..d000995d 100644 --- a/src/routes/docs/auth.js +++ b/src/routes/docs/auth.js @@ -42,6 +42,29 @@ const authDocs = { }, }, }, + "/auth/app/token/login": { + get: { + tags: ["auth"], + }, + }, + "/auth/app/token/refresh": { + get: { + tags: ["auth"], + }, + }, + "/auth/app/device": { + post: { + tags: ["auth"], + }, + delete: { + tags: ["auth"], + }, + }, + "/auth/app/token/generate": { + get: { + tags: ["auth"], + }, + }, }; module.exports = authDocs; From 7086f47921ee2ed83a2e1e57213cd02843b13c62 Mon Sep 17 00:00:00 2001 From: cokia Date: Thu, 10 Aug 2023 00:08:52 +0900 Subject: [PATCH 047/108] fix: update package manager to pnpm --- Dockerfile | 4 ++-- README.md | 8 ++++---- package.json | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index e8630583..c107658e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,8 @@ ENV DB_PATH=mongodb://localhost:27017/local \ OCCURENCE_OF_ABORT=0.1 # Install requirements -RUN npm install +RUN pnpm i --force --frozen-lockfile # Start mongo service EXPOSE 27017 -CMD ["sh", "-c", "mongod & npm start & tail -f /dev/null"] +CMD ["sh", "-c", "mongod & pnpm run start & tail -f /dev/null"] diff --git a/README.md b/README.md index 4651dac1..d39e8f31 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ **SETUP** 1. ๋กœ์ปฌ ์ €์žฅ์†Œ์— ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋ฅผ ํด๋ก ํ•ฉ๋‹ˆ๋‹ค. -1. `npm install`๋กœ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. +1. `pnpm install`๋กœ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. 1. ํด๋ก ํ•œ ๋””๋ ‰ํ† ๋ฆฌ(index.js๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ``` #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) @@ -26,7 +26,7 @@ 1. sampleData.json์— ์žฅ์†Œ, ์œ ์ €, ๋ฐฉ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. javascript `User { "id": "sampleId", ์‚ฌ์šฉ์ž id }` -1. `npm start`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +1. `pnpm start`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -1. `npm run dumpDB`์œผ๋กœ ํ˜„์žฌ DB๋ฅผ ๋คํ”„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -1. `npm run restoreDB`๋กœ ๊ณผ๊ฑฐ DB๋ฅผ ๋คํ”„ ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ๋ณต์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +1. `pnpm run dumpDB`์œผ๋กœ ํ˜„์žฌ DB๋ฅผ ๋คํ”„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +1. `pnpm run restoreDB`๋กœ ๊ณผ๊ฑฐ DB๋ฅผ ๋คํ”„ ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ๋ณต์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. diff --git a/package.json b/package.json index 67401bdf..50e738bf 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "sample generator", "main": "index.js", "scripts": { + "preinstall": "npx only-allow pnpm", "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1", "dumpDB": "node tools/dump.js", From 125ec3b941d34fd9a9c52f703e90169271265366 Mon Sep 17 00:00:00 2001 From: cokia Date: Thu, 10 Aug 2023 00:13:34 +0900 Subject: [PATCH 048/108] fix: pnpm import --- package-lock.json | 1897 --------------------------------------------- pnpm-lock.yaml | 731 +++++++++++++++++ 2 files changed, 731 insertions(+), 1897 deletions(-) delete mode 100644 package-lock.json create mode 100644 pnpm-lock.yaml diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index be6e8ac5..00000000 --- a/package-lock.json +++ /dev/null @@ -1,1897 +0,0 @@ -{ - "name": "taxisamplegenerator", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "taxisamplegenerator", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "dotenv": "^16.0.0", - "eslint": "^8.9.0", - "mongoose": "^6.5.2" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", - "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.3.1", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.3.tgz", - "integrity": "sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==", - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" - }, - "node_modules/@types/node": { - "version": "18.7.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.3.tgz", - "integrity": "sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w==" - }, - "node_modules/@types/webidl-conversions": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", - "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" - }, - "node_modules/@types/whatwg-url": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", - "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", - "dependencies": { - "@types/node": "*", - "@types/webidl-conversions": "*" - } - }, - "node_modules/acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "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/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/bson": { - "version": "4.6.5", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.5.tgz", - "integrity": "sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==", - "dependencies": { - "buffer": "^5.6.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" - }, - "node_modules/denque": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", - "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", - "engines": { - "node": ">=0.10" - } - }, - "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.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", - "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==", - "engines": { - "node": ">=12" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", - "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", - "dependencies": { - "@eslint/eslintrc": "^1.1.0", - "@humanwhocodes/config-array": "^0.9.2", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.6.0", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/espree": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", - "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", - "dependencies": { - "acorn": "^8.7.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "engines": { - "node": ">=4.0" - } - }, - "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/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==" - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" - }, - "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "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": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "13.12.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", - "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "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": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "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/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" - }, - "node_modules/kareem": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz", - "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==" - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", - "optional": true - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mongodb": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", - "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", - "dependencies": { - "bson": "^4.6.5", - "denque": "^2.0.1", - "mongodb-connection-string-url": "^2.5.2", - "socks": "^2.6.2" - }, - "engines": { - "node": ">=12.9.0" - }, - "optionalDependencies": { - "saslprep": "^1.0.3" - } - }, - "node_modules/mongodb-connection-string-url": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", - "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", - "dependencies": { - "@types/whatwg-url": "^8.2.1", - "whatwg-url": "^11.0.0" - } - }, - "node_modules/mongoose": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.5.2.tgz", - "integrity": "sha512-3CFDrSLtK2qjM1pZeZpLTUyqPRkc11Iuh74ZrwS4IwEJ3K2PqGnmyPLw7ex4Kzu37ujIMp3MAuiBlUjfrcb6hw==", - "dependencies": { - "bson": "^4.6.5", - "kareem": "2.4.1", - "mongodb": "4.8.1", - "mpath": "0.9.0", - "mquery": "4.0.3", - "ms": "2.1.3", - "sift": "16.0.0" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mongoose" - } - }, - "node_modules/mpath": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", - "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz", - "integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==", - "dependencies": { - "debug": "4.x" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "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": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "engines": { - "node": ">=4" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/saslprep": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", - "optional": true, - "dependencies": { - "sparse-bitfield": "^3.0.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "engines": { - "node": ">=8" - } - }, - "node_modules/sift": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", - "integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==" - }, - "node_modules/smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", - "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", - "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" - }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "optional": true, - "dependencies": { - "memory-pager": "^1.0.2" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" - }, - "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dependencies": { - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" - }, - "node_modules/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", - "dependencies": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - }, - "dependencies": { - "@eslint/eslintrc": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", - "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.3.1", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" - } - } - }, - "@humanwhocodes/config-array": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.3.tgz", - "integrity": "sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==", - "requires": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - } - }, - "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" - }, - "@types/node": { - "version": "18.7.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.3.tgz", - "integrity": "sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w==" - }, - "@types/webidl-conversions": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", - "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" - }, - "@types/whatwg-url": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", - "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", - "requires": { - "@types/node": "*", - "@types/webidl-conversions": "*" - } - }, - "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "requires": {} - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "requires": { - "color-convert": "^2.0.1" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "bson": { - "version": "4.6.5", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.5.tgz", - "integrity": "sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==", - "requires": { - "buffer": "^5.6.0" - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" - }, - "denque": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", - "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==" - }, - "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.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", - "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==" - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" - }, - "eslint": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", - "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", - "requires": { - "@eslint/eslintrc": "^1.1.0", - "@humanwhocodes/config-array": "^0.9.2", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.6.0", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - } - }, - "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "requires": { - "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" - } - } - }, - "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==" - }, - "espree": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", - "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", - "requires": { - "acorn": "^8.7.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^3.3.0" - } - }, - "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", - "requires": { - "estraverse": "^5.1.0" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "requires": { - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" - }, - "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "requires": { - "flat-cache": "^3.0.4" - } - }, - "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - } - }, - "flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==" - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "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": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "requires": { - "is-glob": "^4.0.3" - } - }, - "globals": { - "version": "13.12.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", - "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", - "requires": { - "type-fest": "^0.20.2" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "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": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "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" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" - }, - "kareem": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz", - "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==" - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, - "memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", - "optional": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mongodb": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", - "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", - "requires": { - "bson": "^4.6.5", - "denque": "^2.0.1", - "mongodb-connection-string-url": "^2.5.2", - "saslprep": "^1.0.3", - "socks": "^2.6.2" - } - }, - "mongodb-connection-string-url": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", - "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", - "requires": { - "@types/whatwg-url": "^8.2.1", - "whatwg-url": "^11.0.0" - } - }, - "mongoose": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.5.2.tgz", - "integrity": "sha512-3CFDrSLtK2qjM1pZeZpLTUyqPRkc11Iuh74ZrwS4IwEJ3K2PqGnmyPLw7ex4Kzu37ujIMp3MAuiBlUjfrcb6hw==", - "requires": { - "bson": "^4.6.5", - "kareem": "2.4.1", - "mongodb": "4.8.1", - "mpath": "0.9.0", - "mquery": "4.0.3", - "ms": "2.1.3", - "sift": "16.0.0" - } - }, - "mpath": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", - "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==" - }, - "mquery": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz", - "integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==", - "requires": { - "debug": "4.x" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "requires": { - "callsites": "^3.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==" - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "requires": { - "glob": "^7.1.3" - } - }, - "saslprep": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", - "optional": true, - "requires": { - "sparse-bitfield": "^3.0.3" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" - }, - "sift": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", - "integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==" - }, - "smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" - }, - "socks": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", - "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", - "requires": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" - } - }, - "sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "optional": true, - "requires": { - "memory-pager": "^1.0.2" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "requires": { - "has-flag": "^4.0.0" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" - }, - "tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "requires": { - "punycode": "^2.1.1" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==" - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "requires": { - "punycode": "^2.1.0" - } - }, - "v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" - }, - "webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" - }, - "whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", - "requires": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "requires": { - "isexe": "^2.0.0" - } - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..12efb0de --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,731 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +dependencies: + dotenv: + specifier: ^16.0.0 + version: 16.0.0 + eslint: + specifier: ^8.9.0 + version: 8.9.0 + mongoose: + specifier: ^6.5.2 + version: 6.5.2 + +packages: + + /@eslint/eslintrc@1.1.0: + resolution: {integrity: sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + ajv: 6.12.6 + debug: 4.3.3 + espree: 9.3.1 + globals: 13.12.1 + ignore: 4.0.6 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@humanwhocodes/config-array@0.9.3: + resolution: {integrity: sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==} + engines: {node: '>=10.10.0'} + dependencies: + '@humanwhocodes/object-schema': 1.2.1 + debug: 4.3.3 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + dev: false + + /@humanwhocodes/object-schema@1.2.1: + resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} + dev: false + + /@types/node@18.7.3: + resolution: {integrity: sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w==} + dev: false + + /@types/webidl-conversions@6.1.1: + resolution: {integrity: sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==} + dev: false + + /@types/whatwg-url@8.2.2: + resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==} + dependencies: + '@types/node': 18.7.3 + '@types/webidl-conversions': 6.1.1 + dev: false + + /acorn-jsx@5.3.2(acorn@8.7.0): + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + acorn: 8.7.0 + dev: false + + /acorn@8.7.0: + resolution: {integrity: sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: false + + /ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + dev: false + + /ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + dev: false + + /ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + dependencies: + color-convert: 2.0.1 + dev: false + + /argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: false + + /balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: false + + /base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: false + + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + dev: false + + /bson@4.6.5: + resolution: {integrity: sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==} + engines: {node: '>=6.9.0'} + dependencies: + buffer: 5.7.1 + dev: false + + /buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: false + + /callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + dev: false + + /chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: false + + /color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + dependencies: + color-name: 1.1.4 + dev: false + + /color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + dev: false + + /concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + dev: false + + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: false + + /debug@4.3.3: + resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: false + + /deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + dev: false + + /denque@2.1.0: + resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} + engines: {node: '>=0.10'} + dev: false + + /doctrine@3.0.0: + resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} + engines: {node: '>=6.0.0'} + dependencies: + esutils: 2.0.3 + dev: false + + /dotenv@16.0.0: + resolution: {integrity: sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==} + engines: {node: '>=12'} + dev: false + + /escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + dev: false + + /eslint-scope@7.1.1: + resolution: {integrity: sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + dev: false + + /eslint-utils@3.0.0(eslint@8.9.0): + resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} + engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} + peerDependencies: + eslint: '>=5' + dependencies: + eslint: 8.9.0 + eslint-visitor-keys: 2.1.0 + dev: false + + /eslint-visitor-keys@2.1.0: + resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} + engines: {node: '>=10'} + dev: false + + /eslint-visitor-keys@3.3.0: + resolution: {integrity: sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: false + + /eslint@8.9.0: + resolution: {integrity: sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + hasBin: true + dependencies: + '@eslint/eslintrc': 1.1.0 + '@humanwhocodes/config-array': 0.9.3 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.3 + debug: 4.3.3 + doctrine: 3.0.0 + escape-string-regexp: 4.0.0 + eslint-scope: 7.1.1 + eslint-utils: 3.0.0(eslint@8.9.0) + eslint-visitor-keys: 3.3.0 + espree: 9.3.1 + esquery: 1.4.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 6.0.1 + functional-red-black-tree: 1.0.1 + glob-parent: 6.0.2 + globals: 13.12.1 + ignore: 5.2.0 + import-fresh: 3.3.0 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + js-yaml: 4.1.0 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.1 + regexpp: 3.2.0 + strip-ansi: 6.0.1 + strip-json-comments: 3.1.1 + text-table: 0.2.0 + v8-compile-cache: 2.3.0 + transitivePeerDependencies: + - supports-color + dev: false + + /espree@9.3.1: + resolution: {integrity: sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + acorn: 8.7.0 + acorn-jsx: 5.3.2(acorn@8.7.0) + eslint-visitor-keys: 3.3.0 + dev: false + + /esquery@1.4.0: + resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} + engines: {node: '>=0.10'} + dependencies: + estraverse: 5.3.0 + dev: false + + /esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + dependencies: + estraverse: 5.3.0 + dev: false + + /estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + dev: false + + /esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + dev: false + + /fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + dev: false + + /fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + dev: false + + /fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + dev: false + + /file-entry-cache@6.0.1: + resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} + engines: {node: ^10.12.0 || >=12.0.0} + dependencies: + flat-cache: 3.0.4 + dev: false + + /flat-cache@3.0.4: + resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} + engines: {node: ^10.12.0 || >=12.0.0} + dependencies: + flatted: 3.2.5 + rimraf: 3.0.2 + dev: false + + /flatted@3.2.5: + resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==} + dev: false + + /fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: false + + /functional-red-black-tree@1.0.1: + resolution: {integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==} + dev: false + + /glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + dependencies: + is-glob: 4.0.3 + dev: false + + /glob@7.2.0: + resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: false + + /globals@13.12.1: + resolution: {integrity: sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==} + engines: {node: '>=8'} + dependencies: + type-fest: 0.20.2 + dev: false + + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: false + + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: false + + /ignore@4.0.6: + resolution: {integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==} + engines: {node: '>= 4'} + dev: false + + /ignore@5.2.0: + resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} + engines: {node: '>= 4'} + dev: false + + /import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + dev: false + + /imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + dev: false + + /inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: false + + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: false + + /ip@2.0.0: + resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} + dev: false + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: false + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: false + + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: false + + /js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + dependencies: + argparse: 2.0.1 + dev: false + + /json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + dev: false + + /json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + dev: false + + /kareem@2.4.1: + resolution: {integrity: sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==} + dev: false + + /levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + dev: false + + /lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + dev: false + + /memory-pager@1.5.0: + resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} + dev: false + optional: true + + /minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + dependencies: + brace-expansion: 1.1.11 + dev: false + + /mongodb-connection-string-url@2.5.3: + resolution: {integrity: sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==} + dependencies: + '@types/whatwg-url': 8.2.2 + whatwg-url: 11.0.0 + dev: false + + /mongodb@4.8.1: + resolution: {integrity: sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==} + engines: {node: '>=12.9.0'} + dependencies: + bson: 4.6.5 + denque: 2.1.0 + mongodb-connection-string-url: 2.5.3 + socks: 2.7.0 + optionalDependencies: + saslprep: 1.0.3 + dev: false + + /mongoose@6.5.2: + resolution: {integrity: sha512-3CFDrSLtK2qjM1pZeZpLTUyqPRkc11Iuh74ZrwS4IwEJ3K2PqGnmyPLw7ex4Kzu37ujIMp3MAuiBlUjfrcb6hw==} + engines: {node: '>=12.0.0'} + dependencies: + bson: 4.6.5 + kareem: 2.4.1 + mongodb: 4.8.1 + mpath: 0.9.0 + mquery: 4.0.3 + ms: 2.1.3 + sift: 16.0.0 + transitivePeerDependencies: + - supports-color + dev: false + + /mpath@0.9.0: + resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==} + engines: {node: '>=4.0.0'} + dev: false + + /mquery@4.0.3: + resolution: {integrity: sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==} + engines: {node: '>=12.0.0'} + dependencies: + debug: 4.3.3 + transitivePeerDependencies: + - supports-color + dev: false + + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: false + + /ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: false + + /natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + dev: false + + /once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: false + + /optionator@0.9.1: + resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} + engines: {node: '>= 0.8.0'} + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.3 + dev: false + + /parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + dependencies: + callsites: 3.1.0 + dev: false + + /path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + dev: false + + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: false + + /prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + dev: false + + /punycode@2.1.1: + resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} + engines: {node: '>=6'} + dev: false + + /regexpp@3.2.0: + resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} + engines: {node: '>=8'} + dev: false + + /resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + dev: false + + /rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + hasBin: true + dependencies: + glob: 7.2.0 + dev: false + + /saslprep@1.0.3: + resolution: {integrity: sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==} + engines: {node: '>=6'} + requiresBuild: true + dependencies: + sparse-bitfield: 3.0.3 + dev: false + optional: true + + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: false + + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: false + + /sift@16.0.0: + resolution: {integrity: sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==} + dev: false + + /smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + dev: false + + /socks@2.7.0: + resolution: {integrity: sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==} + engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} + dependencies: + ip: 2.0.0 + smart-buffer: 4.2.0 + dev: false + + /sparse-bitfield@3.0.3: + resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==} + dependencies: + memory-pager: 1.5.0 + dev: false + optional: true + + /strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + dependencies: + ansi-regex: 5.0.1 + dev: false + + /strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + dev: false + + /supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + dependencies: + has-flag: 4.0.0 + dev: false + + /text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + dev: false + + /tr46@3.0.0: + resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} + engines: {node: '>=12'} + dependencies: + punycode: 2.1.1 + dev: false + + /type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + dependencies: + prelude-ls: 1.2.1 + dev: false + + /type-fest@0.20.2: + resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} + engines: {node: '>=10'} + dev: false + + /uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + dependencies: + punycode: 2.1.1 + dev: false + + /v8-compile-cache@2.3.0: + resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} + dev: false + + /webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + dev: false + + /whatwg-url@11.0.0: + resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==} + engines: {node: '>=12'} + dependencies: + tr46: 3.0.0 + webidl-conversions: 7.0.0 + dev: false + + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: false + + /word-wrap@1.2.3: + resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==} + engines: {node: '>=0.10.0'} + dev: false + + /wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: false From 3028de05ef955a6e3d5f738a7c73eb3f730f9ef7 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Mon, 18 Sep 2023 16:48:00 +0000 Subject: [PATCH 049/108] Docs: add /auth/spacssso/* --- src/routes/docs/auth.js | 67 ++++++++++++++++++++++++++++++++++ src/routes/docs/locations.js | 2 +- src/routes/docs/logininfo.js | 2 +- src/routes/docs/reports.js | 4 +- src/routes/docs/swaggerDocs.js | 12 ++++-- 5 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 src/routes/docs/auth.js diff --git a/src/routes/docs/auth.js b/src/routes/docs/auth.js new file mode 100644 index 00000000..5f2813c3 --- /dev/null +++ b/src/routes/docs/auth.js @@ -0,0 +1,67 @@ +const authDocs = { + "/auth/sparcssso": { + get: { + tags: ["/auth"], + summary: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + description: + "Prod์˜ ๊ฒฝ์šฐ SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ, Dev์˜ ๊ฒฝ์šฐ replace ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธํ•จ.", + parameters: [ + { + in: "query", + name: "redirect", + schema: { + type: "string", + }, + description: "๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URI", + }, + { + in: "query", + name: "isApp", + schema: { + type: "boolean", + }, + description: "์•ฑ์ธ์ง€ ์—ฌ๋ถ€", + }, + ], + response: { + 302: { + description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + }, + }, + }, + }, + "/auth/sparcssso/callback": { + get: { + tags: ["/auth"], + summary: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€์—์„œ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋ฅผ ์ฒ˜๋ฆฌ", + description: + "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ๋ถ€ํ„ฐ ํ”„๋ก ํŠธ๋กœ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋˜์—ˆ์„ ๋•Œ ๋กœ๊ทธ์ธ์„ ์‹œ๋„ํ•จ.", + parameters: [ + { + in: "query", + name: "code", + schema: { + type: "string", + }, + description: "SSO server์—์„œ ๋ถ€์—ฌํ•œ ์œ ์ € ์ •๋ณด๋ฅผ ์œ„ํ•œ code", + }, + { + in: "query", + name: "state", + schema: { + type: "string", + }, + description: "login ์„ฑ๊ณต ์—ฌ๋ถ€ ํ™•์ธ์„ ์œ„ํ•œ state", + }, + ], + response: { + 302: { + description: + "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + }, + }, + }, + }, +}; + +module.exports = authDocs; diff --git a/src/routes/docs/locations.js b/src/routes/docs/locations.js index 530788eb..6f7d3847 100644 --- a/src/routes/docs/locations.js +++ b/src/routes/docs/locations.js @@ -1,7 +1,7 @@ const locationsDocs = { "/locations": { get: { - tags: ["locations"], + tags: ["/locations"], summary: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ๋ฐ˜ํ™˜", description: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
\n (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)", diff --git a/src/routes/docs/logininfo.js b/src/routes/docs/logininfo.js index b24c5fe6..d878427c 100644 --- a/src/routes/docs/logininfo.js +++ b/src/routes/docs/logininfo.js @@ -1,7 +1,7 @@ const logininfoDocs = { "/logininfo": { get: { - tags: ["logininfo"], + tags: ["/logininfo"], summary: "์‚ฌ์šฉ์ž ์ •๋ณด ๋ฐ˜ํ™˜", description: "๋กœ๊ทธ์ธ๋˜์–ด ์žˆ๋Š” ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜", responses: { diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index 0210197e..62842f68 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -1,7 +1,7 @@ const reportsDocs = { "/reports/create": { post: { - tags: ["reports"], + tags: ["/reports"], summary: "์‹ ๊ณ  ์ž‘์„ฑ", description: "์ฃผ์–ด์ง„ ์œ ์ €๋ฅผ ์ „๋‹ฌ๋œ ์‚ฌ์œ ๋กœ ์‹ ๊ณ ํ•จ", requestBody: { @@ -42,7 +42,7 @@ const reportsDocs = { }, "/reports/searchByUser": { get: { - tags: ["reports"], + tags: ["/reports"], summary: "์‹ ๊ณ  ๋‚ด์—ญ ๋ฐ˜ํ™˜", description: "๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์‹ ๊ณ ํ•œ ๋‚ด์—ญ๊ณผ, ์‹ ๊ณ ๋ฐ›์€ ๋‚ด์—ญ์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค
1000๊ฐœ์˜ limit์ด ์žˆ๋‹ค.", diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index cf52ff2a..b6028ca4 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -2,6 +2,7 @@ const reportsSchema = require("./reportsSchema"); const reportsDocs = require("./reports"); const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); +const authDocs = require("./auth"); const swaggerDocs = { openapi: "3.0.3", @@ -12,17 +13,21 @@ const swaggerDocs = { basePath: "/", tags: [ { - name: "locations", + name: "/locations", description: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ์ œ๊ณต", }, { - name: "logininfo", + name: "/logininfo", description: "๋กœ๊ทธ์ธ ์ •๋ณด ์ œ๊ณต", }, { - name: "reports", + name: "/reports", description: "์‚ฌ์šฉ์ž ์‹ ๊ณ  ๋ฐ ์‹ ๊ณ  ๊ธฐ๋ก ์กฐํšŒ", }, + { + name: "/auth", + description: "์‚ฌ์šฉ์ž ์ƒ์„ฑ, ๋กœ๊ทธ์ธ, ๋กœ๊ทธ์•„์›ƒ ๋“ฑ ์‚ฌ์šฉ์ž ์ƒํƒœ ๊ด€๋ฆฌ ์ง€์›", + }, ], consumes: ["application/json"], produces: ["application/json"], @@ -30,6 +35,7 @@ const swaggerDocs = { ...reportsDocs, ...logininfoDocs, ...locationsDocs, + ...authDocs, }, components: { schemas: { From 065827e1b8af510c76a2168957b22213edf2e8ce Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Tue, 19 Sep 2023 15:13:56 +0000 Subject: [PATCH 050/108] Docs: auth.js basic format done --- src/routes/docs/auth.js | 204 +++++++++++++++++++++++++++++++++++--- src/routes/docs/errors.js | 33 ++++++ 2 files changed, 223 insertions(+), 14 deletions(-) diff --git a/src/routes/docs/auth.js b/src/routes/docs/auth.js index f3facdf0..172dd11c 100644 --- a/src/routes/docs/auth.js +++ b/src/routes/docs/auth.js @@ -25,9 +25,16 @@ const authDocs = { description: "์•ฑ์ธ์ง€ ์—ฌ๋ถ€", }, ], - response: { + responses: { 302: { description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + headers: { + Location: { + type: "string", + description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€", + format: "uri", + }, + }, }, }, }, @@ -56,11 +63,19 @@ const authDocs = { description: "login ์„ฑ๊ณต ์—ฌ๋ถ€ ํ™•์ธ์„ ์œ„ํ•œ state", }, ], - response: { + responses: { 302: { description: - "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€ URI๋กœ, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + headers: { + Location: { + type: "string", + description: "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€ URI, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI", + format: "uri", + }, + }, }, + 400: errorsDocs["400"], }, }, }, @@ -69,15 +84,27 @@ const authDocs = { tags: ["/auth"], summary: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", description: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", + parameters: [ + { + in: "query", + name: "redirect", + schema: { + type: "string", + }, + description: "๋กœ๊ทธ์•„์›ƒ ํ›„ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URI", + }, + ], responses: { 200: { content: { - schema: { - type: "object", - properties: { - ssoLogoutUrl: { - type: "string", - description: "SSO ๋กœ๊ทธ์•„์›ƒ URL", + "application/json": { + schema: { + type: "object", + properties: { + ssoLogoutUrl: { + type: "string", + description: "SSO ๋กœ๊ทธ์•„์›ƒ URL", + }, }, }, }, @@ -90,24 +117,173 @@ const authDocs = { "/auth/app/token/login": { get: { tags: ["/auth"], + summary: "Access token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ", + description: "์•ฑ์—์„œ Access Token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ ์‹œ๋„", + parameters: [ + { + in: "query", + name: "accessToken", + schema: { + type: "string", + }, + description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Access Token", + }, + { + in: "query", + name: "deviceToken", + schema: { + type: "string", + }, + description: "Device Token", + }, + ], + responses: { + 200: { + description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", + content: { + "text/plain": { + schema: { + type: "string", + example: "success", + }, + }, + }, + }, + 401: errorsDocs["401"], + 500: errorsDocs["500"], + }, }, }, "/auth/app/token/refresh": { get: { tags: ["/auth"], + summary: "๋งŒ๋ฃŒ๋œ Access Token ๊ฐฑ์‹ ", + description: "์•ฑ์—์„œ Access Token์„ Refresh Token์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐฑ์‹ ", + parameters: [ + { + in: "query", + name: "accessToken", + schema: { + type: "string", + }, + description: "๋งŒ๋ฃŒ๋œ ์œ ํšจํ•œ JWT Access Token", + }, + { + in: "query", + name: "refreshToken", + schema: { + type: "string", + }, + description: "๋งŒ๋ฃŒ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Refresh Token", + }, + ], + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + accessToken: { + type: "string", + description: "์ƒˆ๋กœ์šด JWT Access Token", + }, + refreshToken: { + type: "string", + description: "์ƒˆ๋กœ์šด Refresh Token", + }, + }, + }, + }, + }, + }, + 400: errorsDocs["400"], + 401: errorsDocs["401"], + 501: errorsDocs["501"], + }, }, }, "/auth/app/device": { post: { tags: ["/auth"], + summary: "๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก", + description: "App ๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + accessToken: { + type: "string", + description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Access Token", + }, + deviceToken: { + type: "string", + description: + "Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” Device Token", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", + content: { + "text/plain": { + schema: { + type: "string", + exapmle: "success", + }, + }, + }, + }, + 400: errorsDocs["400"], + 401: errorsDocs["401"], + 500: errorsDocs["500"], + }, }, delete: { tags: ["/auth"], - }, - }, - "/auth/app/token/generate": { - get: { - tags: ["/auth"], + summary: "๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์‚ญ์ œ", + description: "App ๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์‚ญ์ œ", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + accessToken: { + type: "string", + description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT accessToken", + }, + deviceToken: { + type: "string", + description: "Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” DeviceToken", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", + content: { + "text/plain": { + schema: { + type: "string", + exapmle: "success", + }, + }, + }, + }, + 400: errorsDocs["400"], + 401: errorsDocs["401"], + 500: errorsDocs["500"], + }, }, }, }; diff --git a/src/routes/docs/errors.js b/src/routes/docs/errors.js index cb7be6d6..e6569813 100644 --- a/src/routes/docs/errors.js +++ b/src/routes/docs/errors.js @@ -1,4 +1,26 @@ const errorsDocs = { + 400: { + description: "invalid request", + content: { + "text/plain": { + schema: { + type: "string", + example: "invalid request", + }, + }, + }, + }, + 401: { + description: "invalid request", + content: { + "text/plain": { + schema: { + type: "string", + example: "Invalid token", + }, + }, + }, + }, 500: { description: "internal server error", content: { @@ -10,6 +32,17 @@ const errorsDocs = { }, }, }, + 501: { + description: "server error", + content: { + "text/plain": { + schema: { + type: "string", + example: "server error", + }, + }, + }, + }, }; module.exports = errorsDocs; From 0ca21b6fc881f75e6ceac8f954681f2a8a5129d2 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Tue, 19 Sep 2023 15:15:12 +0000 Subject: [PATCH 051/108] Remove: auth.md --- src/routes/docs/auth.md | 180 ---------------------------------------- 1 file changed, 180 deletions(-) delete mode 100644 src/routes/docs/auth.md diff --git a/src/routes/docs/auth.md b/src/routes/docs/auth.md deleted file mode 100644 index 799ddd01..00000000 --- a/src/routes/docs/auth.md +++ /dev/null @@ -1,180 +0,0 @@ -## `/auth` **(for production)** - -- ์‚ฌ์šฉ์ž ์ƒ์„ฑ, ๋กœ๊ทธ์ธ, ๋กœ๊ทธ์•„์›ƒ ๋“ฑ ์‚ฌ์šฉ์ž ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ์ง€์›ํ•˜๋Š” API. -- SPARCS SSO๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กœ๋•์…˜ ์šฉ API. - -### `/sparcssso` **(GET)** - -- SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ. - -#### URL Parameters - -- ์—†์Œ - -#### Response - -- SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ. - -#### Errors - -- ์—†์Œ - -### `/sparcssso/callback` **(GET)** - -- SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ๋ถ€ํ„ฐ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋˜์—ˆ์„ ๋•Œ ๋กœ๊ทธ์ธ์„ ์‹œ๋„ํ•จ - -#### URL Parameters - -- state -- code - -#### Response - -- DB์— ์กด์žฌํ•˜๋Š” id๋ฉด ๋กœ๊ทธ์ธ ์ง„ํ–‰ ํ›„ ํ”„๋ก ํŠธ์—”๋“œ์˜ ์ฒซ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ -- DB์— ์กด์žฌํ•˜์ง€ ์•Š๋Š” id๋ฉด ์ƒˆ๋กœ์šด ์‚ฌ์šฉ์ž๋ฅผ ๋งŒ๋“ค๊ณ  ๋กœ๊ทธ์ธ์„ ์ง„ํ–‰ํ•œ ํ›„ ํ”„๋ก ํŠธ์—”๋“œ์˜ ์ฒซ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ - -#### Errors - -- ์—†์Œ - -### `/logout` **(GET)** - -- ์„ธ์…˜์„ ์‚ญ์ œํ•˜์—ฌ ์‚ฌ์šฉ์ž๋ฅผ ๋กœ๊ทธ์•„์›ƒ์‹œํ‚ด - -#### URL Parameters - -- ์—†์Œ - -#### Response - -```javascript -{ - ssoLogoutUrl: String, // sso ๋กœ๊ทธ์•„์›ƒ url -} -``` - -#### Errors - -- 500 / "internal server error" - -### `/getToken` **(GET)** - -- ์„ธ์…˜์˜ ๋กœ๊ทธ์ธ ์ •๋ณด๋ฅผ ํ† ํฐ์œผ๋กœ ๋งŒ๋“ค์–ด ๋ฐ˜ํ™˜ - -#### URL Parameters - -- ์—†์Œ - -#### Response - -```javascript -{ - status: 200, - data: String, //JSON Web Token -} -``` - -#### Errors - -- 403 "not logged in" - -### `/app/token/generate` **(GET)** - -- SPARCSSSO๋กœ ๋กœ๊ทธ์ธ์„ ์ง„ํ–‰ํ•˜๊ณ  ๋กœ๊ทธ์ธ ์ •๋ณด๋ฅผ ๋‹ด์•„ ACCESSTOKEN, REFRESHTOKEN์„ ๋ฐ˜ํ™˜ - -#### URL Parameters - -- None - -#### Response - -app's deep link -ํ˜•์‹ APP_URI_SCHEME + ://login?accessToken=[ACCESSTOKEN]&refreshToken=[REFRESHTOKEN] - -#### Errors - -- ์—†์Œ - -### `/app/token/refresh` **(GET)** - -- ๋งŒ๋ฃŒ๋œ access token์„ refresh token์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐฑ์‹  - -#### URL Parameters - -- accessToken / ๋งŒ๋ฃŒ๋œ ์œ ํšจํ•œ JWT Access Token์ด์–ด์•ผ ํ•จ -- refreshToken / ๋งŒ๋ฃŒ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Refresh Token ์ด์–ด์•ผ ํ•จ. - -#### Response - -```javascript -{ - accessToken: [newAccessToken], // JSON Web Token - refreshToken: [newRefreshToken], //JSON Web Token -} -``` - -#### Errors - -- 401 / Invalid Access Token -- 401 / Invalid Token -- 401 / Expired Token -- 401 / Not Refresh Token -- 501 / Server Error - -### `/app/token/login` **(GET)** - -- access token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ - -#### URL Parameters - -- accessToken / ๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT accessToken ์ด์–ด์•ผ ํ•จ - -#### Response - -None / ์„ธ์…˜ ๊ธฐ๋ก - -#### Errors - -- 401 / Invalid Access Token -- 401 / Invalid Token -- 401 / Expired Token -- 401 / Not Refresh Token -- 501 / Server Error - -### `/app/device` **(POST)** - -- ๊ธฐ๊ธฐ์˜ deviceToken์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก - -#### URL Parameters - -- accessToken / ๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT accessToken ์ด์–ด์•ผ ํ•จ -- deviceToken / Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” DeviceToken ์ด์–ด์•ผ ํ•จ - -#### Response - -None - -#### Errors - -- 400 / invalid request ( URL Parameters๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Œ ) -- 401 / unauthorized ( ํ† ํฐ์ด ์œ ํšจํ•˜์ง€ ์•Š์Œ ) -- 500 / server error - -### `/app/device` **(DELETE)** - -- ๊ธฐ๊ธฐ์˜ deviceToken์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์‚ญ์ œ - -#### URL Parameters - -- accessToken / ๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT accessToken ์ด์–ด์•ผ ํ•จ -- deviceToken / Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” DeviceToken ์ด์–ด์•ผ ํ•จ - -#### Response - -None - -#### Errors - -- 400 / invalid request ( URL Parameters๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Œ ) -- 401 / unauthorized ( ํ† ํฐ์ด ์œ ํšจํ•˜์ง€ ์•Š์Œ ) -- 500 / server error From b936c658825b3e8f571395814fdfa65560dcf1cd Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 24 Sep 2023 17:11:53 +0000 Subject: [PATCH 052/108] Remove: error messages --- src/routes/docs/auth.js | 15 ------------ src/routes/docs/errors.js | 48 --------------------------------------- 2 files changed, 63 deletions(-) delete mode 100644 src/routes/docs/errors.js diff --git a/src/routes/docs/auth.js b/src/routes/docs/auth.js index 172dd11c..801e8a01 100644 --- a/src/routes/docs/auth.js +++ b/src/routes/docs/auth.js @@ -1,5 +1,3 @@ -const errorsDocs = require("./errors"); - const authDocs = { "/auth/sparcssso": { get: { @@ -75,7 +73,6 @@ const authDocs = { }, }, }, - 400: errorsDocs["400"], }, }, }, @@ -110,7 +107,6 @@ const authDocs = { }, }, }, - 500: errorsDocs["500"], }, }, }, @@ -149,8 +145,6 @@ const authDocs = { }, }, }, - 401: errorsDocs["401"], - 500: errorsDocs["500"], }, }, }, @@ -197,9 +191,6 @@ const authDocs = { }, }, }, - 400: errorsDocs["400"], - 401: errorsDocs["401"], - 501: errorsDocs["501"], }, }, }, @@ -240,9 +231,6 @@ const authDocs = { }, }, }, - 400: errorsDocs["400"], - 401: errorsDocs["401"], - 500: errorsDocs["500"], }, }, delete: { @@ -280,9 +268,6 @@ const authDocs = { }, }, }, - 400: errorsDocs["400"], - 401: errorsDocs["401"], - 500: errorsDocs["500"], }, }, }, diff --git a/src/routes/docs/errors.js b/src/routes/docs/errors.js deleted file mode 100644 index e6569813..00000000 --- a/src/routes/docs/errors.js +++ /dev/null @@ -1,48 +0,0 @@ -const errorsDocs = { - 400: { - description: "invalid request", - content: { - "text/plain": { - schema: { - type: "string", - example: "invalid request", - }, - }, - }, - }, - 401: { - description: "invalid request", - content: { - "text/plain": { - schema: { - type: "string", - example: "Invalid token", - }, - }, - }, - }, - 500: { - description: "internal server error", - content: { - "text/plain": { - schema: { - type: "string", - example: "internal server error", - }, - }, - }, - }, - 501: { - description: "server error", - content: { - "text/plain": { - schema: { - type: "string", - example: "server error", - }, - }, - }, - }, -}; - -module.exports = errorsDocs; From 33a11717d35b1376c41e5e3fae0e06611909a9cf Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 24 Sep 2023 17:15:48 +0000 Subject: [PATCH 053/108] Docs: remove reports.js errors --- src/routes/docs/reports.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index f94488fc..22eab8f0 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -1,5 +1,3 @@ -const errorsDocs = require("./errors"); - const reportsDocs = { "/reports/create": { post: { @@ -28,7 +26,6 @@ const reportsDocs = { }, }, }, - 500: errorsDocs["500"], }, }, }, @@ -57,7 +54,6 @@ const reportsDocs = { }, }, }, - 500: errorsDocs["500"], }, }, }, From 23340c1c0ff6cd16b9c1731e40abd9cfeb85bff1 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 24 Oct 2023 22:48:28 +0900 Subject: [PATCH 054/108] Refactor: profileImageUrl now stores full url --- src/routes/docs/users.md | 4 ++-- src/services/users.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/docs/users.md b/src/routes/docs/users.md index 6b46963b..850323ff 100755 --- a/src/routes/docs/users.md +++ b/src/routes/docs/users.md @@ -93,7 +93,7 @@ User { - ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” Presigned-url์„ ๋ฐœ๊ธ‰ํ•ฉ๋‹ˆ๋‹ค. - ํ”„๋กœํ•„ ์‚ฌ์ง„์€ ์•„๋ž˜ ๊ทœ์น™์„ ๋งŒ์กฑํ•ด์•ผ ํ•จ. 1. ํŒŒ์ผ ํ˜•์‹์€ image/png, image/jpg, image/jpeg ์ค‘ ํ•˜๋‚˜ - 2. ํŒŒ์ผ ํฌ๊ธฐ๋Š” ์ตœ๋Œ€ 50 MB + 2. ํŒŒ์ผ ํฌ๊ธฐ๋Š” ์ตœ๋Œ€ 2 MB #### URL Parameters @@ -125,7 +125,7 @@ User { ```javascript { result: Boolean, // ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ์œผ๋ฉด true - profileImageUrl?: user._id, // ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ์œผ๋ฉด ์ƒˆ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ํŒŒ์ผ๋ช…, ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ undefined + profileImageUrl?: user._id, // ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ์œผ๋ฉด ์ƒˆ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ URL, ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ undefined } ``` diff --git a/src/services/users.js b/src/services/users.js index f4a00d6a..f22c7f99 100644 --- a/src/services/users.js +++ b/src/services/users.js @@ -133,7 +133,7 @@ const editProfileImgDoneHandler = async (req, res) => { } const userAfter = await userModel.findOneAndUpdate( { id: req.userId }, - { profileImageUrl: user._id }, + { profileImageUrl: aws.getS3Url(`/${key}?token=${req.timestamp}`) }, { new: true } ); if (!userAfter) { @@ -143,7 +143,7 @@ const editProfileImgDoneHandler = async (req, res) => { } res.json({ result: true, - profileImageUrl: userAfter._id, + profileImageUrl: userAfter.profileImageUrl, }); }); } catch (e) { From 90d658bec8eb1b4c9992d052b62e0fc9f1594fae Mon Sep 17 00:00:00 2001 From: static Date: Thu, 26 Oct 2023 23:12:28 +0900 Subject: [PATCH 055/108] Add: scripts/profileImageUrlUpdate.js --- scripts/profileImageUrlUpdater.js | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/profileImageUrlUpdater.js diff --git a/scripts/profileImageUrlUpdater.js b/scripts/profileImageUrlUpdater.js new file mode 100644 index 00000000..30f8fbbd --- /dev/null +++ b/scripts/profileImageUrlUpdater.js @@ -0,0 +1,35 @@ +// For Issue #173 + +const { MongoClient } = require("mongodb"); +const { mongo: mongoUrl, aws: awsEnv } = require("../loadenv"); + +const time = Date.now(); + +const client = new MongoClient(mongoUrl); +const db = client.db("taxi"); +const users = db.collection("users"); + +async function run() { + try { + for await (const doc of users.find()) { + // ์ด๋ฏธ ๋ณ€ํ™˜์ด ์™„๋ฃŒ๋œ ๊ฒฝ์šฐ์—๋Š” Passํ•ฉ๋‹ˆ๋‹ค. + if (doc.profileImageUrl.startsWith(awsEnv.s3Url)) continue; + + await users.findOneAndUpdate( + { _id: doc._id }, + { + $set: { + profileImageUrl: `${awsEnv.s3Url}/profile-img/${doc.profileImageUrl}?token=${time}`, + }, + } + ); + } + } catch (err) { + console.log(err); + } finally { + await client.close(); + } +} +run().then(() => { + console.log("Done!"); +}); From 32cd08035a9754d90308f5b8c3d8948228e77590 Mon Sep 17 00:00:00 2001 From: static Date: Thu, 26 Oct 2023 23:18:45 +0900 Subject: [PATCH 056/108] Add: runscript script --- package.json | 2 ++ pnpm-lock.yaml | 57 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index fecc4769..307baba9 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "test": "npm run sample && cross-env TZ='Asia/Seoul' npm run mocha", "mocha": "cross-env TZ='Asia/Seoul' NODE_ENV=test mocha --recursive --reporter spec --exit", "serve": "cross-env TZ='Asia/Seoul' NODE_ENV=production node app.js", + "runscript": "cross-env TZ='Asia/Seoul' NODE_ENV=production node", "lint": "npx eslint --fix .", "sample": "cd sampleGenerator && npm start && cd .." }, @@ -59,6 +60,7 @@ "eslint": "^8.22.0", "eslint-plugin-mocha": "^10.1.0", "mocha": "^10.2.0", + "mongodb": "^6.2.0", "nodemon": "^3.0.1", "supertest": "^6.2.4" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d197fbe1..545f1c18 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,7 +34,7 @@ dependencies: version: 2.2.0 connect-mongo: specifier: ^4.6.0 - version: 4.6.0(express-session@1.17.3)(mongodb@4.17.1) + version: 4.6.0(express-session@1.17.3)(mongodb@6.2.0) connect-redis: specifier: ^6.1.3 version: 6.1.3 @@ -121,6 +121,9 @@ devDependencies: mocha: specifier: ^10.2.0 version: 10.2.0 + mongodb: + specifier: ^6.2.0 + version: 6.2.0 nodemon: specifier: ^3.0.1 version: 3.0.1 @@ -2530,8 +2533,6 @@ packages: requiresBuild: true dependencies: sparse-bitfield: 3.0.3 - dev: false - optional: true /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -3808,7 +3809,6 @@ packages: /@types/node@20.4.7: resolution: {integrity: sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==} - dev: false /@types/object.omit@3.0.0: resolution: {integrity: sha512-I27IoPpH250TUzc9FzXd0P1BV/BMJuzqD3jOz98ehf9dQqGkxlq+hO1bIqZGWqCg5bVOy0g4AUVJtnxe0klDmw==} @@ -3896,14 +3896,12 @@ packages: /@types/webidl-conversions@7.0.0: resolution: {integrity: sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog==} - dev: false /@types/whatwg-url@8.2.2: resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==} dependencies: '@types/node': 20.4.7 '@types/webidl-conversions': 7.0.0 - dev: false /abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} @@ -4314,6 +4312,10 @@ packages: buffer: 5.7.1 dev: false + /bson@6.2.0: + resolution: {integrity: sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==} + engines: {node: '>=16.20.1'} + /buffer-equal-constant-time@1.0.1: resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} dev: false @@ -4568,7 +4570,7 @@ packages: /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - /connect-mongo@4.6.0(express-session@1.17.3)(mongodb@4.17.1): + /connect-mongo@4.6.0(express-session@1.17.3)(mongodb@6.2.0): resolution: {integrity: sha512-8new4Z7NLP3CGP65Aw6ls3xDBeKVvHRSh39CXuDZTQsvpeeU9oNMzfFgvqmHqZ6gWpxIl663RyoVEmCAGf1yOg==} engines: {node: '>=10'} peerDependencies: @@ -4578,7 +4580,7 @@ packages: debug: 4.3.4 express-session: 1.17.3 kruptein: 3.0.6 - mongodb: 4.17.1 + mongodb: 6.2.0 transitivePeerDependencies: - supports-color dev: false @@ -6427,8 +6429,6 @@ packages: /memory-pager@1.5.0: resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} requiresBuild: true - dev: false - optional: true /merge-descriptors@1.0.1: resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} @@ -6564,7 +6564,6 @@ packages: dependencies: '@types/whatwg-url': 8.2.2 whatwg-url: 11.0.0 - dev: false /mongodb@4.17.1: resolution: {integrity: sha512-MBuyYiPUPRTqfH2dV0ya4dcr2E5N52ocBuZ8Sgg/M030nGF78v855B3Z27mZJnp8PxjnUquEnAtjOsphgMZOlQ==} @@ -6580,6 +6579,37 @@ packages: - aws-crt dev: false + /mongodb@6.2.0: + resolution: {integrity: sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==} + engines: {node: '>=16.20.1'} + peerDependencies: + '@aws-sdk/credential-providers': ^3.188.0 + '@mongodb-js/zstd': ^1.1.0 + gcp-metadata: ^5.2.0 + kerberos: ^2.0.1 + mongodb-client-encryption: '>=6.0.0 <7' + snappy: ^7.2.2 + socks: ^2.7.1 + peerDependenciesMeta: + '@aws-sdk/credential-providers': + optional: true + '@mongodb-js/zstd': + optional: true + gcp-metadata: + optional: true + kerberos: + optional: true + mongodb-client-encryption: + optional: true + snappy: + optional: true + socks: + optional: true + dependencies: + '@mongodb-js/saslprep': 1.1.0 + bson: 6.2.0 + mongodb-connection-string-url: 2.6.0 + /mongoose@6.12.0: resolution: {integrity: sha512-sd/q83C6TBRPBrrD2A/POSbA/exbCFM2WOuY7Lf2JuIJFlHFG39zYSDTTAEiYlzIfahNOLmXPxBGFxdAch41Mw==} engines: {node: '>=12.0.0'} @@ -7865,8 +7895,6 @@ packages: requiresBuild: true dependencies: memory-pager: 1.5.0 - dev: false - optional: true /stack-trace@0.0.10: resolution: {integrity: sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==} @@ -8138,7 +8166,6 @@ packages: engines: {node: '>=12'} dependencies: punycode: 2.3.0 - dev: false /triple-beam@1.4.1: resolution: {integrity: sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==} @@ -8382,7 +8409,6 @@ packages: /webidl-conversions@7.0.0: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} - dev: false /websocket-driver@0.7.4: resolution: {integrity: sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==} @@ -8404,7 +8430,6 @@ packages: dependencies: tr46: 3.0.0 webidl-conversions: 7.0.0 - dev: false /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} From 17ed317c036b7068e8b7b9ef38e055bafbf8b12a Mon Sep 17 00:00:00 2001 From: static Date: Mon, 30 Oct 2023 22:34:49 +0900 Subject: [PATCH 057/108] Fix: default profile image url --- src/modules/modifyProfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/modifyProfile.js b/src/modules/modifyProfile.js index 0d15bd58..e8702f98 100755 --- a/src/modules/modifyProfile.js +++ b/src/modules/modifyProfile.js @@ -1,4 +1,5 @@ const crypto = require("crypto"); +const aws = require("./stores/aws"); const nouns = [ "์žฌ๋ฃŒ์—ญํ•™", @@ -81,7 +82,7 @@ const generateNickname = (id) => { // ๊ธฐ์กด ํ”„๋กœํ•„ ์‚ฌ์ง„์˜ URI ์ค‘ ํ•˜๋‚˜๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒํ•ด ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. const generateProfileImageUrl = () => { const ridx = crypto.randomInt(defaultProfile.length); - return `default/${defaultProfile[ridx]}`; + return aws.getS3Url(`/profile-img/default/${defaultProfile[ridx]}`); }; // ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ์„ฑ์„ ๋ฐ›์•„, ํ•œ๊ธ€์ธ์ง€ ์˜์–ด์ธ์ง€์— ๋”ฐ๋ผ ์ „์ฒด ์ด๋ฆ„์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. From 48af97c4ecfe9031021eb520aec7614bac5fd582 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 31 Oct 2023 21:04:13 +0900 Subject: [PATCH 058/108] Refactor: scripts/profileImageUrlUpdater.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jeong Sang (์ •์ƒ) --- scripts/profileImageUrlUpdater.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/profileImageUrlUpdater.js b/scripts/profileImageUrlUpdater.js index 30f8fbbd..78ebe778 100644 --- a/scripts/profileImageUrlUpdater.js +++ b/scripts/profileImageUrlUpdater.js @@ -1,4 +1,5 @@ -// For Issue #173 +// Issue #173์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ DB ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ์ž…๋‹ˆ๋‹ค. +// https://github.com/sparcs-kaist/taxi-back/issues/173 const { MongoClient } = require("mongodb"); const { mongo: mongoUrl, aws: awsEnv } = require("../loadenv"); From 99440bf2122a4d5ed89f351690ff4db0e17f7ca9 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 31 Oct 2023 21:44:39 +0900 Subject: [PATCH 059/108] Fix: add session cookie expiry --- src/middlewares/session.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/middlewares/session.js b/src/middlewares/session.js index c4bdec63..ff6ea034 100644 --- a/src/middlewares/session.js +++ b/src/middlewares/session.js @@ -27,4 +27,8 @@ module.exports = expressSession({ resave: false, saveUninitialized: false, store: sessionStore, + cookie: { + maxAge: 14 * 24 * 3600 * 1000 /* 14์ผ */, + }, + rolling: true, }); From dd6d4fe7b9bbc18fd57e9406f056dd21f3ef6c98 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 2 Nov 2023 16:26:07 +0000 Subject: [PATCH 060/108] Docs: add error examples in the auth document --- src/routes/docs/auth.js | 549 +++++++++++++++++++++++++--------------- 1 file changed, 350 insertions(+), 199 deletions(-) diff --git a/src/routes/docs/auth.js b/src/routes/docs/auth.js index 801e8a01..a5d6eae6 100644 --- a/src/routes/docs/auth.js +++ b/src/routes/docs/auth.js @@ -1,205 +1,246 @@ -const authDocs = { - "/auth/sparcssso": { - get: { - tags: ["/auth"], - summary: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", - description: - "Prod์˜ ๊ฒฝ์šฐ SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ, Dev์˜ ๊ฒฝ์šฐ replace ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธํ•จ.", - parameters: [ - { - in: "query", - name: "redirect", - schema: { - type: "string", - }, - description: "๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URI", +const tag = "auth"; +const apiPrefix = "/auth"; + +const authDocs = {}; +authDocs[`${apiPrefix}/sparcssso`] = { + get: { + tags: [tag], + summary: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + description: + "Prod์˜ ๊ฒฝ์šฐ SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ, Dev์˜ ๊ฒฝ์šฐ replace ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธํ•จ.", + parameters: [ + { + in: "query", + name: "redirect", + schema: { + type: "string", }, - { - in: "query", - name: "isApp", - schema: { - type: "boolean", - }, - description: "์•ฑ์ธ์ง€ ์—ฌ๋ถ€", - }, - ], - responses: { - 302: { - description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", - headers: { - Location: { - type: "string", - description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€", - format: "uri", - }, + description: "๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URI", + }, + { + in: "query", + name: "isApp", + schema: { + type: "boolean", + }, + description: "์•ฑ์ธ์ง€ ์—ฌ๋ถ€", + }, + ], + responses: { + 302: { + description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + headers: { + Location: { + type: "string", + description: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€", + format: "uri", }, }, }, }, }, - "/auth/sparcssso/callback": { - get: { - tags: ["/auth"], - summary: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€์—์„œ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋ฅผ ์ฒ˜๋ฆฌ", - description: - "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ๋ถ€ํ„ฐ ํ”„๋ก ํŠธ๋กœ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋˜์—ˆ์„ ๋•Œ ๋กœ๊ทธ์ธ์„ ์‹œ๋„ํ•จ.", - parameters: [ - { - in: "query", - name: "code", - schema: { - type: "string", - }, - description: "SSO server์—์„œ ๋ถ€์—ฌํ•œ ์œ ์ € ์ •๋ณด๋ฅผ ์œ„ํ•œ code", +}; + +authDocs[`${apiPrefix}/sparcssso/callback`] = { + get: { + tags: [tag], + summary: "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€์—์„œ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋ฅผ ์ฒ˜๋ฆฌ", + description: + "SPARCS SSO ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ๋ถ€ํ„ฐ ํ”„๋ก ํŠธ๋กœ ๋‹ค์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋˜์—ˆ์„ ๋•Œ ๋กœ๊ทธ์ธ์„ ์‹œ๋„ํ•จ.", + parameters: [ + { + in: "query", + name: "code", + schema: { + type: "string", }, - { - in: "query", - name: "state", - schema: { + description: "SSO server์—์„œ ๋ถ€์—ฌํ•œ ์œ ์ € ์ •๋ณด๋ฅผ ์œ„ํ•œ code", + }, + { + in: "query", + name: "state", + schema: { + type: "string", + }, + description: "login ์„ฑ๊ณต ์—ฌ๋ถ€ ํ™•์ธ์„ ์œ„ํ•œ state", + }, + ], + responses: { + 302: { + description: + "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€ URI๋กœ, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", + headers: { + Location: { type: "string", + description: "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€ URI, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI", + format: "uri", }, - description: "login ์„ฑ๊ณต ์—ฌ๋ถ€ ํ™•์ธ์„ ์œ„ํ•œ state", - }, - ], - responses: { - 302: { - description: - "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€ URI๋กœ, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ", - headers: { - Location: { - type: "string", - description: "๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ํŽ˜์ด์ง€ URI, ํ˜น์€ ๋กœ๊ทธ์ธ ์‹คํŒจ URI", - format: "uri", - }, + }, + }, + 400: { + content: { + "text/html": { + example: "SparcsssoCallbackHandler : invalid request", }, }, }, }, }, - "/auth/logout": { - get: { - tags: ["/auth"], - summary: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", - description: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", - parameters: [ - { - in: "query", - name: "redirect", - schema: { - type: "string", - }, - description: "๋กœ๊ทธ์•„์›ƒ ํ›„ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URI", - }, - ], - responses: { - 200: { - content: { - "application/json": { - schema: { - type: "object", - properties: { - ssoLogoutUrl: { - type: "string", - description: "SSO ๋กœ๊ทธ์•„์›ƒ URL", - }, +}; + +authDocs[`${apiPrefix}/logout`] = { + get: { + tags: [tag], + summary: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", + description: "์„ธ์…˜ ์‚ญ์ œ ๋ฐ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์•„์›ƒ", + parameters: [ + { + in: "query", + name: "redirect", + schema: { + type: "string", + }, + description: "๋กœ๊ทธ์•„์›ƒ ํ›„ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URI", + }, + ], + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + ssoLogoutUrl: { + type: "string", + description: "SSO ๋กœ๊ทธ์•„์›ƒ URL", }, }, }, }, }, }, - }, - }, - "/auth/app/token/login": { - get: { - tags: ["/auth"], - summary: "Access token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ", - description: "์•ฑ์—์„œ Access Token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ ์‹œ๋„", - parameters: [ - { - in: "query", - name: "accessToken", - schema: { - type: "string", - }, - description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Access Token", - }, - { - in: "query", - name: "deviceToken", - schema: { - type: "string", - }, - description: "Device Token", - }, - ], - responses: { - 200: { - description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", - content: { - "text/plain": { - schema: { - type: "string", - example: "success", - }, - }, + 500: { + content: { + "text/html": { + example: "Auth/logout : internal server error", }, }, }, }, }, - "/auth/app/token/refresh": { - get: { - tags: ["/auth"], - summary: "๋งŒ๋ฃŒ๋œ Access Token ๊ฐฑ์‹ ", - description: "์•ฑ์—์„œ Access Token์„ Refresh Token์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐฑ์‹ ", - parameters: [ - { - in: "query", - name: "accessToken", - schema: { - type: "string", +}; + +authDocs[`${apiPrefix}/app/token/login`] = { + get: { + tags: [tag], + summary: "Access token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ", + description: "์•ฑ์—์„œ Access Token์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๊ทธ์ธ ์‹œ๋„", + parameters: [ + { + in: "query", + name: "accessToken", + schema: { + type: "string", + }, + description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Access Token", + }, + { + in: "query", + name: "deviceToken", + schema: { + type: "string", + }, + description: "Device Token", + }, + ], + responses: { + 200: { + description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", + content: { + "text/html": { + example: "success", }, - description: "๋งŒ๋ฃŒ๋œ ์œ ํšจํ•œ JWT Access Token", }, - { - in: "query", - name: "refreshToken", - schema: { - type: "string", + }, + 400: { + content: { + "text/html": { + example: "invalid request", }, - description: "๋งŒ๋ฃŒ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Refresh Token", - }, - ], - responses: { - 200: { - content: { - "application/json": { - schema: { - type: "object", - properties: { - accessToken: { - type: "string", - description: "์ƒˆ๋กœ์šด JWT Access Token", - }, - refreshToken: { - type: "string", - description: "์ƒˆ๋กœ์šด Refresh Token", - }, + }, + }, + 401: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + message: { + type: "string", + }, + }, + }, + examples: { + "Invalid token": { + value: { + message: "Invalid token", + }, + }, + "Expired token": { + value: { + message: "Expired token", + }, + }, + "Not Access token": { + value: { + message: "Not Access token", + }, + }, + "No corresponding user": { + value: { + message: "No corresponding user", }, }, }, }, }, }, + 500: { + content: { + "text/html": { + example: "server error", + }, + }, + }, }, }, - "/auth/app/device": { - post: { - tags: ["/auth"], - summary: "๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก", - description: "App ๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก", - requestBody: { +}; + +authDocs[`${apiPrefix}/app/token/refresh`] = { + get: { + tags: [tag], + summary: "๋งŒ๋ฃŒ๋œ Access Token ๊ฐฑ์‹ ", + description: "์•ฑ์—์„œ Access Token์„ Refresh Token์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐฑ์‹ ", + parameters: [ + { + in: "query", + name: "accessToken", + schema: { + type: "string", + }, + description: "๋งŒ๋ฃŒ๋œ ์œ ํšจํ•œ JWT Access Token", + }, + { + in: "query", + name: "refreshToken", + schema: { + type: "string", + }, + description: "๋งŒ๋ฃŒ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Refresh Token", + }, + ], + responses: { + 200: { content: { "application/json": { schema: { @@ -207,69 +248,179 @@ const authDocs = { properties: { accessToken: { type: "string", - description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Access Token", + description: "์ƒˆ๋กœ์šด JWT Access Token", }, - deviceToken: { + refreshToken: { type: "string", - description: - "Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” Device Token", + description: "์ƒˆ๋กœ์šด Refresh Token", }, }, }, }, }, }, - responses: { - 200: { - description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", - content: { - "text/plain": { - schema: { - type: "string", - exapmle: "success", - }, - }, - }, + 400: { + "text/html": { + example: "invalid request", }, }, - }, - delete: { - tags: ["/auth"], - summary: "๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์‚ญ์ œ", - description: "App ๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์‚ญ์ œ", - requestBody: { + 401: { content: { "application/json": { schema: { type: "object", properties: { - accessToken: { + message: { type: "string", - description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT accessToken", }, - deviceToken: { - type: "string", - description: "Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” DeviceToken", + }, + }, + examples: { + "Invalid access token": { + value: { + message: "Invalid access token", + }, + }, + "Invalid token": { + value: { + message: "Invalid token", }, }, + "Expired token": { + value: { + message: "Expired token", + }, + }, + "Not Refresh token": { + value: { + message: "Not Refresh token", + }, + }, + }, + }, + }, + }, + 501: { + content: { + "text/html": { + example: "server error", + }, + }, + }, + }, + }, +}; + +authDocs[`${apiPrefix}/app/device`] = { + post: { + tags: [tag], + summary: "๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก", + description: "App ๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ฑ๋ก", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + accessToken: { + type: "string", + description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT Access Token", + }, + deviceToken: { + type: "string", + description: "Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” Device Token", + }, }, }, }, }, - responses: { - 200: { - description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", - content: { - "text/plain": { - schema: { + }, + responses: { + 200: { + description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", + content: { + "text/html": { + example: "success", + }, + }, + }, + 400: { + content: { + "text/html": { + example: "invalid request", + }, + }, + }, + 401: { + content: { + "text/html": { + example: "unauthorized", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "server error", + }, + }, + }, + }, + }, + delete: { + tags: [tag], + summary: "๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์‚ญ์ œ", + description: "App ๊ธฐ๊ธฐ์˜ Device Token์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์‚ญ์ œ", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + accessToken: { + type: "string", + description: "๋งŒ๋ฃŒ ๋˜์ง€ ์•Š์€ ์œ ํšจํ•œ JWT accessToken", + }, + deviceToken: { type: "string", - exapmle: "success", + description: "Firebase ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” DeviceToken", }, }, }, }, }, }, + responses: { + 200: { + description: "์„ฑ๊ณต ๋ฉ”์„ธ์ง€", + content: { + "text/html": { + example: "success", + }, + }, + }, + 400: { + content: { + "text/html": { + example: "invalid request", + }, + }, + }, + 401: { + content: { + "text/html": { + example: "unauthorized", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "server error", + }, + }, + }, + }, }, }; From b4fbb4296407146aedc9eff707aabff64240f6a0 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 2 Nov 2023 16:26:41 +0000 Subject: [PATCH 061/108] Docs: rollback name --- src/routes/docs/swaggerDocs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index 5f00d08e..796a71f6 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -14,19 +14,19 @@ const swaggerDocs = { basePath: "/", tags: [ { - name: "/locations", + name: "locations", description: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ์ œ๊ณต", }, { - name: "/logininfo", + name: "logininfo", description: "๋กœ๊ทธ์ธ ์ •๋ณด ์ œ๊ณต", }, { - name: "/reports", + name: "reports", description: "์‚ฌ์šฉ์ž ์‹ ๊ณ  ๋ฐ ์‹ ๊ณ  ๊ธฐ๋ก ์กฐํšŒ", }, { - name: "/auth", + name: "auth", description: "์‚ฌ์šฉ์ž ์ƒ์„ฑ, ๋กœ๊ทธ์ธ, ๋กœ๊ทธ์•„์›ƒ ๋“ฑ ์‚ฌ์šฉ์ž ์ƒํƒœ ๊ด€๋ฆฌ ์ง€์›", }, { From e7d1e3c808976de1d19c4a4ba26f73dcae92a073 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 2 Nov 2023 16:27:06 +0000 Subject: [PATCH 062/108] Docs: align docs style with the recent documents --- src/routes/docs/locations.js | 93 +++++++++---------- src/routes/docs/logininfo.js | 170 ++++++++++++++++++----------------- src/routes/docs/reports.js | 87 +++++++++--------- 3 files changed, 178 insertions(+), 172 deletions(-) diff --git a/src/routes/docs/locations.js b/src/routes/docs/locations.js index 6f7d3847..1fb445b9 100644 --- a/src/routes/docs/locations.js +++ b/src/routes/docs/locations.js @@ -1,52 +1,53 @@ -const locationsDocs = { - "/locations": { - get: { - tags: ["/locations"], - summary: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ๋ฐ˜ํ™˜", - description: - "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
\n (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)", - responses: { - 200: { - description: - "์„œ๋ฒ„์— ์ €์žฅ๋œ location์ด ์—†์„ ๊ฒฝ์šฐ, locations์€ ๋นˆ ๋ฐฐ์—ด", - content: { - "application/json": { - schema: { - type: "object", - properties: { - locations: { - type: "array", - description: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก", - items: { - type: "object", - properties: { - priority: { - type: "number", - }, - isValid: { - type: "boolean", - }, - _id: { - type: "string", - }, - koName: { - type: "string", - description: "์žฅ์†Œ์˜ ํ•œ๊ตญ์–ด ๋ช…์นญ", - example: "ํƒ์‹œ์Šน๊ฐ•์žฅ", - }, - enName: { - type: "string", - description: "์žฅ์†Œ์˜ ์˜์–ด ๋ช…์นญ", - example: "Taxi Stand", - }, +const tag = "locations"; +const apiPrefix = "/locations"; + +const locationsDocs = {}; +locationsDocs[`${apiPrefix}`] = { + get: { + tags: [tag], + summary: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ๋ฐ˜ํ™˜", + description: + "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
\n (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)", + responses: { + 200: { + description: "์„œ๋ฒ„์— ์ €์žฅ๋œ location์ด ์—†์„ ๊ฒฝ์šฐ, locations์€ ๋นˆ ๋ฐฐ์—ด", + content: { + "application/json": { + schema: { + type: "object", + properties: { + locations: { + type: "array", + description: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก", + items: { + type: "object", + properties: { + priority: { + type: "number", + }, + isValid: { + type: "boolean", + }, + _id: { + type: "string", + }, + koName: { + type: "string", + description: "์žฅ์†Œ์˜ ํ•œ๊ตญ์–ด ๋ช…์นญ", + example: "ํƒ์‹œ์Šน๊ฐ•์žฅ", + }, + enName: { + type: "string", + description: "์žฅ์†Œ์˜ ์˜์–ด ๋ช…์นญ", + example: "Taxi Stand", }, }, }, - serverTime: { - type: "string", - format: "date-time", - description: "์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ", - }, + }, + serverTime: { + type: "string", + format: "date-time", + description: "์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ", }, }, }, diff --git a/src/routes/docs/logininfo.js b/src/routes/docs/logininfo.js index 95df5967..e752d3b0 100644 --- a/src/routes/docs/logininfo.js +++ b/src/routes/docs/logininfo.js @@ -1,89 +1,91 @@ -const logininfoDocs = { - "/logininfo": { - get: { - tags: ["/logininfo"], - summary: "์‚ฌ์šฉ์ž ์ •๋ณด ๋ฐ˜ํ™˜", - description: "๋กœ๊ทธ์ธ๋˜์–ด ์žˆ๋Š” ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜", - responses: { - 200: { - description: - "์‚ฌ์šฉ์ž์˜ ๋กœ๊ทธ์ธ ์„ธ์…˜์ด ์œ ํšจํ•œ ๊ฒฝ์šฐ, ํ˜„์žฌ ๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜,
\n ์„ธ์…˜์ด ์œ ํšจํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ, ๋นˆ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐ˜ํ™˜", - content: { - "application/json": { - schema: { - type: "object", - properties: { - oid: { - type: "string", - }, - id: { - type: "string", - description: "์‚ฌ์šฉ์ž id", - }, - name: { - type: "string", - description: "์‚ฌ์šฉ์ž ์ด๋ฆ„", - }, - nickname: { - type: "string", - }, - withdraw: { - type: "boolean", - }, - phoneNumber: { - type: "string", - description: "์‚ฌ์šฉ์ž ์ „ํ™”๋ฒˆํ˜ธ", - }, - ban: { - type: "boolean", - }, - joinat: { - type: "string", - format: "date-time", - }, - agreeOnTermsOfService: { - type: "boolean", - }, - subinfo: { - type: "object", - properties: { - kaist: { - type: "string", - description: "KAIST ํ•™๋ฒˆ(8์ž๋ฆฌ)", - minLength: 8, - maxLength: 8, - example: "20190052", - }, - sparcs: { - type: "string", - }, - facebook: { - type: "string", - }, - twitter: { - type: "string", - }, +const tag = "logininfo"; +const apiPrefix = "/logininfo"; + +const logininfoDocs = {}; +logininfoDocs[`${apiPrefix}`] = { + get: { + tags: [tag], + summary: "์‚ฌ์šฉ์ž ์ •๋ณด ๋ฐ˜ํ™˜", + description: "๋กœ๊ทธ์ธ๋˜์–ด ์žˆ๋Š” ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜", + responses: { + 200: { + description: + "์‚ฌ์šฉ์ž์˜ ๋กœ๊ทธ์ธ ์„ธ์…˜์ด ์œ ํšจํ•œ ๊ฒฝ์šฐ, ํ˜„์žฌ ๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜,
\n ์„ธ์…˜์ด ์œ ํšจํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ, ๋นˆ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐ˜ํ™˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + oid: { + type: "string", + }, + id: { + type: "string", + description: "์‚ฌ์šฉ์ž id", + }, + name: { + type: "string", + description: "์‚ฌ์šฉ์ž ์ด๋ฆ„", + }, + nickname: { + type: "string", + }, + withdraw: { + type: "boolean", + }, + phoneNumber: { + type: "string", + description: "์‚ฌ์šฉ์ž ์ „ํ™”๋ฒˆํ˜ธ", + }, + ban: { + type: "boolean", + }, + joinat: { + type: "string", + format: "date-time", + }, + agreeOnTermsOfService: { + type: "boolean", + }, + subinfo: { + type: "object", + properties: { + kaist: { + type: "string", + description: "KAIST ํ•™๋ฒˆ(8์ž๋ฆฌ)", + minLength: 8, + maxLength: 8, + example: "20190052", + }, + sparcs: { + type: "string", + }, + facebook: { + type: "string", + }, + twitter: { + type: "string", }, }, - email: { - type: "string", - example: "geon6757@kaist.ac.kr", - }, - profileImgUrl: { - type: "string", - }, - account: { - type: "string", - }, - deviceToken: { - type: "string", - description: - "ํด๋ผ์ด์–ธํŠธ์˜ ๋””๋ฐ”์ด์Šค ํ† ํฐ, ์„ธ์…˜์— ์ €์žฅ๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ undefined", - }, - deviceType: { - type: "string", - enum: ["web", "app"], - }, + }, + email: { + type: "string", + example: "geon6757@kaist.ac.kr", + }, + profileImgUrl: { + type: "string", + }, + account: { + type: "string", + }, + deviceToken: { + type: "string", + description: + "ํด๋ผ์ด์–ธํŠธ์˜ ๋””๋ฐ”์ด์Šค ํ† ํฐ, ์„ธ์…˜์— ์ €์žฅ๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ undefined", + }, + deviceType: { + type: "string", + enum: ["web", "app"], }, }, }, diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index 22eab8f0..b2e3b035 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -1,54 +1,57 @@ -const reportsDocs = { - "/reports/create": { - post: { - tags: ["/reports"], - summary: "์‹ ๊ณ  ์ž‘์„ฑ", - description: "์ฃผ์–ด์ง„ ์œ ์ €๋ฅผ ์ „๋‹ฌ๋œ ์‚ฌ์œ ๋กœ ์‹ ๊ณ ํ•จ", - requestBody: { - description: "Update an existent user in the store", - content: { - "application/json": { - schema: { - $ref: "#/components/schemas/createHandler", - }, +const tag = "reports"; +const apiPrefix = "/reports"; + +const reportsDocs = {}; +reportsDocs[`${apiPrefix}/create`] = { + post: { + tags: [tag], + summary: "์‹ ๊ณ  ์ž‘์„ฑ", + description: "์ฃผ์–ด์ง„ ์œ ์ €๋ฅผ ์ „๋‹ฌ๋œ ์‚ฌ์œ ๋กœ ์‹ ๊ณ ํ•จ", + requestBody: { + description: "Update an existent user in the store", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/createHandler", }, }, }, - responses: { - 200: { - description: "report successful", - content: { - "text/plain": { - schema: { - type: "string", - example: "report successful", - }, + }, + responses: { + 200: { + description: "report successful", + content: { + "text/plain": { + schema: { + type: "string", + example: "report successful", }, }, }, }, }, }, - "/reports/searchByUser": { - get: { - tags: ["/reports"], - summary: "์‹ ๊ณ  ๋‚ด์—ญ ๋ฐ˜ํ™˜", - description: - "๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์‹ ๊ณ ํ•œ ๋‚ด์—ญ๊ณผ, ์‹ ๊ณ ๋ฐ›์€ ๋‚ด์—ญ์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค
1000๊ฐœ์˜ limit์ด ์žˆ๋‹ค.", - responses: { - 200: { - description: "์‹ ๊ณ ๋œ ๋‚ด์—ญ๊ณผ ์‹ ๊ณ  ๋ฐ›์€ ๋‚ด์—ญ", - content: { - "application/json": { - schema: { - type: "object", - properties: { - reporting: { - type: "array", - }, - reported: { - type: "array", - }, +}; + +reportsDocs[`${apiPrefix}/searchByUser`] = { + get: { + tags: [tag], + summary: "์‹ ๊ณ  ๋‚ด์—ญ ๋ฐ˜ํ™˜", + description: + "๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์‹ ๊ณ ํ•œ ๋‚ด์—ญ๊ณผ, ์‹ ๊ณ ๋ฐ›์€ ๋‚ด์—ญ์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค
1000๊ฐœ์˜ limit์ด ์žˆ๋‹ค.", + responses: { + 200: { + description: "์‹ ๊ณ ๋œ ๋‚ด์—ญ๊ณผ ์‹ ๊ณ  ๋ฐ›์€ ๋‚ด์—ญ", + content: { + "application/json": { + schema: { + type: "object", + properties: { + reporting: { + type: "array", + }, + reported: { + type: "array", }, }, }, From 2301c54b1e42e223a642c0197cb624c1d450e919 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 2 Nov 2023 16:31:50 +0000 Subject: [PATCH 063/108] Docs: update error message --- src/routes/docs/reports.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index b2e3b035..0f5b8e76 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -29,6 +29,14 @@ reportsDocs[`${apiPrefix}/create`] = { }, }, }, + 500: { + description: "internal server error", + content: { + "text/html": { + example: "User/report : internal server error", + }, + }, + }, }, }, }; @@ -58,6 +66,14 @@ reportsDocs[`${apiPrefix}/searchByUser`] = { }, }, }, + 500: { + description: "internal server error", + content: { + "text/html": { + example: "report/searchByUser : internal server error", + }, + }, + }, }, }, }; From 28606c64935949c8dd6faa929926fc7a57f41203 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 2 Nov 2023 17:09:24 +0000 Subject: [PATCH 064/108] Fix: add server in the swagger option --- src/routes/docs/swaggerDocs.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index c6c13060..bfefe09f 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -3,6 +3,25 @@ const reportsDocs = require("./reports"); const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); const usersDocs = require("./users"); +const { port, nodeEnv } = require("../../../loadenv"); + +const serverList = [ + { + url: `http://localhost:${port}`, + description: "local api server", + type: "development", + }, + { + url: "https://taxi.sparcs.org/api", + description: "taxi main api server", + type: "production", + }, + { + url: "https://taxi.dev.sparcs.org/api", + description: "taxi dev api server", + type: "production", + }, +]; const swaggerDocs = { openapi: "3.0.3", @@ -11,6 +30,7 @@ const swaggerDocs = { version: "1.0.0", }, basePath: "/", + servers: serverList.filter((server) => server.type === nodeEnv), tags: [ { name: "locations", From aa330f4ce136161acc6e43eceb96585a7fbc63f9 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 2 Nov 2023 17:16:39 +0000 Subject: [PATCH 065/108] Fix: change serverList to test all servers in local --- src/routes/docs/swaggerDocs.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index bfefe09f..5c1e3428 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -9,17 +9,20 @@ const serverList = [ { url: `http://localhost:${port}`, description: "local api server", - type: "development", + development: true, + production: false, }, { url: "https://taxi.sparcs.org/api", description: "taxi main api server", - type: "production", + development: true, + production: true, }, { url: "https://taxi.dev.sparcs.org/api", description: "taxi dev api server", - type: "production", + development: true, + production: false, }, ]; @@ -30,7 +33,7 @@ const swaggerDocs = { version: "1.0.0", }, basePath: "/", - servers: serverList.filter((server) => server.type === nodeEnv), + servers: serverList.filter((server) => server[nodeEnv]), tags: [ { name: "locations", From 89d47913e51225beb5709748d6e9529355a5a1f1 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 7 Nov 2023 20:09:35 +0900 Subject: [PATCH 066/108] Fix: remove rolling session --- app.js | 4 ++-- loadenv.js | 9 ++++++--- src/middlewares/session.js | 11 ++++++----- src/modules/auths/login.js | 7 ++++--- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app.js b/app.js index 3394dec0..dd84e322 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ // ๋ชจ๋“ˆ require const express = require("express"); const http = require("http"); -const { port: httpPort, eventConfig } = require("./loadenv"); +const { nodeEnv, port: httpPort, eventConfig } = require("./loadenv"); const logger = require("./src/modules/logger"); const { connectDatabase } = require("./src/modules/stores/mongo"); const { startSocketServer } = require("./src/modules/socket"); @@ -20,7 +20,7 @@ app.use(express.urlencoded({ extended: false })); app.use(express.json()); // reverse proxy๊ฐ€ ์„ค์ •ํ•œ ํ—ค๋”๋ฅผ ์‹ ๋ขฐํ•ฉ๋‹ˆ๋‹ค. -app.set("trust proxy", true); +if (nodeEnv === "production") app.set("trust proxy", 1); // [Middleware] CORS ์„ค์ • app.use(require("./src/middlewares/cors")); diff --git a/loadenv.js b/loadenv.js index ce0d9dc4..f7224601 100644 --- a/loadenv.js +++ b/loadenv.js @@ -2,9 +2,12 @@ require("dotenv").config({ path: `./.env.${process.env.NODE_ENV}` }); module.exports = { - nodeEnv: process.env.NODE_ENV, + nodeEnv: process.env.NODE_ENV, // required mongo: process.env.DB_PATH, // required - session: process.env.SESSION_KEY || "TAXI_SESSION_KEY", // optional + session: { + secret: process.env.SESSION_KEY || "TAXI_SESSION_KEY", // optional + expiry: 14 * 24 * 3600 * 1000, // 14์ผ, ms ๋‹จ์œ„์ž…๋‹ˆ๋‹ค. + }, redis: process.env.REDIS_PATH, // optional sparcssso: { id: process.env.SPARCSSSO_CLIENT_ID || "", // optional @@ -40,5 +43,5 @@ module.exports = { slackWebhookUrl: { report: process.env.SLACK_REPORT_WEBHOOK_URL || "", // optional }, - eventConfig: (process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG)) + eventConfig: process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG), }; diff --git a/src/middlewares/session.js b/src/middlewares/session.js index ff6ea034..18c4db14 100644 --- a/src/middlewares/session.js +++ b/src/middlewares/session.js @@ -3,9 +3,10 @@ const redis = require("redis"); const MongoStore = require("connect-mongo"); const RedisStore = require("connect-redis")(expressSession); const { + nodeEnv, redis: redisUrl, mongo: mongoUrl, - session: sessionSecret, + session: sessionConfig, } = require("../../loadenv"); const logger = require("../modules/logger"); @@ -17,18 +18,18 @@ if (redisUrl) { legacyMode: true, }); client.connect().catch(logger.error); - sessionStore = new RedisStore({ client }); + sessionStore = new RedisStore({ client, ttl: sessionConfig.expiry }); } else { sessionStore = MongoStore.create({ mongoUrl }); } module.exports = expressSession({ - secret: sessionSecret, + secret: sessionConfig.secret, resave: false, saveUninitialized: false, store: sessionStore, cookie: { - maxAge: 14 * 24 * 3600 * 1000 /* 14์ผ */, + maxAge: sessionConfig.expiry, + secure: nodeEnv === "production", }, - rolling: true, }); diff --git a/src/modules/auths/login.js b/src/modules/auths/login.js index 8181c991..9c72434f 100644 --- a/src/modules/auths/login.js +++ b/src/modules/auths/login.js @@ -1,14 +1,15 @@ +const { session: sessionConfig } = require("../../../loadenv"); const logger = require("../logger"); const getLoginInfo = (req) => { if (req.session.loginInfo) { const { id, sid, oid, name, time } = req.session.loginInfo; const timeFlow = Date.now() - time; - if (timeFlow > 14 * 24 * 3600 * 1000 /* 14์ผ */) { - // if (timeFlow > 1 * 3600 * 1000 /* 1์‹œ๊ฐ„ */) { + // 14์ผ์ด ์ง€๋‚œ ์„ธ์…˜์— ๋Œ€ํ•ด์„œ๋Š” ๋กœ๊ทธ์ธ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. + // ์„ธ์…˜์€ ์ƒˆ๋กœ์šด ์š”์ฒญ ์‹œ ๊ฐฑ์‹ ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. + if (timeFlow > sessionConfig.expiry) { return { id: undefined, sid: undefined, oid: undefined, name: undefined }; } - req.session.loginInfo.time = Date.now(); return { id, sid, oid, name }; } return { id: undefined, sid: undefined, oid: undefined, name: undefined }; From e966ab47a513bab58e33f5bee4e6ebed0573d76a Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 7 Nov 2023 21:36:13 +0900 Subject: [PATCH 067/108] Fix: retry connection to redis when lost --- src/middlewares/session.js | 25 ++------------------ src/modules/stores/sessionStore.js | 37 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 23 deletions(-) create mode 100644 src/modules/stores/sessionStore.js diff --git a/src/middlewares/session.js b/src/middlewares/session.js index 18c4db14..5412ba1c 100644 --- a/src/middlewares/session.js +++ b/src/middlewares/session.js @@ -1,27 +1,6 @@ const expressSession = require("express-session"); -const redis = require("redis"); -const MongoStore = require("connect-mongo"); -const RedisStore = require("connect-redis")(expressSession); -const { - nodeEnv, - redis: redisUrl, - mongo: mongoUrl, - session: sessionConfig, -} = require("../../loadenv"); -const logger = require("../modules/logger"); - -// ํ™˜๊ฒฝ๋ณ€์ˆ˜ REDIS_PATH ์œ ๋ฌด์— ๋”ฐ๋ผ session ์ €์žฅ ๋ฐฉ์‹์ด ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค. -let sessionStore = null; -if (redisUrl) { - const client = redis.createClient({ - url: redisUrl, - legacyMode: true, - }); - client.connect().catch(logger.error); - sessionStore = new RedisStore({ client, ttl: sessionConfig.expiry }); -} else { - sessionStore = MongoStore.create({ mongoUrl }); -} +const { nodeEnv, session: sessionConfig } = require("../../loadenv"); +const sessionStore = require("../modules/stores/sessionStore"); module.exports = expressSession({ secret: sessionConfig.secret, diff --git a/src/modules/stores/sessionStore.js b/src/modules/stores/sessionStore.js new file mode 100644 index 00000000..fca4da55 --- /dev/null +++ b/src/modules/stores/sessionStore.js @@ -0,0 +1,37 @@ +const expressSession = require("express-session"); +const redis = require("redis"); +const MongoStore = require("connect-mongo"); +const RedisStore = require("connect-redis")(expressSession); +const { + redis: redisUrl, + mongo: mongoUrl, + session: sessionConfig, +} = require("../../../loadenv"); +const logger = require("../logger"); + +const getSessionStore = (redisUrl) => { + // ํ™˜๊ฒฝ๋ณ€์ˆ˜ REDIS_PATH ์œ ๋ฌด์— ๋”ฐ๋ผ session ์ €์žฅ ๋ฐฉ์‹์ด ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค. + if (redisUrl) { + const client = redis.createClient({ + url: redisUrl, + legacyMode: true, + }); + + // redis client ์—ฐ๊ฒฐ ์„ฑ๊ณต ์‹œ ๋กœ๊ทธ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค. + client.on("ready", () => { + logger.info("Redis session store is connected!"); + }); + + // redis client ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ 1์ดˆ์— ๋‘ ๋ฒˆ ์žฌ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค. + client.on("error", (err) => { + logger.error(err); + }); + + client.connect().catch(logger.error); + return new RedisStore({ client, ttl: sessionConfig.expiry }); + } else { + return MongoStore.create({ mongoUrl }); + } +}; + +module.exports = getSessionStore(redisUrl); From 3f991d31ddddf7e48007d692a54804e239f52473 Mon Sep 17 00:00:00 2001 From: withsang Date: Tue, 14 Nov 2023 23:54:13 +0900 Subject: [PATCH 068/108] Fix: fix trust proxy value --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index dd84e322..f8c24842 100644 --- a/app.js +++ b/app.js @@ -20,7 +20,7 @@ app.use(express.urlencoded({ extended: false })); app.use(express.json()); // reverse proxy๊ฐ€ ์„ค์ •ํ•œ ํ—ค๋”๋ฅผ ์‹ ๋ขฐํ•ฉ๋‹ˆ๋‹ค. -if (nodeEnv === "production") app.set("trust proxy", 1); +if (nodeEnv === "production") app.set("trust proxy", 2); // [Middleware] CORS ์„ค์ • app.use(require("./src/middlewares/cors")); From f1058effabf5857758f07a5190f83afde5b8faa6 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 21 Nov 2023 22:35:34 +0900 Subject: [PATCH 069/108] Remove: taxi-sample-generator submodule --- .gitmodules | 4 ---- sampleGenerator | 1 - 2 files changed, 5 deletions(-) delete mode 160000 sampleGenerator diff --git a/.gitmodules b/.gitmodules index f15db4d8..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "sampleGenerator"] - path = sampleGenerator - url = https://github.com/sparcs-kaist/taxiSampleGenerator - branch = main diff --git a/sampleGenerator b/sampleGenerator deleted file mode 160000 index bd4329c1..00000000 --- a/sampleGenerator +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bd4329c15405a09c94e7b78e19ff296b4c2d0fb3 From 3acf72fbf1ef8ba2532cdbe2a2fbb835730dbd60 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 21 Nov 2023 23:33:02 +0900 Subject: [PATCH 070/108] Remove: duplicated code from sampleGenerator --- app.js | 9 +++- src/modules/stores/mongo.js | 27 +++++----- src/sampleGenerator/index.js | 11 ++-- src/sampleGenerator/src/db/model.js | 80 ----------------------------- src/sampleGenerator/src/db/mongo.js | 30 ----------- src/sampleGenerator/src/testData.js | 32 ++---------- 6 files changed, 34 insertions(+), 155 deletions(-) delete mode 100644 src/sampleGenerator/src/db/model.js delete mode 100644 src/sampleGenerator/src/db/mongo.js diff --git a/app.js b/app.js index f8c24842..a26c4b46 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,12 @@ // ๋ชจ๋“ˆ require const express = require("express"); const http = require("http"); -const { nodeEnv, port: httpPort, eventConfig } = require("./loadenv"); +const { + nodeEnv, + port: httpPort, + eventConfig, + mongo: mongoUrl, +} = require("./loadenv"); const logger = require("./src/modules/logger"); const { connectDatabase } = require("./src/modules/stores/mongo"); const { startSocketServer } = require("./src/modules/socket"); @@ -13,7 +18,7 @@ require("./src/modules/fcm").initializeApp(); const app = express(); // ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ -connectDatabase(); +connectDatabase(mongoUrl); // [Middleware] request body ํŒŒ์‹ฑ app.use(express.urlencoded({ extended: false })); diff --git a/src/modules/stores/mongo.js b/src/modules/stores/mongo.js index f05f266a..695845fc 100755 --- a/src/modules/stores/mongo.js +++ b/src/modules/stores/mongo.js @@ -1,7 +1,6 @@ const mongoose = require("mongoose"); const Schema = mongoose.Schema; -const { mongo: mongoUrl } = require("../../../loadenv"); const logger = require("../logger"); const userSchema = Schema({ @@ -184,23 +183,27 @@ database.on("error", function (err) { logger.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ ์—๋Ÿฌ ๋ฐœ์ƒ: " + err); mongoose.disconnect(); }); -database.on("disconnected", function () { - // ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง€๋ฉด 5์ดˆ ํ›„ ์žฌ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค. - logger.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); - setTimeout(() => { - mongoose.connect(mongoUrl, { - useNewUrlParser: true, - useUnifiedTopology: true, - }); - }, 5000); -}); -const connectDatabase = () => +const connectDatabase = (mongoUrl) => { + database.on("disconnected", function () { + // ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง€๋ฉด 5์ดˆ ํ›„ ์žฌ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค. + logger.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); + setTimeout(() => { + mongoose.connect(mongoUrl, { + useNewUrlParser: true, + useUnifiedTopology: true, + }); + }, 5000); + }); + mongoose.connect(mongoUrl, { useNewUrlParser: true, useUnifiedTopology: true, }); + return database; +}; + module.exports = { connectDatabase, userModel: mongoose.model("User", userSchema), diff --git a/src/sampleGenerator/index.js b/src/sampleGenerator/index.js index f9e6391a..506f5e04 100644 --- a/src/sampleGenerator/index.js +++ b/src/sampleGenerator/index.js @@ -4,10 +4,15 @@ const { generateSampleLocations, generateChats, } = require("./src/testData"); +const { connectDatabase } = require("../modules/stores/mongo"); +const { + loadSampleData, + numberOfRooms, + numberOfChats, + mongo: mongoUrl, +} = require("./security"); -const database = require("./src/db/mongo").connection; - -const { loadSampleData, numberOfRooms, numberOfChats } = require("./security"); +const database = connectDatabase(mongoUrl); const main = async () => { await database.db.dropDatabase(); diff --git a/src/sampleGenerator/src/db/model.js b/src/sampleGenerator/src/db/model.js deleted file mode 100644 index d07e5fa4..00000000 --- a/src/sampleGenerator/src/db/model.js +++ /dev/null @@ -1,80 +0,0 @@ -const mongoose = require("./mongo"); -const Schema = mongoose.Schema; - -const userSchema = Schema({ - name: { type: String, required: true }, //์‹ค๋ช… - nickname: { type: String, required: true }, //๋‹‰๋„ค์ž„ - id: { type: String, required: true, unique: true }, //ํƒ์‹œ ์„œ๋น„์Šค์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” id - profileImageUrl: { type: String, required: true }, //๋ฐฑ์—”๋“œ์—์„œ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ - ongoingRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ ๋ฐฐ์—ด - doneRoom: [{ type: Schema.Types.ObjectId, ref: "Room" }], // ์ฐธ์—ฌ์ค‘์ธ ์™„๋ฃŒ๋œ ๋ฐฉ ๋ฐฐ์—ด - withdraw: { type: Boolean, default: false }, - ban: { type: Boolean, default: false }, //๊ณ„์ • ์ •์ง€ ์—ฌ๋ถ€ - joinat: { type: Date, required: true }, //๊ฐ€์ž… ์‹œ๊ฐ - agreeOnTermsOfService: { type: Boolean, default: false }, //์ด์šฉ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€ - subinfo: { - kaist: { type: String, default: "" }, - sparcs: { type: String, default: "" }, - facebook: { type: String, default: "" }, - twitter: { type: String, default: "" }, - }, - email: { type: String, required: true }, - isAdmin: { type: Boolean, default: false }, //๊ด€๋ฆฌ์ž ์—ฌ๋ถ€ -}); - -const participantSchema = Schema({ - user: { type: Schema.Types.ObjectId, ref: "User", required: true }, - settlementStatus: { - type: String, - required: true, - enum: ["not-departed", "paid", "send-required", "sent"], - default: "not-departed", - }, -}); - -const roomSchema = Schema({ - name: { type: String, required: true, default: "์ด๋ฆ„ ์—†์Œ", text: true }, - from: { type: Schema.Types.ObjectId, ref: "Location", required: true }, - to: { type: Schema.Types.ObjectId, ref: "Location", required: true }, - time: { type: Date, required: true }, // ์ถœ๋ฐœ ์‹œ๊ฐ„ - part: { - type: [participantSchema], - validate: [ - function (value) { - return value.length <= this.maxPartLength; - }, - ], - }, // ์ฐธ์—ฌ ๋ฉค๋ฒ„ ๋ฐ ์ •์‚ฐ ์—ฌ๋ถ€ - madeat: { type: Date, required: true }, // ์ƒ์„ฑ ๋‚ ์งœ - settlementTotal: { type: Number, default: 0, required: true }, - isOver: { type: Boolean, default: false, required: true }, - maxPartLength: { type: Number, require: true, default: 4 }, -}); - -const locationSchema = Schema({ - enName: { type: String, required: true }, - koName: { type: String, required: true }, - // latitude: { type: Number, required: true }, - // longitude: { type: Number, required: true } -}); -const chatSchema = Schema({ - roomId: { type: Schema.Types.ObjectId, ref: "Room", required: true }, - type: { type: String }, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜ (text|in|out|s3img) - authorId: { type: Schema.Types.ObjectId, ref: "User", required: true }, // ์ž‘์„ฑ์ž id - content: { type: String, default: "" }, - time: { type: Date, required: true }, - isValid: { type: Boolean, default: true }, -}); -chatSchema.index({ roomId: 1, time: -1 }); - -const userModel = mongoose.model("User", userSchema); -const roomModel = mongoose.model("Room", roomSchema); -const locationModel = mongoose.model("Location", locationSchema); -const chatModel = mongoose.model("Chat", chatSchema); - -module.exports = { - userModel, - roomModel, - locationModel, - chatModel, -}; diff --git a/src/sampleGenerator/src/db/mongo.js b/src/sampleGenerator/src/db/mongo.js deleted file mode 100644 index b1ef7bbd..00000000 --- a/src/sampleGenerator/src/db/mongo.js +++ /dev/null @@ -1,30 +0,0 @@ -const mongoose = require("mongoose"); -const security = require("../../security"); - -const database = mongoose.connection; - -database.on("error", console.error.bind(console, "mongoose connection error.")); - -database.on("connected", async () => { - console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); -}); - -database.on("error", function (err) { - console.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ ์—๋Ÿฌ ๋ฐœ์ƒ: " + err); - mongoose.disconnect(); -}); - -database.on("disconnected", function () { - console.log("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); - mongoose.connect(security.mongo, { - useNewUrlParser: true, - useUnifiedTopology: true, - }); -}); - -mongoose.connect(security.mongo, { - useNewUrlParser: true, - useUnifiedTopology: true, -}); - -module.exports = mongoose; diff --git a/src/sampleGenerator/src/testData.js b/src/sampleGenerator/src/testData.js index b54eddbc..db537cae 100644 --- a/src/sampleGenerator/src/testData.js +++ b/src/sampleGenerator/src/testData.js @@ -3,34 +3,10 @@ const { roomModel, locationModel, chatModel, -} = require("./db/model"); -const crypto = require("crypto"); -const security = require("../security"); +} = require("../../modules/stores/mongo"); +const { generateProfileImageUrl } = require("../../modules/modifyProfile"); -//์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ url๋“ค -const defaultProfile = [ - "CatGeoul.png", - "CatGreen.png", - "CatJabo.png", - "CatOTL.png", - "CatTaxi.png", - "GooseGeoul.png", - "GooseGreen.png", - "GooseJabo.png", - "GooseOTL.png", - "GooseTaxi.png", - "NupjukGeoul.png", - "NupjukGreen.png", - "NupjukJabo.png", - "NupjukOTL.png", - "NupjukTaxi.png", -]; - -// ๊ธฐ์กด ํ”„๋กœํ•„ ์‚ฌ์ง„์˜ URI ์ค‘ ํ•˜๋‚˜๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒํ•ด ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. -const generateProfileImageUrl = () => { - const ridx = crypto.randomInt(defaultProfile.length); - return `default/${defaultProfile[ridx]}`; -}; +const security = require("../security"); const generateUser = async (id, num, isAdmin) => { const newUser = new userModel({ @@ -40,7 +16,7 @@ const generateUser = async (id, num, isAdmin) => { profileImageUrl: generateProfileImageUrl(), joinat: Date.now(), subinfo: { - kaist: new String(20220000 + num), + kaist: new String(20230000 + num), // ^-^ sparcs: "", facebook: "", twitter: "", From 5f8e6c27579405890c3140d2b9522a106ad78e0e Mon Sep 17 00:00:00 2001 From: static Date: Tue, 21 Nov 2023 23:35:35 +0900 Subject: [PATCH 071/108] Refactor: package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fecc4769..8347a949 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "mocha": "cross-env TZ='Asia/Seoul' NODE_ENV=test mocha --recursive --reporter spec --exit", "serve": "cross-env TZ='Asia/Seoul' NODE_ENV=production node app.js", "lint": "npx eslint --fix .", - "sample": "cd sampleGenerator && npm start && cd .." + "sample": "cd src/sampleGenerator && npm start && cd .." }, "engines": { "node": ">=18.0.0", From 8caf7c8c84af615219f95e770b487e542faed773 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 21 Nov 2023 23:49:33 +0900 Subject: [PATCH 072/108] Fix: CI error --- .github/workflows/test_ci.yml | 8 - src/sampleGenerator/README.md | 4 +- src/sampleGenerator/package.json | 16 +- src/sampleGenerator/pnpm-lock.yaml | 731 ----------------------------- 4 files changed, 2 insertions(+), 757 deletions(-) delete mode 100644 src/sampleGenerator/pnpm-lock.yaml diff --git a/.github/workflows/test_ci.yml b/.github/workflows/test_ci.yml index 29f7f21b..5186842b 100644 --- a/.github/workflows/test_ci.yml +++ b/.github/workflows/test_ci.yml @@ -29,20 +29,12 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'pnpm' - - id: submodule-local - name: Save local version of submodule - run: echo "ver=`cd sampleGenerator && git log --pretty="%h" -1 && cd ..`" >> $GITHUB_OUTPUT - - id: submodule-origin - name: Save origin version of submodule - run: echo "ver=`cd sampleGenerator && git log origin --pretty="%h" -1 && cd ..`" >> $GITHUB_OUTPUT - name: Check submodule version if: ${{ steps.submodule-local.outputs.ver != steps.submodule-origin.outputs.ver }} uses: actions/github-script@v3 with: script: | core.setFailed('Please update submodule to the latest version by using \"git submodule update --remote\"') - - name: Install sampleGenerator dependencies from package-lock.json - run: cd sampleGenerator && pnpm i --force --frozen-lockfile && cd .. - name: Install taxi-back dependencies from package-lock.json run: pnpm i --force --frozen-lockfile - name: Run unit tests diff --git a/src/sampleGenerator/README.md b/src/sampleGenerator/README.md index d39e8f31..2a6ea910 100644 --- a/src/sampleGenerator/README.md +++ b/src/sampleGenerator/README.md @@ -8,9 +8,7 @@ **SETUP** -1. ๋กœ์ปฌ ์ €์žฅ์†Œ์— ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋ฅผ ํด๋ก ํ•ฉ๋‹ˆ๋‹ค. -1. `pnpm install`๋กœ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. -1. ํด๋ก ํ•œ ๋””๋ ‰ํ† ๋ฆฌ(index.js๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. +1. ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ(README.md ํŒŒ์ผ์ด ์žˆ๋Š” ๊ณณ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ``` #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) DB_PATH=mongodb://localhost:27017/local diff --git a/src/sampleGenerator/package.json b/src/sampleGenerator/package.json index 50e738bf..3c7473bc 100644 --- a/src/sampleGenerator/package.json +++ b/src/sampleGenerator/package.json @@ -10,22 +10,8 @@ "dumpDB": "node tools/dump.js", "restoreDB": "node tools/restore.js" }, - "repository": { - "type": "git", - "url": "git+https://github.com/withSang/taxiSampleGenerator.git" - }, "keywords": [ "test" ], - "author": "withSang", - "license": "ISC", - "bugs": { - "url": "https://github.com/withSang/taxiSampleGenerator/issues" - }, - "homepage": "https://github.com/withSang/taxiSampleGenerator#readme", - "dependencies": { - "dotenv": "^16.0.0", - "eslint": "^8.9.0", - "mongoose": "^6.5.2" - } + "license": "ISC" } diff --git a/src/sampleGenerator/pnpm-lock.yaml b/src/sampleGenerator/pnpm-lock.yaml deleted file mode 100644 index 12efb0de..00000000 --- a/src/sampleGenerator/pnpm-lock.yaml +++ /dev/null @@ -1,731 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -dependencies: - dotenv: - specifier: ^16.0.0 - version: 16.0.0 - eslint: - specifier: ^8.9.0 - version: 8.9.0 - mongoose: - specifier: ^6.5.2 - version: 6.5.2 - -packages: - - /@eslint/eslintrc@1.1.0: - resolution: {integrity: sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - ajv: 6.12.6 - debug: 4.3.3 - espree: 9.3.1 - globals: 13.12.1 - ignore: 4.0.6 - import-fresh: 3.3.0 - js-yaml: 4.1.0 - minimatch: 3.1.2 - strip-json-comments: 3.1.1 - transitivePeerDependencies: - - supports-color - dev: false - - /@humanwhocodes/config-array@0.9.3: - resolution: {integrity: sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==} - engines: {node: '>=10.10.0'} - dependencies: - '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.3 - minimatch: 3.1.2 - transitivePeerDependencies: - - supports-color - dev: false - - /@humanwhocodes/object-schema@1.2.1: - resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} - dev: false - - /@types/node@18.7.3: - resolution: {integrity: sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w==} - dev: false - - /@types/webidl-conversions@6.1.1: - resolution: {integrity: sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==} - dev: false - - /@types/whatwg-url@8.2.2: - resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==} - dependencies: - '@types/node': 18.7.3 - '@types/webidl-conversions': 6.1.1 - dev: false - - /acorn-jsx@5.3.2(acorn@8.7.0): - resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} - peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - dependencies: - acorn: 8.7.0 - dev: false - - /acorn@8.7.0: - resolution: {integrity: sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: false - - /ajv@6.12.6: - resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - dependencies: - fast-deep-equal: 3.1.3 - fast-json-stable-stringify: 2.1.0 - json-schema-traverse: 0.4.1 - uri-js: 4.4.1 - dev: false - - /ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - dev: false - - /ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - dependencies: - color-convert: 2.0.1 - dev: false - - /argparse@2.0.1: - resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: false - - /balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: false - - /base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: false - - /brace-expansion@1.1.11: - resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - dependencies: - balanced-match: 1.0.2 - concat-map: 0.0.1 - dev: false - - /bson@4.6.5: - resolution: {integrity: sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==} - engines: {node: '>=6.9.0'} - dependencies: - buffer: 5.7.1 - dev: false - - /buffer@5.7.1: - resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - dev: false - - /callsites@3.1.0: - resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} - engines: {node: '>=6'} - dev: false - - /chalk@4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: false - - /color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - dependencies: - color-name: 1.1.4 - dev: false - - /color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: false - - /concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - dev: false - - /cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} - engines: {node: '>= 8'} - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - dev: false - - /debug@4.3.3: - resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: false - - /deep-is@0.1.4: - resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - dev: false - - /denque@2.1.0: - resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} - engines: {node: '>=0.10'} - dev: false - - /doctrine@3.0.0: - resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} - engines: {node: '>=6.0.0'} - dependencies: - esutils: 2.0.3 - dev: false - - /dotenv@16.0.0: - resolution: {integrity: sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==} - engines: {node: '>=12'} - dev: false - - /escape-string-regexp@4.0.0: - resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} - engines: {node: '>=10'} - dev: false - - /eslint-scope@7.1.1: - resolution: {integrity: sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - esrecurse: 4.3.0 - estraverse: 5.3.0 - dev: false - - /eslint-utils@3.0.0(eslint@8.9.0): - resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} - engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} - peerDependencies: - eslint: '>=5' - dependencies: - eslint: 8.9.0 - eslint-visitor-keys: 2.1.0 - dev: false - - /eslint-visitor-keys@2.1.0: - resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} - engines: {node: '>=10'} - dev: false - - /eslint-visitor-keys@3.3.0: - resolution: {integrity: sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: false - - /eslint@8.9.0: - resolution: {integrity: sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true - dependencies: - '@eslint/eslintrc': 1.1.0 - '@humanwhocodes/config-array': 0.9.3 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.3 - debug: 4.3.3 - doctrine: 3.0.0 - escape-string-regexp: 4.0.0 - eslint-scope: 7.1.1 - eslint-utils: 3.0.0(eslint@8.9.0) - eslint-visitor-keys: 3.3.0 - espree: 9.3.1 - esquery: 1.4.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 - functional-red-black-tree: 1.0.1 - glob-parent: 6.0.2 - globals: 13.12.1 - ignore: 5.2.0 - import-fresh: 3.3.0 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - js-yaml: 4.1.0 - json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.1 - regexpp: 3.2.0 - strip-ansi: 6.0.1 - strip-json-comments: 3.1.1 - text-table: 0.2.0 - v8-compile-cache: 2.3.0 - transitivePeerDependencies: - - supports-color - dev: false - - /espree@9.3.1: - resolution: {integrity: sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - acorn: 8.7.0 - acorn-jsx: 5.3.2(acorn@8.7.0) - eslint-visitor-keys: 3.3.0 - dev: false - - /esquery@1.4.0: - resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} - engines: {node: '>=0.10'} - dependencies: - estraverse: 5.3.0 - dev: false - - /esrecurse@4.3.0: - resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} - engines: {node: '>=4.0'} - dependencies: - estraverse: 5.3.0 - dev: false - - /estraverse@5.3.0: - resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} - engines: {node: '>=4.0'} - dev: false - - /esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - dev: false - - /fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - dev: false - - /fast-json-stable-stringify@2.1.0: - resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - dev: false - - /fast-levenshtein@2.0.6: - resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - dev: false - - /file-entry-cache@6.0.1: - resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} - engines: {node: ^10.12.0 || >=12.0.0} - dependencies: - flat-cache: 3.0.4 - dev: false - - /flat-cache@3.0.4: - resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} - engines: {node: ^10.12.0 || >=12.0.0} - dependencies: - flatted: 3.2.5 - rimraf: 3.0.2 - dev: false - - /flatted@3.2.5: - resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==} - dev: false - - /fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: false - - /functional-red-black-tree@1.0.1: - resolution: {integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==} - dev: false - - /glob-parent@6.0.2: - resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} - engines: {node: '>=10.13.0'} - dependencies: - is-glob: 4.0.3 - dev: false - - /glob@7.2.0: - resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: false - - /globals@13.12.1: - resolution: {integrity: sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==} - engines: {node: '>=8'} - dependencies: - type-fest: 0.20.2 - dev: false - - /has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - dev: false - - /ieee754@1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - dev: false - - /ignore@4.0.6: - resolution: {integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==} - engines: {node: '>= 4'} - dev: false - - /ignore@5.2.0: - resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} - engines: {node: '>= 4'} - dev: false - - /import-fresh@3.3.0: - resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} - engines: {node: '>=6'} - dependencies: - parent-module: 1.0.1 - resolve-from: 4.0.0 - dev: false - - /imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - dev: false - - /inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - dev: false - - /inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: false - - /ip@2.0.0: - resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} - dev: false - - /is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - dev: false - - /is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - dependencies: - is-extglob: 2.1.1 - dev: false - - /isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - dev: false - - /js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true - dependencies: - argparse: 2.0.1 - dev: false - - /json-schema-traverse@0.4.1: - resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - dev: false - - /json-stable-stringify-without-jsonify@1.0.1: - resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} - dev: false - - /kareem@2.4.1: - resolution: {integrity: sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==} - dev: false - - /levn@0.4.1: - resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} - engines: {node: '>= 0.8.0'} - dependencies: - prelude-ls: 1.2.1 - type-check: 0.4.0 - dev: false - - /lodash.merge@4.6.2: - resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - dev: false - - /memory-pager@1.5.0: - resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} - dev: false - optional: true - - /minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - dependencies: - brace-expansion: 1.1.11 - dev: false - - /mongodb-connection-string-url@2.5.3: - resolution: {integrity: sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==} - dependencies: - '@types/whatwg-url': 8.2.2 - whatwg-url: 11.0.0 - dev: false - - /mongodb@4.8.1: - resolution: {integrity: sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==} - engines: {node: '>=12.9.0'} - dependencies: - bson: 4.6.5 - denque: 2.1.0 - mongodb-connection-string-url: 2.5.3 - socks: 2.7.0 - optionalDependencies: - saslprep: 1.0.3 - dev: false - - /mongoose@6.5.2: - resolution: {integrity: sha512-3CFDrSLtK2qjM1pZeZpLTUyqPRkc11Iuh74ZrwS4IwEJ3K2PqGnmyPLw7ex4Kzu37ujIMp3MAuiBlUjfrcb6hw==} - engines: {node: '>=12.0.0'} - dependencies: - bson: 4.6.5 - kareem: 2.4.1 - mongodb: 4.8.1 - mpath: 0.9.0 - mquery: 4.0.3 - ms: 2.1.3 - sift: 16.0.0 - transitivePeerDependencies: - - supports-color - dev: false - - /mpath@0.9.0: - resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==} - engines: {node: '>=4.0.0'} - dev: false - - /mquery@4.0.3: - resolution: {integrity: sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==} - engines: {node: '>=12.0.0'} - dependencies: - debug: 4.3.3 - transitivePeerDependencies: - - supports-color - dev: false - - /ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - dev: false - - /ms@2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: false - - /natural-compare@1.4.0: - resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - dev: false - - /once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - dependencies: - wrappy: 1.0.2 - dev: false - - /optionator@0.9.1: - resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} - engines: {node: '>= 0.8.0'} - dependencies: - deep-is: 0.1.4 - fast-levenshtein: 2.0.6 - levn: 0.4.1 - prelude-ls: 1.2.1 - type-check: 0.4.0 - word-wrap: 1.2.3 - dev: false - - /parent-module@1.0.1: - resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} - engines: {node: '>=6'} - dependencies: - callsites: 3.1.0 - dev: false - - /path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - dev: false - - /path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - dev: false - - /prelude-ls@1.2.1: - resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} - engines: {node: '>= 0.8.0'} - dev: false - - /punycode@2.1.1: - resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} - engines: {node: '>=6'} - dev: false - - /regexpp@3.2.0: - resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} - engines: {node: '>=8'} - dev: false - - /resolve-from@4.0.0: - resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} - engines: {node: '>=4'} - dev: false - - /rimraf@3.0.2: - resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - hasBin: true - dependencies: - glob: 7.2.0 - dev: false - - /saslprep@1.0.3: - resolution: {integrity: sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==} - engines: {node: '>=6'} - requiresBuild: true - dependencies: - sparse-bitfield: 3.0.3 - dev: false - optional: true - - /shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - dependencies: - shebang-regex: 3.0.0 - dev: false - - /shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - dev: false - - /sift@16.0.0: - resolution: {integrity: sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==} - dev: false - - /smart-buffer@4.2.0: - resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} - engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} - dev: false - - /socks@2.7.0: - resolution: {integrity: sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==} - engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} - dependencies: - ip: 2.0.0 - smart-buffer: 4.2.0 - dev: false - - /sparse-bitfield@3.0.3: - resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==} - dependencies: - memory-pager: 1.5.0 - dev: false - optional: true - - /strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} - dependencies: - ansi-regex: 5.0.1 - dev: false - - /strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - dev: false - - /supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - dependencies: - has-flag: 4.0.0 - dev: false - - /text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - dev: false - - /tr46@3.0.0: - resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} - engines: {node: '>=12'} - dependencies: - punycode: 2.1.1 - dev: false - - /type-check@0.4.0: - resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} - engines: {node: '>= 0.8.0'} - dependencies: - prelude-ls: 1.2.1 - dev: false - - /type-fest@0.20.2: - resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} - engines: {node: '>=10'} - dev: false - - /uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - dependencies: - punycode: 2.1.1 - dev: false - - /v8-compile-cache@2.3.0: - resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} - dev: false - - /webidl-conversions@7.0.0: - resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} - engines: {node: '>=12'} - dev: false - - /whatwg-url@11.0.0: - resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==} - engines: {node: '>=12'} - dependencies: - tr46: 3.0.0 - webidl-conversions: 7.0.0 - dev: false - - /which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - dependencies: - isexe: 2.0.0 - dev: false - - /word-wrap@1.2.3: - resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==} - engines: {node: '>=0.10.0'} - dev: false - - /wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: false From 33c5b7a25c5df4e1809077b2d1b37e07eb09c8b8 Mon Sep 17 00:00:00 2001 From: static Date: Wed, 22 Nov 2023 00:03:06 +0900 Subject: [PATCH 073/108] Fix: test error --- test/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/utils.js b/test/utils.js index b3920e83..e537913b 100644 --- a/test/utils.js +++ b/test/utils.js @@ -7,8 +7,9 @@ const { connectDatabase, } = require("../src/modules/stores/mongo"); const { generateProfileImageUrl } = require("../src/modules/modifyProfile"); +const { mongo: mongoUrl } = require("../loadenv"); -connectDatabase(); +connectDatabase(mongoUrl); // ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ์œ ์ € ์ƒ์„ฑ ํ•จ์ˆ˜ const userGenerator = async (username, testData) => { From c9f9c779ec65b287e32ea662c28faac2f5f9529a Mon Sep 17 00:00:00 2001 From: static Date: Thu, 23 Nov 2023 10:46:34 +0900 Subject: [PATCH 074/108] Remove: .github directory in sampleGenerator --- .github/workflows/test_ci.yml | 6 --- .../.github/pull_request_template.md | 9 ---- .../.github/workflows/push_image_ecr.yml | 43 ------------------- 3 files changed, 58 deletions(-) delete mode 100644 src/sampleGenerator/.github/pull_request_template.md delete mode 100644 src/sampleGenerator/.github/workflows/push_image_ecr.yml diff --git a/.github/workflows/test_ci.yml b/.github/workflows/test_ci.yml index 5186842b..2ccc5415 100644 --- a/.github/workflows/test_ci.yml +++ b/.github/workflows/test_ci.yml @@ -29,12 +29,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'pnpm' - - name: Check submodule version - if: ${{ steps.submodule-local.outputs.ver != steps.submodule-origin.outputs.ver }} - uses: actions/github-script@v3 - with: - script: | - core.setFailed('Please update submodule to the latest version by using \"git submodule update --remote\"') - name: Install taxi-back dependencies from package-lock.json run: pnpm i --force --frozen-lockfile - name: Run unit tests diff --git a/src/sampleGenerator/.github/pull_request_template.md b/src/sampleGenerator/.github/pull_request_template.md deleted file mode 100644 index e0697e9a..00000000 --- a/src/sampleGenerator/.github/pull_request_template.md +++ /dev/null @@ -1,9 +0,0 @@ -# Summary - -It closes #issue_number - -# Images or Screenshots - -# Further Work - -- Do something... diff --git a/src/sampleGenerator/.github/workflows/push_image_ecr.yml b/src/sampleGenerator/.github/workflows/push_image_ecr.yml deleted file mode 100644 index e4ee294f..00000000 --- a/src/sampleGenerator/.github/workflows/push_image_ecr.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Push Image to Amazon ECR -on: - pull_request: - types: - - closed - branches: - - main - -env: - AWS_REGION: ap-northeast-2 - -jobs: - if_merged: - if: github.event.pull_request.merged == true - name: Push Image to Amazon ECR - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - - name: Login to AWS ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build and Push to AWS ECR - id: build_image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: taxi-mongo - run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest - echo "Push iamge : $ECR_REGISTRY/$ECR_REPOSITORY:latest" From 2f6d44c37ba273edda2397218d63ac854039afc3 Mon Sep 17 00:00:00 2001 From: static Date: Thu, 23 Nov 2023 11:09:23 +0900 Subject: [PATCH 075/108] Add: longitude and latitude of sample data --- src/sampleGenerator/sampleData.json | 60 +++++++++++++++++++++-------- src/sampleGenerator/src/testData.js | 2 + 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/sampleGenerator/sampleData.json b/src/sampleGenerator/sampleData.json index eaa4f44a..546812cd 100644 --- a/src/sampleGenerator/sampleData.json +++ b/src/sampleGenerator/sampleData.json @@ -20,63 +20,93 @@ "locations": [ { "koName": "ํƒ์‹œ์Šน๊ฐ•์žฅ", - "enName": "Taxi Stand" + "enName": "Taxi Stand", + "longitude": 127.359507, + "latitude": 36.373199 }, { "koName": "๋Œ€์ „์—ญ", - "enName": "Daejeon Station" + "enName": "Daejeon Station", + "longitude": 127.434522, + "latitude": 36.331894 }, { "koName": "๊ฐค๋Ÿฌ๋ฆฌ์•„ ํƒ€์ž„์›”๋“œ", - "enName": "Galleria Timeworld" + "enName": "Galleria Timeworld", + "longitude": 127.378188, + "latitude": 36.351938 }, { "koName": "๊ถ๋™ ๋กœ๋ฐ์˜ค๊ฑฐ๋ฆฌ", - "enName": "Gung-dong Rodeo Street" + "enName": "Gung-dong Rodeo Street", + "longitude": 127.350161, + "latitude": 36.362785 }, { "koName": "๋Œ€์ „๋ณตํ•ฉํ„ฐ๋ฏธ๋„", - "enName": "Daejeon Terminal Complex" + "enName": "Daejeon Terminal Complex", + "longitude": 127.350161, + "latitude": 36.362785 }, { "koName": "๋งŒ๋…„์ค‘ํ•™๊ต", - "enName": "Mannyon Middle School" + "enName": "Mannyon Middle School", + "longitude": 127.375993, + "latitude": 36.366990 }, { "koName": "์„œ๋Œ€์ „์—ญ", - "enName": "Seodaejeon Station" + "enName": "Seodaejeon Station", + "longitude": 127.403933, + "latitude": 36.322517 }, { "koName": "์‹ ์„ธ๊ณ„๋ฐฑํ™”์ ", - "enName": "Shinsegae Department Store" + "enName": "Shinsegae Department Store", + "longitude": 127.381905, + "latitude": 36.375168 }, { "koName": "์˜ค๋ฆฌ์—ฐ๋ชป", - "enName": "Duck Pond" + "enName": "Duck Pond", + "longitude": 127.362371, + "latitude": 36.367715 }, { "koName": "์›”ํ‰์—ญ", - "enName": "Wolpyeong Station" + "enName": "Wolpyeong Station", + "longitude": 127.364352, + "latitude": 36.358271 }, { "koName": "์œ ์„ฑ๊ตฌ์ฒญ", - "enName": "Yuseong-gu Office" + "enName": "Yuseong-gu Office", + "longitude": 127.356384, + "latitude": 36.362084 }, { "koName": "์œ ์„ฑ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", - "enName": "Yuseong Express Bus Terminal" + "enName": "Yuseong Express Bus Terminal", + "longitude": 127.336467, + "latitude": 36.358279 }, { "koName": "์œ ์„ฑ ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", - "enName": "Yuseong Intercity Bus Terminal" + "enName": "Yuseong Intercity Bus Terminal", + "longitude": 127.335971, + "latitude": 36.355604 }, { "koName": "๋Œ€์ „์ฒญ์‚ฌ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", - "enName": "Government Complex Express Bus Terminal" + "enName": "Government Complex Express Bus Terminal", + "longitude": 127.390504, + "latitude": 36.361462 }, { "koName": "๋Œ€์ „์ฒญ์‚ฌ ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", - "enName": "Government Complex Intercity Bus Terminal" + "enName": "Government Complex Intercity Bus Terminal", + "longitude": 127.379759, + "latitude": 36.361512 } ] } diff --git a/src/sampleGenerator/src/testData.js b/src/sampleGenerator/src/testData.js index db537cae..4043c90f 100644 --- a/src/sampleGenerator/src/testData.js +++ b/src/sampleGenerator/src/testData.js @@ -37,6 +37,8 @@ const generateSampleLocations = async (locations) => { const locationDocument = new locationModel({ koName: location.koName, enName: location.enName, + longitude: location.longitude, + latitude: location.latitude, }); await locationDocument.save(); } From ae4f520232c2f9b26ae4ce5231458cbad3164842 Mon Sep 17 00:00:00 2001 From: T-dubb Date: Tue, 28 Nov 2023 22:49:39 +0900 Subject: [PATCH 076/108] =?UTF-8?q?Fix:=20socket.js=20socket=20update=20?= =?UTF-8?q?=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/socket.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/socket.js b/src/modules/socket.js index bca99161..312a6b77 100644 --- a/src/modules/socket.js +++ b/src/modules/socket.js @@ -219,9 +219,11 @@ const emitUpdateEvent = async (io, roomId) => { throw new IllegalArgumentsException(); } - part.forEach(({ user }) => io.in(`user-${user}`).emit("chat_update"), { - roomId, - }); + part.forEach(({ user }) => + io.in(`user-${user}`).emit("chat_update", { + roomId, + }) + ); return true; } catch (err) { From 17a94f87004e22ae634bd7e516b29445ec2a9e0c Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 9 Dec 2023 12:32:41 +0000 Subject: [PATCH 077/108] Docs: basic format --- src/routes/docs/users.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/routes/docs/users.js b/src/routes/docs/users.js index e76cd2b4..e2b64891 100644 --- a/src/routes/docs/users.js +++ b/src/routes/docs/users.js @@ -2,6 +2,24 @@ const tag = "users"; const apiPrefix = "/users"; const usersDocs = {}; +usersDocs[`${apiPrefix}/agreeOnTermsOfService`] = { + post: { + tags: [tag], + }, +}; + +usersDocs[`${apiPrefix}/getAgreeOnTermsOfService`] = { + get: { + tags: [tag], + }, +}; + +usersDocs[`${apiPrefix}/editNickname`] = { + post: { + tags: [tag], + }, +}; + usersDocs[`${apiPrefix}/resetNickname`] = { get: { tags: [tag], @@ -33,6 +51,24 @@ usersDocs[`${apiPrefix}/resetNickname`] = { }, }; +usersDocs[`${apiPrefix}/editAccount`] = { + post: { + tags: [tag], + }, +}; + +usersDocs[`${apiPrefix}/editProfileImg/getPUrl`] = { + post: { + tags: [tag], + }, +}; + +usersDocs[`${apiPrefix}/editProfileImg/done`] = { + get: { + tags: [tag], + }, +}; + usersDocs[`${apiPrefix}/resetProfileImg`] = { get: { tags: [tag], From 0256863a686f230816bb636225b963e99ed317bf Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 9 Dec 2023 13:51:36 +0000 Subject: [PATCH 078/108] Fix: unify send message prefix --- src/services/users.js | 54 +++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/services/users.js b/src/services/users.js index 3c26b164..0922cf8a 100644 --- a/src/services/users.js +++ b/src/services/users.js @@ -18,13 +18,13 @@ const agreeOnTermsOfServiceHandler = async (req, res) => { res .status(200) .send( - "User/agreeOnTermsOfService : agree on Terms of Service successful" + "Users/agreeOnTermsOfService : agree on Terms of Service successful" ); } else { - res.status(400).send("User/agreeOnTermsOfService : already agreed"); + res.status(400).send("Users/agreeOnTermsOfService : already agreed"); } } catch { - res.status(500).send("User/agreeOnTermsOfService : internal server error"); + res.status(500).send("Users/agreeOnTermsOfService : internal server error"); } }; @@ -36,7 +36,9 @@ const getAgreeOnTermsOfServiceHandler = async (req, res) => { const agreeOnTermsOfService = user.agreeOnTermsOfService === true; res.json({ agreeOnTermsOfService }); } catch { - res.status(500).send("/getAgreeOnTermsOfService : internal server error"); + res + .status(500) + .send("Users/getAgreeOnTermsOfService : internal server error"); } }; @@ -55,13 +57,15 @@ const editNicknameHandler = async (req, res) => { req.timestamp ); - res.status(200).send("User/editNickname : edit user nickname successful"); + res + .status(200) + .send("Users/editNickname : edit user nickname successful"); } else { - res.status(400).send("User/editNickname : such user id does not exist"); + res.status(400).send("Users/editNickname : such user id does not exist"); } } catch (err) { logger.error(err); - res.status(500).send("User/editNickname : internal server error"); + res.status(500).send("Users/editNickname : internal server error"); } }; @@ -81,13 +85,13 @@ const editAccountHandler = async (req, res) => { newAccount ); - res.status(200).send("User/editAccount : edit user account successful"); + res.status(200).send("Users/editAccount : edit user account successful"); } else { - res.status(400).send("User/editAccount : such user id does not exist"); + res.status(400).send("Users/editAccount : such user id does not exist"); } } catch (err) { logger.error(err); - res.status(500).send("User/editAccount : internal server error"); + res.status(500).send("Users/editAccount : internal server error"); } }; @@ -98,14 +102,14 @@ const editProfileImgGetPUrlHandler = async (req, res) => { if (!user) { return res .status(500) - .send("User/editProfileImg/getPUrl : internal server error"); + .send("Users/editProfileImg/getPUrl : internal server error"); } const key = `profile-img/${user._id}`; aws.getUploadPUrlPost(key, type, (err, data) => { if (err) { return res .status(500) - .send("User/editProfileImg/getPUrl : internal server error"); + .send("Users/editProfileImg/getPUrl : internal server error"); } data.fields["Content-Type"] = type; data.fields["key"] = key; @@ -115,7 +119,9 @@ const editProfileImgGetPUrlHandler = async (req, res) => { }); }); } catch (e) { - res.status(500).send("User/editProfileImg/getPUrl : internal server error"); + res + .status(500) + .send("Users/editProfileImg/getPUrl : internal server error"); } }; @@ -125,7 +131,7 @@ const editProfileImgDoneHandler = async (req, res) => { if (!user) { return res .status(500) - .send("User/editProfileImg/done : internal server error"); + .send("Users/editProfileImg/done : internal server error"); } const key = `profile-img/${user._id}`; aws.foundObject(key, async (err) => { @@ -133,7 +139,7 @@ const editProfileImgDoneHandler = async (req, res) => { logger.error(err); return res .status(500) - .send("User/editProfileImg/done : internal server error"); + .send("Users/editProfileImg/done : internal server error"); } const userAfter = await userModel.findOneAndUpdate( { id: req.userId }, @@ -143,7 +149,7 @@ const editProfileImgDoneHandler = async (req, res) => { if (!userAfter) { return res .status(500) - .send("User/editProfileImg/done : internal server error"); + .send("Users/editProfileImg/done : internal server error"); } res.json({ result: true, @@ -151,7 +157,7 @@ const editProfileImgDoneHandler = async (req, res) => { }); }); } catch (e) { - res.status(500).send("User/editProfileImg/done : internal server error"); + res.status(500).send("Users/editProfileImg/done : internal server error"); } }; @@ -165,11 +171,13 @@ const resetNicknameHandler = async (req, res) => { if (!result) return res .status(400) - .send("User/resetNickname : such user does not exist"); - res.status(200).send("User/resetNickname : reset user nickname successful"); + .send("Users/resetNickname : such user does not exist"); + res + .status(200) + .send("Users/resetNickname : reset user nickname successful"); } catch (err) { logger.error(err); - res.status(500).send("User/resetNickname : internal server error"); + res.status(500).send("Users/resetNickname : internal server error"); } }; @@ -183,12 +191,12 @@ const resetProfileImgHandler = async (req, res) => { if (!result) return res .status(400) - .send("User/resetProfileImg : such user does not exist"); + .send("Users/resetProfileImg : such user does not exist"); res .status(200) - .send("User/resetProfileImg : reset user profile image successful"); + .send("Users/resetProfileImg : reset user profile image successful"); } catch (err) { - res.status(500).send("User/resetProfileImg : internal server error"); + res.status(500).send("Users/resetProfileImg : internal server error"); } }; From 574fad4f57f174521b0734a872dafd4418d13d95 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 9 Dec 2023 13:55:47 +0000 Subject: [PATCH 079/108] Docs: add users swagger document --- src/routes/docs/users.js | 239 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 233 insertions(+), 6 deletions(-) diff --git a/src/routes/docs/users.js b/src/routes/docs/users.js index e2b64891..193eb702 100644 --- a/src/routes/docs/users.js +++ b/src/routes/docs/users.js @@ -5,18 +5,113 @@ const usersDocs = {}; usersDocs[`${apiPrefix}/agreeOnTermsOfService`] = { post: { tags: [tag], + summary: "์ด์šฉ ์•ฝ๊ด€์— ๋™์˜", + description: + "์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€๋ฅผ ๋™์˜ํ•จ์œผ๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค. ์ฒ ํšŒ๋Š” ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.", + responses: { + 200: { + content: { + "text/html": { + example: + "Users/agreeOnTermsOfService : agree on Terms of Service successful", + }, + }, + }, + 400: { + content: { + "text/html": { + example: "Users/agreeOnTermsOfService : already agreed", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Users/agreeOnTermsOfService : internal server error", + }, + }, + }, + }, }, }; usersDocs[`${apiPrefix}/getAgreeOnTermsOfService`] = { get: { tags: [tag], + summary: "์ด์šฉ ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€ ์ „์†ก", + description: + "์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ ์ด์šฉ ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€๋ฅผ json ํ˜•ํƒœ๋กœ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.", + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + agreeOnTermsOfService: { + type: "boolean", + description: "์œ ์ €์˜ ์ด์šฉ ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€", + example: true, + }, + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Users/getAgreeOnTermsOfService : internal server error", + }, + }, + }, + }, }, }; usersDocs[`${apiPrefix}/editNickname`] = { post: { tags: [tag], + summary: "์œ ์ €์˜ ๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ", + description: "์œ ์ €์˜ ๋‹‰๋„ค์ž„์„ ์š”์ฒญํ•œ ๋‹‰๋„ค์ž„์œผ๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + nickname: { + type: "string", + description: "์œ ์ €์˜ ์ƒˆ ๋‹‰๋„ค์ž„", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "text/html": { + example: "Users/editNickname : edit user nickname successful", + }, + }, + }, + 400: { + content: { + "text/html": { + example: "Users/editNickname : such user id does not exist", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Users/editNickname : internal server error", + }, + }, + }, + }, }, }; @@ -29,21 +124,21 @@ usersDocs[`${apiPrefix}/resetNickname`] = { 200: { content: { "text/html": { - example: "User/resetNickname : reset user nickname successful", + example: "Users/resetNickname : reset user nickname successful", }, }, }, 400: { content: { "text/html": { - example: "User/resetNickname : such user does not exist", + example: "Users/resetNickname : such user does not exist", }, }, }, 500: { content: { "text/html": { - example: "User/resetNickname : internal server error", + example: "Users/resetNickname : internal server error", }, }, }, @@ -54,18 +149,150 @@ usersDocs[`${apiPrefix}/resetNickname`] = { usersDocs[`${apiPrefix}/editAccount`] = { post: { tags: [tag], + summary: "์œ ์ €์˜ ๊ณ„์ขŒ ๋ฒˆํ˜ธ ๋ณ€๊ฒฝ", + description: "์œ ์ €์˜ ๊ณ„์ขŒ ๋ฒˆํ˜ธ๋ฅผ ์š”์ฒญํ•œ ๊ณ„์ขŒ ๋ฒˆํ˜ธ๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + account: { + type: "string", + description: "์œ ์ €์˜ ์ƒˆ ๊ณ„์ขŒ ๋ฒˆํ˜ธ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "text/html": { + example: "Users/editAccount : edit user account successful", + }, + }, + }, + 400: { + content: { + "text/html": { + example: "Users/editAccount : such user id does not exist", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Users/editAccount : internal server error", + }, + }, + }, + }, }, }; usersDocs[`${apiPrefix}/editProfileImg/getPUrl`] = { post: { tags: [tag], + summary: "ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ presigned-url ๋ฐœ๊ธ‰", + description: `์œ ์ €์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋Š” AWS S3์—์„œ ๊ด€๋ฆฌ๋ฉ๋‹ˆ๋‹ค. ๋ณ€๊ฒฝํ•  ํ”„๋กœํ•„์„ ์—…๋กœ๋“œ ํ•˜๊ธฐ ์œ„ํ•œ ์ฃผ์†Œ์ธ presigned-url์„ ๋ฐœ๊ธ‰ํ•ฉ๋‹ˆ๋‹ค.
+
+ **ํ”„๋กœํ•„ ์‚ฌ์ง„์€ ์•„๋ž˜ ๊ทœ์น™์„ ๋งŒ์กฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:**
+ 1. ํŒŒ์ผ ํ˜•์‹์€ image/png, image/jpg, image/jpeg ์ค‘ ํ•˜๋‚˜
+ 2. ํŒŒ์ผ ํฌ๊ธฐ๋Š” ์ตœ๋Œ€ 50 MB`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + type: { + type: "string", + description: "์—…๋กœ๋“œํ•  ์ด๋ฏธ์ง€ type", + example: "image/png", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + url: { + type: "string", + description: "์ด๋ฏธ์ง€ ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ presigned-url", + }, + fields: { + type: "object", + properties: { + "Content-Type": { + type: "string", + description: "์ด๋ฏธ์ง€์˜ type", + }, + key: { + type: "string", + description: "์ด๋ฏธ์ง€์˜ S3 ํŒŒ์ผ ๊ฒฝ๋กœ", + }, + }, + description: "์—…๋กœ๋“œ ํŒŒ์ผ์˜ type ๋ฐ key ์ •๋ณด", + }, + }, + }, + }, + }, + }, + 500: { + contnet: { + "text/html": { + example: "Users/editProfileImg/getPUrl : internal server error", + }, + }, + }, + }, }, }; usersDocs[`${apiPrefix}/editProfileImg/done`] = { get: { tags: [tag], + summary: "ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ์ •์ƒ ์—…๋กœ๋“œ ์—ฌ๋ถ€ ํ™•์ธ", + description: `ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๊ฐ€ S3์— ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
+ ์ •์ƒ์ ์œผ๋กœ ํ™•์ธ ๋˜์—ˆ๋‹ค๋ฉด, ์œ ์ €์˜ \`profileImageUrl\` ์ •๋ณด๋ฅผ ์ƒˆ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ํŒŒ์ผ๋ช…์œผ๋กœ ์—…๋ฐ์ดํŠธ ํ•ฉ๋‹ˆ๋‹ค.`, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + description: "์ •์ƒ์ ์ธ ์—…๋กœ๋“œ ์„ฑ๊ณต ์—ฌ๋ถ€", + }, + profileImageUrl: { + type: "string", + description: + "์ƒˆ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ํŒŒ์ผ๋ช… (์—…๋กœ๋“œ ์‹คํŒจ ์‹œ `undefined`)", + }, + }, + }, + }, + }, + }, + 500: { + contnet: { + "text/html": { + example: "Users/editProfileImg/done : internal server error", + }, + }, + }, + }, }, }; @@ -79,21 +306,21 @@ usersDocs[`${apiPrefix}/resetProfileImg`] = { content: { "text/html": { example: - "User/resetProfileImg : reset user profile image successful", + "Users/resetProfileImg : reset user profile image successful", }, }, }, 400: { content: { "text/html": { - example: "User/resetProfileImg : such user does not exist", + example: "Users/resetProfileImg : such user does not exist", }, }, }, 500: { content: { "text/html": { - example: "User/resetProfileImg : internal server error", + example: "Users/resetProfileImg : internal server error", }, }, }, From 4e036758b954a688b36ad02ad9df001cfd0a9cb8 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 9 Dec 2023 13:59:29 +0000 Subject: [PATCH 080/108] Remove: users.md --- src/routes/docs/users.md | 305 --------------------------------------- 1 file changed, 305 deletions(-) delete mode 100755 src/routes/docs/users.md diff --git a/src/routes/docs/users.md b/src/routes/docs/users.md deleted file mode 100755 index 6b46963b..00000000 --- a/src/routes/docs/users.md +++ /dev/null @@ -1,305 +0,0 @@ -## `/users` - -- ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ ๋ฐ ์ˆ˜์ • ๊ธฐ๋Šฅ์„ ์ง€์›ํ•˜๋Š” API. -- ๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ -- ์‚ฌ์šฉ์ž๋ฅผ ๋ฐ˜ํ™˜ํ•  ๊ฒฝ์šฐ ๊ทธ type์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. - -```javascript -User { - name: String, - nickname: String, // 3๊ธ€์ž ์ด์ƒ 25๊ธ€์ž ์ดํ•˜๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ ์˜์–ด ๋Œ€์†Œ๋ฌธ์ž, ํ•œ๊ธ€, " ", 0~9, "-", "_" ์œผ๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•จ. - id: String, - withdraw: Boolean, - ban: Boolean, - joinat: Date, - agreeOnTermsOfService: { type: Boolean, default: false }, //์ด์šฉ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€ - room: [Room], - subinfo: { - kaist: String, - sparcs: String, - facebook: String, - twitter: String, - }, - email: String, - __v: Number, -} -``` - -### `/agreeOnTermsOfService` **(POST)** - -- ์ด์šฉ ์•ฝ๊ด€์— ๋™์˜ํ•จ (์ฒ ํšŒ ๋ถˆ๊ฐ€) - -#### URL Parameters, Request JSON form - -- ์—†์Œ - -#### Response - -- 200 "agree on Terms of Service successful" -- 400 "already agreed" -- 500 "internal server error" - -### `/getAgreeOnTermsOfService` **(GET)** - -- ์ด์šฉ ์•ฝ๊ด€ ๋™์˜ ์—ฌ๋ถ€๋ฅผ ๊ฐ€์ ธ์˜ด - -#### URL Parameters, Request JSON form - -- ์—†์Œ - -#### Response - -```javascript -{ - agreeOnTermsOfService: Boolean -}, -``` - -### `/editNickname` **(POST)** - -- ํ•ด๋‹น ์‚ฌ์šฉ์ž์˜ ๋‹‰๋„ค์ž„์„ ์ƒˆ๋กœ ์„ค์ •ํ•จ. -- ์ƒˆ๋กœ์šด ๋‹‰๋„ค์ž„์€ ์ƒ์ˆ ํ•œ ๊ทœ์น™์„ ๋งŒ์กฑํ•ด์•ผ ํ•จ. - -#### URL Parameters - -- user_id : ์‚ฌ์šฉ์ž์˜ SPARCS SSO ID - -#### request JSON form - -```javascript -{ - nickname: String, // ์ƒˆ ๋‹‰๋„ค์ž„ -} -``` - -#### Response - -```javascript -{ - status: 200, - data: "edit user nickname successful", -} -``` - -#### Errors - -- 400 "wrong nickname" -- 400 "such user id does not exist" -- 403 "not logged in" -- 500 "internal server error" - -### `/editProfileImg/getPUrl` **(POST)** - -- ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” Presigned-url์„ ๋ฐœ๊ธ‰ํ•ฉ๋‹ˆ๋‹ค. -- ํ”„๋กœํ•„ ์‚ฌ์ง„์€ ์•„๋ž˜ ๊ทœ์น™์„ ๋งŒ์กฑํ•ด์•ผ ํ•จ. - 1. ํŒŒ์ผ ํ˜•์‹์€ image/png, image/jpg, image/jpeg ์ค‘ ํ•˜๋‚˜ - 2. ํŒŒ์ผ ํฌ๊ธฐ๋Š” ์ตœ๋Œ€ 50 MB - -#### URL Parameters - -- type : ์—…๋กœ๋“œํ•  ์ด๋ฏธ์ง€ type - -#### request JSON form - -```javascript -{ - url: String, // pre-signed url - fields: Object, // post fields -} -``` - -#### Errors - -- 500 "internal server error" - -### `/editProfileImg/done` **(GET)** - -- ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๊ฐ€ S3์— ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ๊ฐ€ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. - -#### URL Parameters - -- ์—†์Œ - -#### request JSON form - -```javascript -{ - result: Boolean, // ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ์œผ๋ฉด true - profileImageUrl?: user._id, // ์ •์ƒ์ ์œผ๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ์œผ๋ฉด ์ƒˆ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ํŒŒ์ผ๋ช…, ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ undefined -} -``` - -#### Errors - -- 500 "internal server error" - -### `/` **(GET)** (for dev) - -- ์‚ฌ์šฉ์ž ์ „์ฒด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•จ. - -#### URL Parameters - -- ์—†์Œ - -#### Response - -```javascript -{ - status: 200, - data: User[], // ์ „์ฒด ์‚ฌ์šฉ์ž ๋ฆฌ์ŠคํŠธ -} -``` - -#### Errors - -- ์—†์Œ - -### `/rooms` **(GET)** (for dev) - -- ์‚ฌ์šฉ์ž์˜ ๋ฐฉ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•จ. - -#### URL Parameters - -- id : User document์˜ id - -#### Response - -```javascript -{ - id: String, // ์š”์ฒญ๋œ id - rooms: Room[], // ๋ฐฉ ๋ฆฌ์ŠคํŠธ -} -``` - -#### Errors - -- 404 "user/rooms : such id does not exist" -- 500 "user/rooms : internal server error" - -### `/:id` **(GET)** (for dev) - -- ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•จ. - -#### URL Parameters - -- id : User document์˜ id - -#### Response - -```javascript -{ - status: 200, - data: User, //id์— ๋Œ€์‘๋˜๋Š” ์‚ฌ์šฉ์ž ์ •๋ณด -} -``` - -#### Errors - -- 404 "user/:id : such id does not exist" -- 500 "user/:id : internal server error" - -### `/:id/edit` **(POST)** (for dev) - -- ์ƒˆ ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ๋ฐ›์•„ ์—…๋ฐ์ดํŠธํ•จ. - -#### URL Parameters - -- id : User document์˜ id - -#### request JSON form - -```javascript -User; //์ˆ˜์ •ํ•  ์‚ฌ์šฉ์ž ์ •๋ณด -``` - -#### Response - -```javascript -{ - status: 200, - data: "edit user successful", -} -``` - -#### Errors - -- 400 "such id does not exist" - -### `/:id/ban` **(GET)** (for dev) - -- ํ•ด๋‹น ์‚ฌ์šฉ์ž๋ฅผ ๋ฐดํ•จ. - -#### URL Parameters - -- id : User document์˜ id - -#### Response - -```javascript -{ - status: 200, - data: "The user banned successfully", -} -``` - -#### Errors - -- 400 "The user does not exist" -- 409 "The user is already banned" -- 500 "User/ban : Error 500" - -### `/:id/unban` **(GET)** (for dev) - -- ํ•ด๋‹น ์‚ฌ์šฉ์ž๋ฅผ ๋ฐด ํ•ด์ œํ•จ. - -#### URL Parameters - -- id : User document์˜ id - -#### Response - -```javascript -{ - status: 200, - data: "The user unbanned successfully", -} -``` - -#### Errors - -- 400 "The user does not exist" -- 409 "The user is already banned" -- 500 "User/unban : Error 500" - -### `/:id/participate` **(POST)** (for dev) - -- ํ•ด๋‹น ์‚ฌ์šฉ์ž๋ฅผ ํŠน์ • ๋ฐฉ์— ์ฐธ์—ฌ์‹œํ‚ด. - -#### URL Parameters - -- id : User document์˜ id - -#### request JSON form - -```javascript -{ - room: String, // Room document์˜ id -} -``` - -#### Response - -```javascript -{ - status: 200, - data: "User/participate : Successful", -} -``` - -#### Errors - -- 400 "User/participate : Bad request" -- 400 "User/participate : No corresponding room" -- 400 "The user does not exist" -- 409 "The user already entered the room" -- 500 "User/participate : Error 500" From 90185f964d215134f52ec32c79dea9c1488b2a1d Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 9 Dec 2023 14:02:20 +0000 Subject: [PATCH 081/108] Test: change check message --- test/services/users.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/services/users.js b/test/services/users.js index 1bb2f586..4f2195da 100644 --- a/test/services/users.js +++ b/test/services/users.js @@ -15,7 +15,7 @@ describe("[users] 1.agreeOnTermsOfServiceHandler", () => { it("should return correct response from handler", async () => { const testUser1 = await userGenerator("test1", testData); const msg = - "User/agreeOnTermsOfService : agree on Terms of Service successful"; + "Users/agreeOnTermsOfService : agree on Terms of Service successful"; let req = httpMocks.createRequest({ userId: testUser1.id, }); @@ -50,7 +50,7 @@ describe("[users] 3.editNicknameHandler", () => { it("should return correct response from handler", async () => { const testUser1 = await userModel.findOne({ id: "test1" }); - const msg = "User/editNickname : edit user nickname successful"; + const msg = "Users/editNickname : edit user nickname successful"; let req = httpMocks.createRequest({ userId: testUser1.id, body: { @@ -77,7 +77,7 @@ describe("[users] 4.editAccountHandler", () => { it("should return correct response from handler", async () => { const testUser1 = await userModel.findOne({ id: "test1" }); - const msg = "User/editAccount : edit user account successful"; + const msg = "Users/editAccount : edit user account successful"; let req = httpMocks.createRequest({ userId: testUser1.id, body: { From 019b49ac6a4c32590b8b79c0e098f87183bc5730 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 9 Dec 2023 14:11:45 +0000 Subject: [PATCH 082/108] Docs: swagger chats basic config --- src/routes/docs/chats.js | 75 ++++++++++++++++++++++++++++++++++ src/routes/docs/swaggerDocs.js | 6 +++ 2 files changed, 81 insertions(+) create mode 100644 src/routes/docs/chats.js diff --git a/src/routes/docs/chats.js b/src/routes/docs/chats.js new file mode 100644 index 00000000..d3ba72e5 --- /dev/null +++ b/src/routes/docs/chats.js @@ -0,0 +1,75 @@ +const tag = "chats"; +const apiPrefix = "/chats"; + +const chatsDocs = {}; +chatsDocs[`${apiPrefix}`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +chatsDocs[`${apiPrefix}/load/before`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +chatsDocs[`${apiPrefix}/load/after`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +chatsDocs[`${apiPrefix}/send`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +chatsDocs[`${apiPrefix}/read`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +chatsDocs[`${apiPrefix}/uploadChatImg/getPUrl`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +chatsDocs[`${apiPrefix}/uploadChatImg/done`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +module.exports = chatsDocs; diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index 84f4e040..c0b474b4 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -4,6 +4,7 @@ const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); const authDocs = require("./auth"); const usersDocs = require("./users"); +const chatsDocs = require("./chats"); const { port, nodeEnv } = require("../../../loadenv"); const serverList = [ @@ -56,6 +57,10 @@ const swaggerDocs = { name: "users", description: "์œ ์ € ๊ณ„์ • ์ •๋ณด ์ˆ˜์ • ๋ฐ ์กฐํšŒ", }, + { + name: "chats", + description: "์ฑ„ํŒ… ์‹œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ ์ •๋ฆฌ", + }, ], consumes: ["application/json"], produces: ["application/json"], @@ -65,6 +70,7 @@ const swaggerDocs = { ...locationsDocs, ...usersDocs, ...authDocs, + ...chatsDocs, }, components: { schemas: { From 8e294d59d135c5fdd47f0fd1973033c1a2f914e9 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Thu, 4 Jan 2024 17:17:52 +0000 Subject: [PATCH 083/108] Docs: chats.js --- src/routes/docs/chats.js | 187 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 175 insertions(+), 12 deletions(-) diff --git a/src/routes/docs/chats.js b/src/routes/docs/chats.js index d3ba72e5..81be8bcf 100644 --- a/src/routes/docs/chats.js +++ b/src/routes/docs/chats.js @@ -5,30 +5,193 @@ const chatsDocs = {}; chatsDocs[`${apiPrefix}`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "๊ฐ€์žฅ ์ตœ๊ทผ ์ฑ„ํŒ… ๊ฐ€์ ธ์˜ค๊ธฐ", + description: "๊ฐ€์žฅ ์ตœ๊ทผ์— ๋„์ฐฉํ•œ 60๊ฐœ์˜ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { value: "Chat/ : socket did not connected" }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: "Chat/ : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/ : internal server error", + }, + }, + }, + }, }, }; chatsDocs[`${apiPrefix}/load/before`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "ํŠน์ • ์‹œ์  ์ด์ „์˜ ์ฑ„ํŒ… ๊ฐ€์ ธ์˜ค๊ธฐ", + description: "lastMsgDate ์ด์ „์— ๋„์ฐฉํ•œ 60๊ฐœ์˜ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + lastMsgDate: { + type: "string", + format: "date-time", + description: "์ด์ „ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ฌ ํŠน์ • ์‹œ์ ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { + value: "Chat/load/before : socket did not connected", + }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: + "Chat/load/before : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/load/before : internal server error", + }, + }, + }, + }, }, }; chatsDocs[`${apiPrefix}/load/after`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "ํŠน์ • ์‹œ์  ์ดํ›„ ์ฑ„ํŒ… ๊ฐ€์ ธ์˜ค๊ธฐ", + description: "lastMsgDate ์ดํ›„์— ๋„์ฐฉํ•œ 60๊ฐœ์˜ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + lastMsgDate: { + type: "string", + format: "date-time", + description: "์ด์ „ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ฌ ํŠน์ • ์‹œ์ ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { + value: "Chat/load/after : socket did not connected", + }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: + "Chat/load/after : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/load/after : internal server error", + }, + }, + }, + }, }, }; From 81d403ec50d3afc23d5111e21b15bb1124249838 Mon Sep 17 00:00:00 2001 From: static Date: Sat, 6 Jan 2024 20:47:56 +0900 Subject: [PATCH 084/108] Remove: Dockerfile --- src/sampleGenerator/.dockerignore | 107 ------------------------------ src/sampleGenerator/Dockerfile | 29 -------- 2 files changed, 136 deletions(-) delete mode 100644 src/sampleGenerator/.dockerignore delete mode 100644 src/sampleGenerator/Dockerfile diff --git a/src/sampleGenerator/.dockerignore b/src/sampleGenerator/.dockerignore deleted file mode 100644 index 2909449b..00000000 --- a/src/sampleGenerator/.dockerignore +++ /dev/null @@ -1,107 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# MongoDB Dump -dump/ diff --git a/src/sampleGenerator/Dockerfile b/src/sampleGenerator/Dockerfile deleted file mode 100644 index c107658e..00000000 --- a/src/sampleGenerator/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM mongo:4.4 - -# Install node & npm (from nvm) -ENV NODE_VERSION v16.15.0 -RUN apt-get -qq update; \ - apt-get -qq install curl; \ - curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash; \ - . /data/db/.nvm/nvm.sh; \ - nvm install $NODE_VERSION; \ - nvm alias default $NODE_VERSION; \ - nvm use --delete-prefix default -ENV PATH /bin/versions/node/$NODE_VERSION/bin:$PATH - -# Copy repository and Set default environments -WORKDIR /home -COPY . . -ENV DB_PATH=mongodb://localhost:27017/local \ - NUM_OF_ROOMS=2 \ - NUM_OF_CHATS=200 \ - MAXIMUM_INTERVAL_BETWEEN_CHATS=20 \ - OCCURENCE_OF_JOIN=0.1 \ - OCCURENCE_OF_ABORT=0.1 - -# Install requirements -RUN pnpm i --force --frozen-lockfile - -# Start mongo service -EXPOSE 27017 -CMD ["sh", "-c", "mongod & pnpm run start & tail -f /dev/null"] From ca2b083bdc1625f434d277cc44d198fdc04f0eb7 Mon Sep 17 00:00:00 2001 From: static Date: Sat, 6 Jan 2024 21:06:59 +0900 Subject: [PATCH 085/108] Refactor: merge .env file of sampleGenerator into .env.test file --- loadenv.js | 2 +- src/sampleGenerator/README.md | 14 ++++++-------- src/sampleGenerator/index.js | 21 +++++++++++++++------ src/sampleGenerator/loadenv.js | 13 +++++++++++++ src/sampleGenerator/security.js | 26 -------------------------- src/sampleGenerator/src/testData.js | 12 +++++++----- 6 files changed, 42 insertions(+), 46 deletions(-) create mode 100644 src/sampleGenerator/loadenv.js delete mode 100644 src/sampleGenerator/security.js diff --git a/loadenv.js b/loadenv.js index f7224601..789e21db 100644 --- a/loadenv.js +++ b/loadenv.js @@ -43,5 +43,5 @@ module.exports = { slackWebhookUrl: { report: process.env.SLACK_REPORT_WEBHOOK_URL || "", // optional }, - eventConfig: process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG), + eventConfig: process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG), // optional }; diff --git a/src/sampleGenerator/README.md b/src/sampleGenerator/README.md index 2a6ea910..5afd5960 100644 --- a/src/sampleGenerator/README.md +++ b/src/sampleGenerator/README.md @@ -8,18 +8,16 @@ **SETUP** -1. ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ(README.md ํŒŒ์ผ์ด ์žˆ๋Š” ๊ณณ)์— .env ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. +1. *(optional)* Root directory์˜ `.env.test` ํŒŒ์ผ์— ๋‹ค์Œ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ``` - #mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) - DB_PATH=mongodb://localhost:27017/local #๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ - NUM_OF_ROOMS=2 - NUM_OF_CHATS=200 + SAMPLE_NUM_OF_ROOMS=2 + SAMPLE_NUM_OF_CHATS=200 #์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) - MAXIMUM_INTERVAL_BETWEEN_CHATS=20 + SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS=20 #์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) - OCCURENCE_OF_JOIN=0.1 - OCCURENCE_OF_ABORT=0.1 + SAMPLE_OCCURENCE_OF_JOIN=0.1 + SAMPLE_OCCURENCE_OF_ABORT=0.1 ``` 1. sampleData.json์— ์žฅ์†Œ, ์œ ์ €, ๋ฐฉ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. javascript `User { "id": "sampleId", ์‚ฌ์šฉ์ž id }` diff --git a/src/sampleGenerator/index.js b/src/sampleGenerator/index.js index 506f5e04..74c6ad5a 100644 --- a/src/sampleGenerator/index.js +++ b/src/sampleGenerator/index.js @@ -5,15 +5,24 @@ const { generateChats, } = require("./src/testData"); const { connectDatabase } = require("../modules/stores/mongo"); -const { - loadSampleData, - numberOfRooms, - numberOfChats, - mongo: mongoUrl, -} = require("./security"); +const { mongo: mongoUrl, numberOfChats, numberOfRooms } = require("./loadenv"); + +const fs = require("fs"); +const path = require("path"); +const sampleDataPath = path.resolve(".", "sampleData.json"); const database = connectDatabase(mongoUrl); +const loadSampleData = new Promise((resolve, reject) => { + fs.readFile(sampleDataPath, (err, data) => { + if (err) { + reject(err); + } else { + resolve(JSON.parse(data)); + } + }); +}); + const main = async () => { await database.db.dropDatabase(); diff --git a/src/sampleGenerator/loadenv.js b/src/sampleGenerator/loadenv.js new file mode 100644 index 00000000..0843789b --- /dev/null +++ b/src/sampleGenerator/loadenv.js @@ -0,0 +1,13 @@ +// Root directory์— ์žˆ๋Š” .env.test ํŒŒ์ผ์„ ์ฝ์–ด์˜ด +require("dotenv").config({ path: "../../.env.test" }); + +module.exports = { + mongo: process.env.DB_PATH, // required + numberOfRooms: parseInt(process.env.SAMPLE_NUM_OF_ROOMS ?? 2), // optional + numberOfChats: parseInt(process.env.SAMPLE_NUM_OF_CHATS ?? 200), // optional + maximumIntervalBtwChats: parseFloat( + process.env.SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS ?? 20 + ), // optional + occurenceOfJoin: parseFloat(process.env.SAMPLE_OCCURENCE_OF_JOIN ?? 0.1), // optional + occurenceOfAbort: parseFloat(process.env.SAMPLE_OCCURENCE_OF_ABORT ?? 0.1), // optional +}; diff --git a/src/sampleGenerator/security.js b/src/sampleGenerator/security.js deleted file mode 100644 index 9aed0268..00000000 --- a/src/sampleGenerator/security.js +++ /dev/null @@ -1,26 +0,0 @@ -require("dotenv").config(); -const fs = require("fs"); -const path = require("path"); -const sampleDataPath = path.resolve(".", "sampleData.json"); - -const loadSampleData = new Promise((resolve, reject) => { - fs.readFile(sampleDataPath, (err, data) => { - if (err) { - reject(err); - } else { - resolve(JSON.parse(data)); - } - }); -}); - -module.exports = { - loadSampleData, - mongo: process.env.DB_PATH, - numberOfRooms: parseInt(process.env.NUM_OF_ROOMS ?? 2), - numberOfChats: parseInt(process.env.NUM_OF_CHATS ?? 200), - maximumIntervalBtwChats: parseFloat( - process.env.MAXIMUM_INTERVAL_BETWEEN_CHATS ?? 20 - ), - occurenceOfJoin: parseFloat(process.env.OCCURENCE_OF_JOIN ?? 0.1), - occurenceOfAbort: parseFloat(process.env.OCCURENCE_OF_ABORT ?? 0.1), -}; diff --git a/src/sampleGenerator/src/testData.js b/src/sampleGenerator/src/testData.js index 4043c90f..1209c52a 100644 --- a/src/sampleGenerator/src/testData.js +++ b/src/sampleGenerator/src/testData.js @@ -6,7 +6,11 @@ const { } = require("../../modules/stores/mongo"); const { generateProfileImageUrl } = require("../../modules/modifyProfile"); -const security = require("../security"); +const { + maximumIntervalBtwChats, + occurenceOfJoin, + occurenceOfAbort, +} = require("../loadenv"); const generateUser = async (id, num, isAdmin) => { const newUser = new userModel({ @@ -135,12 +139,10 @@ const generateChats = async (roomId, userOids, numOfChats) => { let userIdsInRoom = []; let userIdsOutRoom = userOids.map((userOid) => userOid); let lastTime = Date.now(); - const maximumIntervalBtwChats = 1000 * security.maximumIntervalBtwChats; //Default: 20,000 milliseconds - const occurenceOfJoin = security.occurenceOfJoin; //Default: 10% - const occurenceOfAbort = security.occurenceOfAbort; //Default: 10%, ์ฆ‰ ์ƒˆ๋กœ์šด ํ•˜๋‚˜์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๊ฐ€ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ค‘ ํ•˜๋‚˜์ผ ํ™•๋ฅ ์€ 20% + const maximumIntervalBtwChatsMilliseconds = 1000 * maximumIntervalBtwChats; for (const i of Array(numOfChats).keys()) { - lastTime += Math.floor(Math.random() * maximumIntervalBtwChats); + lastTime += Math.floor(Math.random() * maximumIntervalBtwChatsMilliseconds); const event = Math.random(); if ( From 01e3ac4d6c8af5a11a9a8e32dd57218091c86348 Mon Sep 17 00:00:00 2001 From: static Date: Sat, 6 Jan 2024 21:09:57 +0900 Subject: [PATCH 086/108] Remove: unnecessary async call --- src/sampleGenerator/index.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/sampleGenerator/index.js b/src/sampleGenerator/index.js index 74c6ad5a..e83a9335 100644 --- a/src/sampleGenerator/index.js +++ b/src/sampleGenerator/index.js @@ -7,26 +7,15 @@ const { const { connectDatabase } = require("../modules/stores/mongo"); const { mongo: mongoUrl, numberOfChats, numberOfRooms } = require("./loadenv"); -const fs = require("fs"); -const path = require("path"); -const sampleDataPath = path.resolve(".", "sampleData.json"); - const database = connectDatabase(mongoUrl); -const loadSampleData = new Promise((resolve, reject) => { - fs.readFile(sampleDataPath, (err, data) => { - if (err) { - reject(err); - } else { - resolve(JSON.parse(data)); - } - }); -}); +const fs = require("fs"); +const sampleData = JSON.parse(fs.readFileSync("./sampleData.json")); const main = async () => { await database.db.dropDatabase(); - const { users, locations } = await Promise.resolve(loadSampleData); + const { users, locations } = sampleData; const userOids = []; const roomOids = []; From 2179ae3cf5e81226944413c7122ec80f75cbce6d Mon Sep 17 00:00:00 2001 From: static Date: Sat, 6 Jan 2024 21:28:37 +0900 Subject: [PATCH 087/108] Fix: tools/dump.js and restore.js --- src/sampleGenerator/tools/dump.js | 4 ++-- src/sampleGenerator/tools/restore.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sampleGenerator/tools/dump.js b/src/sampleGenerator/tools/dump.js index 544f2cfd..7d26d802 100644 --- a/src/sampleGenerator/tools/dump.js +++ b/src/sampleGenerator/tools/dump.js @@ -1,11 +1,11 @@ const util = require("util"); const path = require("path"); const exec = util.promisify(require("child_process").exec); -const security = require("../security"); +const { mongo: mongoUrl } = require("../loadenv"); const main = async () => { const { stdout, stderr } = await exec( - `mongodump ${security.mongo} --out ${path.resolve("dump")}` + `mongodump ${mongoUrl} --out ${path.resolve("dump")}` ); console.log("dump ๋””๋ ‰ํ† ๋ฆฌ์— ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ๋คํ”„ํ–ˆ์Šต๋‹ˆ๋‹ค."); process.exit(0); diff --git a/src/sampleGenerator/tools/restore.js b/src/sampleGenerator/tools/restore.js index f5e8c977..98fdfdc7 100644 --- a/src/sampleGenerator/tools/restore.js +++ b/src/sampleGenerator/tools/restore.js @@ -1,12 +1,12 @@ const util = require("util"); const path = require("path"); const exec = util.promisify(require("child_process").exec); -const security = require("../security"); +const { mongo: mongoUrl } = require("../loadenv"); const main = async () => { - const dbName = security.mongo.split("/").pop(); + const dbName = mongoUrl.split("/").pop(); const { stdout, stderr } = await exec( - `mongorestore ${security.mongo} ${path.resolve("dump")}` + `mongorestore ${mongoUrl} ${path.resolve("dump")}` ); console.log( "dump ๋””๋ ‰ํ† ๋ฆฌ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ๋ณต์›ํ–ˆ์Šต๋‹ˆ๋‹ค." From 7face6972153e49102aef1ef2597c50907a7cc71 Mon Sep 17 00:00:00 2001 From: static Date: Sat, 6 Jan 2024 21:35:45 +0900 Subject: [PATCH 088/108] Fix: restoreDB not working --- src/sampleGenerator/tools/restore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sampleGenerator/tools/restore.js b/src/sampleGenerator/tools/restore.js index 98fdfdc7..5c14c98b 100644 --- a/src/sampleGenerator/tools/restore.js +++ b/src/sampleGenerator/tools/restore.js @@ -6,7 +6,7 @@ const { mongo: mongoUrl } = require("../loadenv"); const main = async () => { const dbName = mongoUrl.split("/").pop(); const { stdout, stderr } = await exec( - `mongorestore ${mongoUrl} ${path.resolve("dump")}` + `mongorestore ${mongoUrl} ${path.resolve("dump", dbName)}` ); console.log( "dump ๋””๋ ‰ํ† ๋ฆฌ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ๋ณต์›ํ–ˆ์Šต๋‹ˆ๋‹ค." From c58f20bb328c0c9d56396d0ce6c8187846894582 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 7 Jan 2024 16:33:02 +0000 Subject: [PATCH 089/108] Fix: error message prefix --- src/services/chats.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/chats.js b/src/services/chats.js index abcbd073..ca74d774 100644 --- a/src/services/chats.js +++ b/src/services/chats.js @@ -273,7 +273,7 @@ const uploadChatImgDoneHandler = async (req, res) => { if (!user) { return res .status(500) - .send("Chat/uploadChatImg/getPUrl : internal server error"); + .send("Chat/uploadChatImg/done : internal server error"); } if (!chat) { return res.status(404).json({ @@ -294,7 +294,7 @@ const uploadChatImgDoneHandler = async (req, res) => { if (err) { return res .status(500) - .send("Chat/uploadChatImg/getPUrl : internal server error"); + .send("Chat/uploadChatImg/done : internal server error"); } chat.content = chat._id; From b4745de651a88a4dc91840c3d82362ac4351e2da Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 7 Jan 2024 16:45:40 +0000 Subject: [PATCH 090/108] Docs: utils.js --- src/routes/docs/chats.js | 295 ++++++++++++++++++++++++++++++++++++--- src/routes/docs/utils.js | 3 + 2 files changed, 282 insertions(+), 16 deletions(-) create mode 100644 src/routes/docs/utils.js diff --git a/src/routes/docs/chats.js b/src/routes/docs/chats.js index 81be8bcf..e6927a91 100644 --- a/src/routes/docs/chats.js +++ b/src/routes/docs/chats.js @@ -1,3 +1,5 @@ +const objectIdPattern = require("./utils"); + const tag = "chats"; const apiPrefix = "/chats"; @@ -15,6 +17,7 @@ chatsDocs[`${apiPrefix}`] = { properties: { roomId: { type: "string", + pattern: objectIdPattern, description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", }, }, @@ -74,6 +77,7 @@ chatsDocs[`${apiPrefix}/load/before`] = { properties: { roomId: { type: "string", + pattern: objectIdPattern, description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", }, lastMsgDate: { @@ -141,6 +145,7 @@ chatsDocs[`${apiPrefix}/load/after`] = { properties: { roomId: { type: "string", + pattern: objectIdPattern, description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", }, lastMsgDate: { @@ -198,40 +203,298 @@ chatsDocs[`${apiPrefix}/load/after`] = { chatsDocs[`${apiPrefix}/send`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ฑ„ํŒ… ์š”์ฒญ ์ฒ˜๋ฆฌ", + description: `์ฑ„ํŒ… ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ socker ํ†ต์‹ ์„ ํ†ตํ•˜์—ฌ ๊ฐ™์€ ๋ฐฉ์— ์žˆ๋Š” user๋“ค์—๊ฒŒ ์ด ์ฑ„ํŒ…์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + type: { + type: "string", + enum: [ + "text", + "s3img", + "in", + "out", + "payment", + "settlement", + "account", + "departure", + "arrival", + ], + description: `์ฑ„ํŒ… ๋ฉ”์‹œ์ง€์˜ ์œ ํ˜•
+ ์ผ๋ฐ˜ text์˜ ๊ฒฝ์šฐ *text*, ์‚ฌ์ง„์˜ ๊ฒฝ์šฐ *s3img*
+ ๊ธฐํƒ€ ์ข…๋ฅ˜์˜ ์ฑ„ํŒ…์˜ ๊ฒฝ์šฐ(์ž…์žฅ, ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ๋“ฑ) ์ •ํ•ด์ง„ type์˜ ์ฑ„ํŒ…์„ ์‚ฌ์šฉ`, + }, + content: { + type: "string", + example: "์•ˆ๋…•ํ•˜์„ธ์š”~!", + description: "์ฑ„ํŒ… ๋ฉ”์„ธ์ง€์˜ ๋ณธ๋ฌธ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { + value: "Chat/send : socket did not connected", + }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: "Chat/send : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/send : internal server error", + }, + }, + }, + }, }, }; chatsDocs[`${apiPrefix}/read`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ฑ„ํŒ… ์ฝ์€ ์‹œ๊ฐ ์—…๋ฐ์ดํŠธ ์š”์ฒญ", + description: `์ฑ„ํŒ… ์ฝ์€ ์‹œ๊ฐ์˜ ์—…๋ฐ์ดํŠธ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ socket ํ†ต์‹ ์„ ํ†ตํ•˜์—ฌ ๊ฐ™์€ ๋ฐฉ์— ์žˆ๋Š” user๋“ค์—๊ฒŒ ์—…๋ฐ์ดํŠธ๋ฅผ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + example: "Chat/read : socket did not connected", + }, + }, + }, + 404: { + content: { + "text/html": { + example: "Chat/read : cannot find room info", + }, + }, + }, + 500: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์ด๋ฒคํŠธ ์ „์†ก ์˜ค๋ฅ˜": { + value: "Chat/read : failed to emit socket events", + }, + "๊ธฐํƒ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜": { + value: "Chat/read : internal server error", + }, + }, + }, + }, + }, + }, }, }; chatsDocs[`${apiPrefix}/uploadChatImg/getPUrl`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” Presigned-url์„ ๋ฐœ๊ธ‰", + description: `์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ํ•˜๊ธฐ ์œ„ํ•œ Presigned-url์„ ๋ฐœ๊ธ‰ํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋ฏธ์ง€ ์ „์†ก์„ ์œ„ํ•ด \`s3img\` ํ˜•์‹์˜ chat document๋ฅผ ์ƒ์„ฑ ํ›„ ์ €์žฅํ•˜๋ฉฐ,
+ presigned-url์€ aws S3 api๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + type: { + type: "string", + enum: ["image/png", "image/jpg", "image/jpeg"], + description: "์ฑ„ํŒ… ์ด๋ฏธ์ง€์˜ ํŒŒ์ผ ํ˜•์‹", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + id: { + type: "string", + pattern: objectIdPattern, + description: "์ƒ์„ฑ๋œ chat Document์˜ object id", + }, + url: { + type: "string", + example: "https://s3.{region}.amazonaws.com/{bucket-name}", + description: "taxi s3 url ์ฃผ์†Œ", + }, + fields: { + type: "object", + properties: { + bucket: { + type: "string", + example: "bucket-name", + }, + "Content-Type": { + type: "string", + enum: ["image/png", "image/jpg", "image/jpeg"], + }, + key: { + type: "string", + pattern: `^chat-img/[a-fA-F\d]{24}$`, + }, + }, + description: "image์˜ key, type, bucket์™€ ๊ฐ™์€ ์ •๋ณด", + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + example: "Chat/uploadChatImg/getPUrl : did not joined the chatting", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/uploadChatImg/getPUrl : internal server error", + }, + }, + }, + }, }, }; chatsDocs[`${apiPrefix}/uploadChatImg/done`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ฑ„ํŒ… ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์™„๋ฃŒ ์—ฌ๋ถ€ ํ™•์ธ", + description: `์ฑ„ํŒ… ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ๋‹ค๋ฉด, socket ํ†ต์‹ ์„ ํ†ตํ•ด ์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋•Œ ์ฑ„ํŒ…์˜ \`content\`์—๋Š” s3์— ์ €์žฅ๋œ url์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ฑ„ํŒ…์˜ object id๋ฅผ ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 404: { + content: { + "text/html": { + example: "Chat/uploadChatImg/done : no corresponding chat", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/uploadChatImg/getPUrl : internal server error", + }, + }, + }, + }, }, }; diff --git a/src/routes/docs/utils.js b/src/routes/docs/utils.js new file mode 100644 index 00000000..ad7e2e0a --- /dev/null +++ b/src/routes/docs/utils.js @@ -0,0 +1,3 @@ +const objectIdPattern = `^[a-fA-F\d]{24}$`; + +module.exports = objectIdPattern; From 3bdcf5088fae3a09e27be429999f691ce1fdef59 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 7 Jan 2024 16:56:21 +0000 Subject: [PATCH 091/108] Docs: remove .md file and update content --- src/routes/docs/chats.js | 14 +++++- src/routes/docs/chats.md | 99 ---------------------------------------- 2 files changed, 13 insertions(+), 100 deletions(-) delete mode 100644 src/routes/docs/chats.md diff --git a/src/routes/docs/chats.js b/src/routes/docs/chats.js index e6927a91..5caaf34f 100644 --- a/src/routes/docs/chats.js +++ b/src/routes/docs/chats.js @@ -205,7 +205,19 @@ chatsDocs[`${apiPrefix}/send`] = { tags: [tag], summary: "์ฑ„ํŒ… ์š”์ฒญ ์ฒ˜๋ฆฌ", description: `์ฑ„ํŒ… ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
- socker ํ†ต์‹ ์„ ํ†ตํ•˜์—ฌ ๊ฐ™์€ ๋ฐฉ์— ์žˆ๋Š” user๋“ค์—๊ฒŒ ์ด ์ฑ„ํŒ…์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.`, + socker ํ†ต์‹ ์„ ํ†ตํ•˜์—ฌ ๊ฐ™์€ ๋ฐฉ์— ์žˆ๋Š” user๋“ค์—๊ฒŒ ์ด ์ฑ„ํŒ…์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.
+
+ ์ฑ„ํŒ… ๊ธฐ๋ก์€ ์•„๋ž˜์™€ ๊ฐ™์ด ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค.
+ + Chat { + roomId: ObjectId, //๋ฐฉ์˜ objectId + type: String, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜ ("text": ์ผ๋ฐ˜ ๋ฉ”์‹œ์ง€, "s3img": S3์— ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€, "in": ์ž…์žฅ ๋ฉ”์‹œ์ง€, "out": ํ‡ด์žฅ ๋ฉ”์‹œ์ง€, "payment": ๊ฒฐ์ œ ๋ฉ”์‹œ์ง€, "settlement": ์ •์‚ฐ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€, "account": ๊ณ„์ขŒ ์ „์†ก ๋ฉ”์‹œ์ง€) + authorId: ObejctId, //์ž‘์„ฑ์ž์˜ objectId + content: String, // ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ (๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜์— ๋”ฐ๋ผ ํฌ๋งท์ด ์ƒ์ดํ•จ) + time: String(ISO 8601), // ex) 2024-01-08T01:52:00.000Z + isValid: Boolean, // ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๊ฐ€ ์œ ํšจํ•œ ์ง€ ์—ฌ๋ถ€. ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ–ˆ์„ ๋•Œ, ํ•ด๋‹น ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ๋๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ์ง€ ์•Š๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋จ. + } + `, requestBody: { content: { "application/json": { diff --git a/src/routes/docs/chats.md b/src/routes/docs/chats.md deleted file mode 100644 index 307d2def..00000000 --- a/src/routes/docs/chats.md +++ /dev/null @@ -1,99 +0,0 @@ -## `chats`: ์ฑ„ํŒ… ์‹œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ ์ •๋ฆฌ - -Taxi์˜ ์ฑ„ํŒ… ๊ธฐ๋Šฅ์€ Socket.IO ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. -ํด๋ผ์ด์–ธํŠธ์—์„œ์˜ ์ผ๋ฐ˜์ ์ธ Socket.IO ์‚ฌ์šฉ๋ฒ•์€ [๊ณต์‹ ๋ฌธ์„œ](https://socket.io/docs/v4/client-socket-instance/)๋ฅผ ์ฐธ์กฐํ•ด์ฃผ์„ธ์š”. -์•„๋ž˜์™€ ๊ฐ™์€ ์ฑ„ํŒ… ์ด๋ฒคํŠธ๋“ค์ด ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. - -- `chats-join` -- `chats-receive` -- `chats-send` -- `chats-load` -- `chats-disconnected` (์‚ญ์ œํ•ด์•ผ ํ•จ) - -์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ชจ๋“  ์ฑ„ํŒ… ๊ธฐ๋ก์€ ์•„๋ž˜์™€ ๊ฐ™์€ ์ž๋ฃŒํ˜•์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. - -```javascript -Chat { - roomId: ObjectId, //๋ฐฉ์˜ objectId - type: String, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜("text": ์ผ๋ฐ˜ ๋ฉ”์‹œ์ง€, "in": ์ž…์žฅ ๋ฉ”์‹œ์ง€, "out": ํ‡ด์žฅ ๋ฉ”์‹œ์ง€, "s3img": S3์— ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€, "payment": ๊ฒฐ์ œ ๋ฉ”์‹œ์ง€, "settlement": ์ •์‚ฐ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€) - authorId: ObejctId, //์ž‘์„ฑ์ž์˜ objectId - content: String, // ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ(๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜์— ๋”ฐ๋ผ ํฌ๋งท์ด ์ƒ์ดํ•˜๋ฉฐ, ํ•˜๋‹จ ์ฐธ์กฐ) - time: String(ISO 8601), // ex) '2022-01-12T13:58:20.180Z' - isValid: Boolean, // ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๊ฐ€ ์œ ํšจํ•œ ์ง€ ์—ฌ๋ถ€. ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ–ˆ์„ ๋•Œ, ํ•ด๋‹น ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ๋๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ์ง€ ์•Š๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋จ. -} -``` - -### 1. `chats-join` - -๋ฐฉ์— ์ƒˆ ์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌํ•  ๋•Œ ์ด ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค์„ธ์š”. -ํ•„์š”ํ•œ ์ธ์ž๋Š” `roomId`์ž…๋‹ˆ๋‹ค. - -- `roomId`: ๋ฐฉ์˜ ObjectID (`String`), Socket.IO ์„œ๋ฒ„์™€ ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•  ๋•Œ ์‚ฌ์šฉ์ž๋Š” ๋กœ๊ทธ์ธ์ด ๋˜์–ด ์žˆ์–ด์•ผ ํ•˜๋ฉฐ, ๋“ค์–ด๊ฐ€๋ ค๋Š” ์ฑ„ํŒ…๋ฐฉ์— ์ฐธ์—ฌ์ž๋กœ ์ฐธ์—ฌํ•˜๊ณ  ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. - -```javascript -const socket = io(server_address, { withCredentials: true }); -socket.emit("chats-join", roomId); -``` - -์ฑ„ํŒ…๋ฐฉ ์ ‘์†์ด ์ •์ƒ์ ์œผ๋กœ ์™„๋ฃŒ๋˜๋ฉด, Socket.io ์„œ๋ฒ„๋Š” ์ตœ๊ทผ 30๊ฐœ์˜ ๋ฉ”์‹œ์ง€๋“ค(`Chat` ๋ฐฐ์—ด)์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-join", (chats) => { - // ์ตœ๊ทผ 30๊ฐœ์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ - console.log(chats); -}); -``` - -### 2. `chats-send` - -์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ผ ๋•Œ ์ด ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค์„ธ์š”. -ํ•„์š”ํ•œ ์ธ์ž๋Š” `roomId`์™€ `content`์ž…๋‹ˆ๋‹ค. - -- `roomId`: ์ฐธ์—ฌ์ค‘์ธ ๋ฐฉ์˜ ObjectID(`String`) -- `content`: ๋ณด๋‚ผ ํ…์ŠคํŠธ(`String`) - -```javascript -socket.emit("chats-send", { roomId, content }); -``` - -๋ฉ”์‹œ์ง€ ์ „์†ก์ด ์„ฑ๊ณต/์‹คํŒจํ•˜๋ฉด, Socket.IO ์„œ๋ฒ„๋„ `chats-send` ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-send", (response) => { - // ์ตœ๊ทผ 30๊ฐœ์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ - console.log(response); -}); -``` - -`response`๋Š” ์ „์†ก์ด ์„ฑ๊ณตํ–ˆ์„ ๊ฒฝ์šฐ `{done: true}`, ์‹คํŒจํ–ˆ์„ ๊ฒฝ์šฐ `{err: true}`์ž…๋‹ˆ๋‹ค. - -### 3. `chats-receive` - -์ด ์ด๋ฒคํŠธ๋Š” ์„œ๋ฒ„๋‚˜ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๊ฐ€ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ–ˆ์„ ๋•Œ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์ด `chat`์— ์ ‘๊ทผํ•˜์—ฌ ํ•ด๋‹น ๋ฉ”์‹œ์ง€์˜ ๋‚ด์šฉ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-receive", (chat) => { - // ์ƒˆ๋กœ์šด ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ - console.log(chat); -}); -``` - -### 4. `chats-load` - -๊ณผ๊ฑฐ ๋Œ€ํ™” ๋ชฉ๋ก์„ ๋” ๋ถˆ๋Ÿฌ์˜ค๋ ค๋ฉด ์ด ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค์„ธ์š”. ํ•„์š”ํ•œ ์ธ์ž๋Š” `lastDate`์™€ `amount`(์„ ํƒ ์‚ฌํ•ญ) ์ž…๋‹ˆ๋‹ค. - -- `lastDate`: ํ˜„์žฌ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋ถˆ๋Ÿฌ์˜จ ์ฑ„ํŒ…๋“ค ์ค‘ ๊ฐ€์žฅ ์˜ค๋ž˜๋œ ๊ฒƒ์˜ ์ƒ์„ฑ ์‹œ๊ฐ. ์„œ๋ฒ„๋Š” ์ด๋ณด๋‹ค ๋จผ์ € ์ƒ์„ฑ๋œ ๋ฉ”์‹œ์ง€๋“ค์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ISO8601์„ ๋งŒ์กฑํ•˜๋Š” `String`์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. e.g.) `"2022-03-15T13:57:04.732Z"` -- `amount` (์„ ํƒ ์‚ฌํ•ญ): ๋ถˆ๋Ÿฌ์˜ฌ ๊ณผ๊ฑฐ ๋ฉ”์‹œ์ง€์˜ ์ˆ˜. 1~50์˜ ์ž์—ฐ์ˆ˜์—ฌ์•ผ ํ•˜๋ฉฐ, ์ž…๋ ฅํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ 30๊ฐœ์˜ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. - -```javascript -socket.emit("chats-load", { lastDate: "2022-03-15T13:57:04.732Z", amount: 30 }); -``` - -`chats-load` ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์„œ๋ฒ„๋Š” ํด๋ผ์ด์–ธํŠธ์— ๋‹ค์‹œ `chats-load` ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œ์ผœ ๊ณผ๊ฑฐ ์ฑ„ํŒ…๋“ค(`Chat` ๋ฐฐ์—ด)์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-load", (chats) => { - // ๊ณผ๊ฑฐ ๋ฉ”์‹œ์ง€๋“ค ์ถœ๋ ฅ - console.log(chats); -}); -``` From 6d4804ee5c74c5584a6a45dfbd07ef67a6053a5e Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 7 Jan 2024 17:12:22 +0000 Subject: [PATCH 092/108] Docs: apply utils.js and refactor docs code --- src/routes/docs/chats.js | 2 +- src/routes/docs/locations.js | 4 ++-- src/routes/docs/logininfo.js | 3 +++ src/routes/docs/reports.js | 10 ++++++++++ src/routes/docs/reportsSchema.js | 4 +++- src/routes/docs/users.js | 1 + src/routes/docs/utils.js | 2 +- 7 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/routes/docs/chats.js b/src/routes/docs/chats.js index 5caaf34f..97fc1352 100644 --- a/src/routes/docs/chats.js +++ b/src/routes/docs/chats.js @@ -1,4 +1,4 @@ -const objectIdPattern = require("./utils"); +const { objectIdPattern } = require("./utils"); const tag = "chats"; const apiPrefix = "/chats"; diff --git a/src/routes/docs/locations.js b/src/routes/docs/locations.js index 1fb445b9..34773482 100644 --- a/src/routes/docs/locations.js +++ b/src/routes/docs/locations.js @@ -6,8 +6,8 @@ locationsDocs[`${apiPrefix}`] = { get: { tags: [tag], summary: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ๋ฐ˜ํ™˜", - description: - "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
\n (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)", + description: `์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
+ (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)`, responses: { 200: { description: "์„œ๋ฒ„์— ์ €์žฅ๋œ location์ด ์—†์„ ๊ฒฝ์šฐ, locations์€ ๋นˆ ๋ฐฐ์—ด", diff --git a/src/routes/docs/logininfo.js b/src/routes/docs/logininfo.js index e752d3b0..59b5e0a8 100644 --- a/src/routes/docs/logininfo.js +++ b/src/routes/docs/logininfo.js @@ -1,3 +1,5 @@ +const { objectIdPattern } = require("./utils"); + const tag = "logininfo"; const apiPrefix = "/logininfo"; @@ -18,6 +20,7 @@ logininfoDocs[`${apiPrefix}`] = { properties: { oid: { type: "string", + type: objectIdPattern, }, id: { type: "string", diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index 0f5b8e76..b3976e7b 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -1,3 +1,5 @@ +const { objectIdPattern } = require("./utils"); + const tag = "reports"; const apiPrefix = "/reports"; @@ -57,9 +59,17 @@ reportsDocs[`${apiPrefix}/searchByUser`] = { properties: { reporting: { type: "array", + items: { + type: "string", + pattern: objectIdPattern, + }, }, reported: { type: "array", + items: { + type: "string", + pattern: objectIdPattern, + }, }, }, }, diff --git a/src/routes/docs/reportsSchema.js b/src/routes/docs/reportsSchema.js index 841918cf..654e1178 100644 --- a/src/routes/docs/reportsSchema.js +++ b/src/routes/docs/reportsSchema.js @@ -1,3 +1,5 @@ +const { objectIdPattern } = require("./utils"); + const reportsSchema = { createHandler: { type: "object", @@ -5,7 +7,7 @@ const reportsSchema = { properties: { reportedId: { type: "string", - pattern: "^[a-fA-F\\d]{24}$", + pattern: objectIdPattern, }, type: { type: "string", diff --git a/src/routes/docs/users.js b/src/routes/docs/users.js index 193eb702..3cd8aa96 100644 --- a/src/routes/docs/users.js +++ b/src/routes/docs/users.js @@ -82,6 +82,7 @@ usersDocs[`${apiPrefix}/editNickname`] = { properties: { nickname: { type: "string", + example: "๋ˆ์งˆ๊ธด ์—ด๊ณผ ๋ถ„์ž์˜ ์ด๋™", description: "์œ ์ €์˜ ์ƒˆ ๋‹‰๋„ค์ž„", }, }, diff --git a/src/routes/docs/utils.js b/src/routes/docs/utils.js index ad7e2e0a..b435476b 100644 --- a/src/routes/docs/utils.js +++ b/src/routes/docs/utils.js @@ -1,3 +1,3 @@ const objectIdPattern = `^[a-fA-F\d]{24}$`; -module.exports = objectIdPattern; +module.exports = { objectIdPattern }; From 9393346e4009eae69449bc3b035d5ec8727f2b71 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 7 Jan 2024 17:25:12 +0000 Subject: [PATCH 093/108] Docs: rooms.js basic format --- src/routes/docs/rooms.js | 96 ++++++++++++++++++++++++++++++++++ src/routes/docs/swaggerDocs.js | 6 +++ 2 files changed, 102 insertions(+) create mode 100644 src/routes/docs/rooms.js diff --git a/src/routes/docs/rooms.js b/src/routes/docs/rooms.js new file mode 100644 index 00000000..ecdffeb5 --- /dev/null +++ b/src/routes/docs/rooms.js @@ -0,0 +1,96 @@ +const tag = "rooms"; +const apiPrefix = "/rooms"; + +const roomsDocs = {}; + +roomsDocs[`${apiPrefix}/create`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/publicInfo`] = { + get: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/info`] = { + get: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/join`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/abort`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/search`] = { + get: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/searchByUser`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/commitPayment`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +roomsDocs[`${apiPrefix}/commitSettlement`] = { + post: { + tags: [tag], + summary: "", + description: "", + requestBody: {}, + responses: {}, + }, +}; + +module.exports = roomsDocs; diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index 84f4e040..5b995c27 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -4,6 +4,7 @@ const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); const authDocs = require("./auth"); const usersDocs = require("./users"); +const roomsDocs = require("./rooms"); const { port, nodeEnv } = require("../../../loadenv"); const serverList = [ @@ -56,6 +57,10 @@ const swaggerDocs = { name: "users", description: "์œ ์ € ๊ณ„์ • ์ •๋ณด ์ˆ˜์ • ๋ฐ ์กฐํšŒ", }, + { + name: "rooms", + description: "๋ฐฉ ์ƒ์„ฑ/์ˆ˜์ •/์‚ญ์ œ/์กฐํšŒ ๋ฐ ๊ด€๋ฆฌ ์ง€์›", + }, ], consumes: ["application/json"], produces: ["application/json"], @@ -65,6 +70,7 @@ const swaggerDocs = { ...locationsDocs, ...usersDocs, ...authDocs, + ...roomsDocs, }, components: { schemas: { From 0a8e4cb52b54ab5913aee5a11df195ca8cd635f7 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 9 Jan 2024 21:11:51 +0900 Subject: [PATCH 094/108] Docs: remove the hyperlink into taxiSampleGenerator in README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 26cda418..9a335131 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,3 @@ See [contributors](https://github.com/sparcs-kaist/taxi-front/graphs/contributor - app : https://github.com/sparcs-kaist/taxi-app - docker : https://github.com/sparcs-kaist/taxi-docker - figma : https://www.figma.com/file/li34hP1oStJAzLNjcG5KjN/SPARCS-Taxi?node-id=0%3A1 - - taxiSampleGenerator : https://github.com/sparcs-kaist/taxiSampleGenerator From 22a4e660d5adcf97953f567ab56c2cd65b6ff088 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 13 Jan 2024 17:22:20 +0000 Subject: [PATCH 095/108] Docs: update utils.js --- src/routes/docs/utils.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/routes/docs/utils.js diff --git a/src/routes/docs/utils.js b/src/routes/docs/utils.js new file mode 100644 index 00000000..8181ceac --- /dev/null +++ b/src/routes/docs/utils.js @@ -0,0 +1,12 @@ +const objectIdPattern = `^[a-fA-F\d]{24}$`; +const roomsPattern = { + rooms: { + name: RegExp( + "^[A-Za-z0-9๊ฐ€-ํžฃใ„ฑ-ใ…Žใ…-ใ…ฃ,.?! _~/#'\\\\@=\"\\-\\^()+*<>{}[\\]]{1,50}$" + ), + from: RegExp("^[A-Za-z0-9๊ฐ€-ํžฃ -]{1,20}$"), + to: RegExp("^[A-Za-z0-9๊ฐ€-ํžฃ -]{1,20}$"), + }, +}; + +module.exports = { objectIdPattern, roomsPattern }; From 8a181d8b1449ff7fdd7d9415a915658680e90fb8 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 13 Jan 2024 17:23:10 +0000 Subject: [PATCH 096/108] Docs: add room and part schema --- src/routes/docs/roomsSchema.js | 74 ++++++++++++++++++++++++++++++++++ src/routes/docs/swaggerDocs.js | 3 ++ 2 files changed, 77 insertions(+) create mode 100644 src/routes/docs/roomsSchema.js diff --git a/src/routes/docs/roomsSchema.js b/src/routes/docs/roomsSchema.js new file mode 100644 index 00000000..0cbe79b5 --- /dev/null +++ b/src/routes/docs/roomsSchema.js @@ -0,0 +1,74 @@ +const { objectIdPattern, roomsPattern } = require("./utils"); + +const participantSchema = { + part: { + type: "object", + required: ["user", "settlementStatus", "readAt"], + properties: { + user: { + type: "string", + pattern: objectIdPattern, + }, + settlementStatus: { + type: "string", + enum: ["not-departed", "paid", "send-required", "sent"], + default: "not-departed", + }, + readAt: { + type: "string", + format: "date-time", + }, + }, + }, +}; + +const roomsSchema = { + room: { + type: "object", + required: [ + "name", + "from", + "to", + "time", + "madeat", + "settlementTotal", + "maxPartLength", + ], + properties: { + name: { + type: "string", + pattern: objectIdPattern, + }, + from: { + type: "string", + pattern: objectIdPattern, + }, + to: { + type: "string", + pattern: objectIdPattern, + }, + time: { + type: "string", + format: "date-time", + }, + part: { + type: "array", + items: participantSchema["part"], + }, + madeat: { + type: "string", + format: "date-time", + }, + settlementTotal: { + type: "integer", + default: 0, + }, + maxPartLength: { + type: "integer", + default: 4, + }, + }, + }, +}; + +module.exports = { roomsSchema, participantSchema }; diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index 5b995c27..35231aaa 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -1,4 +1,5 @@ const reportsSchema = require("./reportsSchema"); +const { participantSchema, roomsSchema } = require("./roomsSchema"); const reportsDocs = require("./reports"); const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); @@ -75,6 +76,8 @@ const swaggerDocs = { components: { schemas: { ...reportsSchema, + ...participantSchema, + ...roomsSchema, }, }, }; From e7746fd30b32cc4c651d07e83580694f03016fe2 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sat, 13 Jan 2024 17:23:50 +0000 Subject: [PATCH 097/108] Docs: add /create /info /publicinfo in rooms.js --- src/routes/docs/rooms.js | 194 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 182 insertions(+), 12 deletions(-) diff --git a/src/routes/docs/rooms.js b/src/routes/docs/rooms.js index ecdffeb5..56dcda9d 100644 --- a/src/routes/docs/rooms.js +++ b/src/routes/docs/rooms.js @@ -1,3 +1,5 @@ +const { objectIdPattern, roomsPattern } = require("./utils"); + const tag = "rooms"; const apiPrefix = "/rooms"; @@ -6,30 +8,198 @@ const roomsDocs = {}; roomsDocs[`${apiPrefix}/create`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "๋ฐฉ ์ƒ์„ฑ", + description: `๋ฐฉ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ํ•œ ์œ ์ €๋‹น ์ตœ๋Œ€ 5๊ฐœ์˜ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ์— ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + name: { + type: "string", + pattern: roomsPattern.rooms.name, + description: `๋ฐฉ ์ด๋ฆ„
+ 1~50 ๊ธ€์ž๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ ์˜์–ด ๋Œ€์†Œ๋ฌธ์ž, ์ˆซ์ž, ํ•œ๊ธ€, ํŠน์ • ํŠน์ˆ˜๊ธฐํ˜ธ("-", ",", ".", "?", "!", "_")๋งŒ ๊ฐ€๋Šฅ`, + }, + from: { + type: "string", + pattern: roomsPattern.rooms.from, + description: "์ถœ๋ฐœ์ง€ location Document์˜ ObjectId", + }, + to: { + type: "string", + pattern: roomsPattern.rooms.to, + description: "๋„์ฐฉ์ง€ location Document์˜ ObjectId", + }, + time: { + type: "string", + format: "date-time", + description: "๋ฐฉ ์ถœ๋ฐœ ์‹œ๊ฐ. ํ˜„์žฌ ์ดํ›„์—ฌ์•ผ ํ•จ.", + }, + maxPartLength: { + type: "integer", + minimum: 2, + maximum: 4, + description: "๋ฐฉ์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: "์ƒ์„ฑ ์™„์„ฑ๋œ ๋ฐฉ ๋ชฉ๋ก", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 400: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + examples: { + "์ถœ๋ฐœ์ง€์™€ ๋„์ฐฉ์ง€๊ฐ€ ๊ฐ™์Œ": { + value: { + error: "Room/create : locations are same", + }, + }, + "ํ˜„์žฌ๋กœ๋ถ€ํ„ฐ 2์ฃผ์ผ๋ณด๋‹ค ์ดํ›„์˜ ๋ฐฉ์„ ์ƒ์„ฑ": { + value: { + error: + "Room/create : cannot over 2 weeks on the basis of current Date", + }, + }, + "์กด์žฌํ•˜์ง€ ์•Š๋Š” location Document๋ฅผ ์ž…๋ ฅ": { + value: { + error: "Rooms/create : no corresponding locations", + }, + }, + "์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌํ•˜๋Š” ์ง„ํ–‰ ์ค‘ ๋ฐฉ์ด 5๊ฐœ ์ด์ƒ": { + value: { + error: "Rooms/create : participating in too many rooms", + }, + }, + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "text/html": { + example: "Rooms/create : internal server error", + }, + }, + }, + }, }, }; roomsDocs[`${apiPrefix}/publicInfo`] = { get: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ •์‚ฐ ์ •๋ณด๋ฅผ ์ œ์™ธํ•œ ๋ฐฉ ์„ธ๋ถ€ ์‚ฌํ•ญ ๋ฐ˜ํ™˜ (๋กœ๊ทธ์ธ ํ•„์š” x)", + description: + "ํŠน์ • id ๋ฐฉ์˜ ์ •์‚ฐ ์ •๋ณด๋ฅผ ์ œ์™ธํ•œ ์„ธ๋ถ€์‚ฌํ•ญ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ์„ ํ•˜์ง€ ์•Š์•„๋„ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.", + parameters: [ + { + in: "query", + name: "id", + schema: { + type: "string", + pattern: objectIdPattern, + }, + description: "์ฐพ๊ณ  ์‹ถ์€ ๋ฐฉ์˜ Object id", + }, + ], + responses: { + 200: { + description: "๋ฐฉ์˜ ์„ธ๋ถ€ ์ •๋ณด๊ฐ€ ๋‹ด๊ธด room Object", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 404: { + description: "ํ•ด๋‹น id๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ", + content: { + "text/html": { + example: "Rooms/publicInfo : id does not exist", + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "text/html": { + example: "Rooms/publicInfo : internal server error", + }, + }, + }, + }, }, }; roomsDocs[`${apiPrefix}/info`] = { get: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "๋ฐฉ ์„ธ๋ถ€ ์‚ฌํ•ญ ๋ฐ˜ํ™˜", + description: "์œ ์ €๊ฐ€ ์ฐธ์—ฌํ•œ ๋ฐฉ์˜ ์„ธ๋ถ€์‚ฌํ•ญ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.", + parameters: [ + { + in: "query", + name: "id", + schema: { + type: "string", + pattern: objectIdPattern, + }, + description: "์ฐพ๊ณ  ์‹ถ์€ ๋ฐฉ์˜ Object id", + }, + ], + responses: { + 200: { + description: "๋ฐฉ์˜ ์„ธ๋ถ€ ์ •๋ณด๊ฐ€ ๋‹ด๊ธด room Object", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 404: { + description: "ํ•ด๋‹น id๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ", + content: { + "text/html": { + example: "Rooms/info : id does not exist", + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "text/html": { + example: "Rooms/info : internal server error", + }, + }, + }, + }, }, }; From 919bfd73294793621c83c9246e5ac1eeb902a5ab Mon Sep 17 00:00:00 2001 From: static Date: Sun, 21 Jan 2024 23:10:33 +0900 Subject: [PATCH 098/108] Remove: .env.example in taxiSampleGenerator --- .env.example | 7 +++++++ src/sampleGenerator/.env.example | 10 ---------- 2 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 src/sampleGenerator/.env.example diff --git a/.env.example b/.env.example index 769e0fa8..ea107da9 100644 --- a/.env.example +++ b/.env.example @@ -16,3 +16,10 @@ CORS_WHITELIST=[CORS ์ •์ฑ…์—์„œ ํ—ˆ์šฉํ•˜๋Š” ๋„๋ฉ”์ธ์˜ ๋ชฉ๋ก(e.g. ["http:/ GOOGLE_APPLICATION_CREDENTIALS=[GOOGLE_APPLICATION_CREDENTIALS JSON] TEST_ACCOUNTS=[์ŠคํŒ์ŠคSSO๋กœ ๋กœ๊ทธ์ธ์‹œ ๋ฌด์กฐ๊ฑด ํ…Œ์ŠคํŠธ๋กœ ๋กœ๊ทธ์ธ์ด ๊ฐ€๋Šฅํ•œ ํ—ˆ์šฉ ์•„์ด๋”” ๋ชฉ๋ก] SLACK_REPORT_WEBHOOK_URL=[Slack ์›นํ›… URL๋“ค์ด ๋‹ด๊ธด JSON] + +# optional environment variables for taxiSampleGenerator +SAMPLE_NUM_OF_ROOMS=[๋ฐฉ์˜ ๊ฐœ์ˆ˜] +SAMPLE_NUM_OF_CHATS=[๊ฐ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜] +SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS=[์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์‹ค์ˆ˜๋„ ๊ฐ€๋Šฅ)] +SAMPLE_OCCURENCE_OF_JOIN=[์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ์ž…์žฅ ๋ฉ”์„ธ์ง€์ผ ํ™•๋ฅ (0 ~ 1 ์‚ฌ์ด์˜ ๊ฐ’)] +SAMPLE_OCCURENCE_OF_ABORT=[์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ํ‡ด์žฅ ๋ฉ”์„ธ์ง€์ผ ํ™•๋ฅ (0 ~ 1 ์‚ฌ์ด์˜ ๊ฐ’)] \ No newline at end of file diff --git a/src/sampleGenerator/.env.example b/src/sampleGenerator/.env.example deleted file mode 100644 index e1b82344..00000000 --- a/src/sampleGenerator/.env.example +++ /dev/null @@ -1,10 +0,0 @@ -#mongoDB ๊ฒฝ๋กœ (์ง์ ‘ ์ž…๋ ฅํ•ด์•ผ ํ•จ - ๊ธฐ๋ณธ๊ฐ’์€ mongodb://localhost:27017/local) -DB_PATH=mongodb://localhost:27017/local -#๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ -NUM_OF_ROOMS=2 -NUM_OF_CHATS=200 -#์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) -MAXIMUM_INTERVAL_BETWEEN_CHATS=20 -#์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) -OCCURENCE_OF_JOIN=0.1 -OCCURENCE_OF_ABORT=0.1 \ No newline at end of file From e03a118a10e6a69542ad02ce54e4775a389ae75a Mon Sep 17 00:00:00 2001 From: static Date: Sun, 21 Jan 2024 23:12:44 +0900 Subject: [PATCH 099/108] Remove: .gitmodules --- .gitmodules | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29b..00000000 From 16d6265f29cc35636fdf574e8b578a5f5b8ce33b Mon Sep 17 00:00:00 2001 From: static Date: Sun, 21 Jan 2024 23:30:27 +0900 Subject: [PATCH 100/108] Fix: pnpm install error --- package.json | 2 +- pnpm-lock.yaml | 146 +++++-------------------------------------------- 2 files changed, 14 insertions(+), 134 deletions(-) diff --git a/package.json b/package.json index 25264498..7c0c7248 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "eslint": "^8.22.0", "eslint-plugin-mocha": "^10.1.0", "mocha": "^10.2.0", - "mongodb": "^6.2.0", + "mongodb": "^4.1.0", "nodemon": "^3.0.1", "supertest": "^6.2.4" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 545f1c18..d7206c1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,7 +34,7 @@ dependencies: version: 2.2.0 connect-mongo: specifier: ^4.6.0 - version: 4.6.0(express-session@1.17.3)(mongodb@6.2.0) + version: 4.6.0(express-session@1.17.3)(mongodb@4.17.1) connect-redis: specifier: ^6.1.3 version: 6.1.3 @@ -122,8 +122,8 @@ devDependencies: specifier: ^10.2.0 version: 10.2.0 mongodb: - specifier: ^6.2.0 - version: 6.2.0 + specifier: ^4.1.0 + version: 4.17.1 nodemon: specifier: ^3.0.1 version: 3.0.1 @@ -228,7 +228,6 @@ packages: '@aws-crypto/util': 3.0.0 '@aws-sdk/types': 3.425.0 tslib: 1.14.1 - dev: false optional: true /@aws-crypto/ie11-detection@3.0.0: @@ -236,7 +235,6 @@ packages: requiresBuild: true dependencies: tslib: 1.14.1 - dev: false optional: true /@aws-crypto/sha256-browser@3.0.0: @@ -251,7 +249,6 @@ packages: '@aws-sdk/util-locate-window': 3.310.0 '@aws-sdk/util-utf8-browser': 3.259.0 tslib: 1.14.1 - dev: false optional: true /@aws-crypto/sha256-js@3.0.0: @@ -261,7 +258,6 @@ packages: '@aws-crypto/util': 3.0.0 '@aws-sdk/types': 3.425.0 tslib: 1.14.1 - dev: false optional: true /@aws-crypto/supports-web-crypto@3.0.0: @@ -269,7 +265,6 @@ packages: requiresBuild: true dependencies: tslib: 1.14.1 - dev: false optional: true /@aws-crypto/util@3.0.0: @@ -279,7 +274,6 @@ packages: '@aws-sdk/types': 3.425.0 '@aws-sdk/util-utf8-browser': 3.259.0 tslib: 1.14.1 - dev: false optional: true /@aws-sdk/client-cognito-identity@3.427.0: @@ -326,7 +320,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/client-sso@3.427.0: @@ -370,7 +363,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/client-sts@3.427.0: @@ -418,7 +410,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-cognito-identity@3.427.0: @@ -433,7 +424,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-env@3.425.0: @@ -445,7 +435,6 @@ packages: '@smithy/property-provider': 2.0.12 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-provider-http@3.425.0: @@ -460,7 +449,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-provider-ini@3.427.0: @@ -480,7 +468,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-node@3.427.0: @@ -501,7 +488,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-process@3.425.0: @@ -514,7 +500,6 @@ packages: '@smithy/shared-ini-file-loader': 2.2.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-provider-sso@3.427.0: @@ -531,7 +516,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-web-identity@3.425.0: @@ -543,7 +527,6 @@ packages: '@smithy/property-provider': 2.0.12 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-providers@3.427.0: @@ -569,7 +552,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/middleware-host-header@3.425.0: @@ -581,7 +563,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-logger@3.425.0: @@ -592,7 +573,6 @@ packages: '@aws-sdk/types': 3.425.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-recursion-detection@3.425.0: @@ -604,7 +584,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-sdk-sts@3.425.0: @@ -616,7 +595,6 @@ packages: '@aws-sdk/types': 3.425.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-signing@3.425.0: @@ -631,7 +609,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-user-agent@3.427.0: @@ -644,7 +621,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/region-config-resolver@3.425.0: @@ -657,7 +633,6 @@ packages: '@smithy/util-config-provider': 2.0.0 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/token-providers@3.427.0: @@ -702,7 +677,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/types@3.425.0: @@ -712,7 +686,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-endpoints@3.427.0: @@ -723,7 +696,6 @@ packages: '@aws-sdk/types': 3.425.0 '@smithy/node-config-provider': 2.1.1 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-locate-window@3.310.0: @@ -732,7 +704,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-user-agent-browser@3.425.0: @@ -743,7 +714,6 @@ packages: '@smithy/types': 2.3.5 bowser: 2.11.0 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-user-agent-node@3.425.0: @@ -760,7 +730,6 @@ packages: '@smithy/node-config-provider': 2.1.1 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-utf8-browser@3.259.0: @@ -768,7 +737,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@babel/code-frame@7.22.5: @@ -2276,7 +2244,7 @@ packages: resolution: {integrity: sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==} dependencies: '@firebase/util': 1.9.3 - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/database-compat@0.3.4: @@ -2287,7 +2255,7 @@ packages: '@firebase/database-types': 0.10.4 '@firebase/logger': 0.4.0 '@firebase/util': 1.9.3 - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/database-types@0.10.4: @@ -2305,19 +2273,19 @@ packages: '@firebase/logger': 0.4.0 '@firebase/util': 1.9.3 faye-websocket: 0.11.4 - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/logger@0.4.0: resolution: {integrity: sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/util@1.9.3: resolution: {integrity: sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@floating-ui/core@1.4.1: @@ -2533,6 +2501,7 @@ packages: requiresBuild: true dependencies: sparse-bitfield: 3.0.3 + optional: true /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -2787,7 +2756,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/config-resolver@2.0.14: @@ -2800,7 +2768,6 @@ packages: '@smithy/util-config-provider': 2.0.0 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@smithy/credential-provider-imds@2.0.16: @@ -2813,7 +2780,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/url-parser': 2.0.11 tslib: 2.6.2 - dev: false optional: true /@smithy/eventstream-codec@2.0.11: @@ -2824,7 +2790,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-hex-encoding': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/fetch-http-handler@2.2.2: @@ -2836,7 +2801,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-base64': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/hash-node@2.0.11: @@ -2848,7 +2812,6 @@ packages: '@smithy/util-buffer-from': 2.0.0 '@smithy/util-utf8': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/invalid-dependency@2.0.11: @@ -2857,7 +2820,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/is-array-buffer@2.0.0: @@ -2866,7 +2828,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-content-length@2.0.13: @@ -2877,7 +2838,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-endpoint@2.0.11: @@ -2890,7 +2850,6 @@ packages: '@smithy/url-parser': 2.0.11 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-retry@2.0.16: @@ -2906,7 +2865,6 @@ packages: '@smithy/util-retry': 2.0.4 tslib: 2.6.2 uuid: 8.3.2 - dev: false optional: true /@smithy/middleware-serde@2.0.11: @@ -2916,7 +2874,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-stack@2.0.5: @@ -2926,7 +2883,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/node-config-provider@2.1.1: @@ -2938,7 +2894,6 @@ packages: '@smithy/shared-ini-file-loader': 2.2.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/node-http-handler@2.1.7: @@ -2951,7 +2906,6 @@ packages: '@smithy/querystring-builder': 2.0.11 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/property-provider@2.0.12: @@ -2961,7 +2915,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/protocol-http@3.0.7: @@ -2971,7 +2924,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/querystring-builder@2.0.11: @@ -2982,7 +2934,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-uri-escape': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/querystring-parser@2.0.11: @@ -2992,7 +2943,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/service-error-classification@2.0.4: @@ -3001,7 +2951,6 @@ packages: requiresBuild: true dependencies: '@smithy/types': 2.3.5 - dev: false optional: true /@smithy/shared-ini-file-loader@2.2.0: @@ -3011,7 +2960,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/signature-v4@2.0.11: @@ -3027,7 +2975,6 @@ packages: '@smithy/util-uri-escape': 2.0.0 '@smithy/util-utf8': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/smithy-client@2.1.10: @@ -3039,7 +2986,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-stream': 2.0.15 tslib: 2.6.2 - dev: false optional: true /@smithy/types@2.3.5: @@ -3048,7 +2994,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/url-parser@2.0.11: @@ -3058,7 +3003,6 @@ packages: '@smithy/querystring-parser': 2.0.11 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-base64@2.0.0: @@ -3068,7 +3012,6 @@ packages: dependencies: '@smithy/util-buffer-from': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-body-length-browser@2.0.0: @@ -3076,7 +3019,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-body-length-node@2.1.0: @@ -3085,7 +3027,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-buffer-from@2.0.0: @@ -3095,7 +3036,6 @@ packages: dependencies: '@smithy/is-array-buffer': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-config-provider@2.0.0: @@ -3104,7 +3044,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-defaults-mode-browser@2.0.14: @@ -3117,7 +3056,6 @@ packages: '@smithy/types': 2.3.5 bowser: 2.11.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-defaults-mode-node@2.0.18: @@ -3132,7 +3070,6 @@ packages: '@smithy/smithy-client': 2.1.10 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-hex-encoding@2.0.0: @@ -3141,7 +3078,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-middleware@2.0.4: @@ -3151,7 +3087,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-retry@2.0.4: @@ -3162,7 +3097,6 @@ packages: '@smithy/service-error-classification': 2.0.4 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-stream@2.0.15: @@ -3178,7 +3112,6 @@ packages: '@smithy/util-hex-encoding': 2.0.0 '@smithy/util-utf8': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-uri-escape@2.0.0: @@ -3187,7 +3120,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-utf8@2.0.0: @@ -3197,7 +3129,6 @@ packages: dependencies: '@smithy/util-buffer-from': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@socket.io/component-emitter@3.1.0: @@ -4211,7 +4142,6 @@ packages: /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: false /base64id@2.0.0: resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==} @@ -4270,7 +4200,6 @@ packages: /bowser@2.11.0: resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==} requiresBuild: true - dev: false optional: true /brace-expansion@1.1.11: @@ -4310,11 +4239,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: buffer: 5.7.1 - dev: false - - /bson@6.2.0: - resolution: {integrity: sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==} - engines: {node: '>=16.20.1'} /buffer-equal-constant-time@1.0.1: resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} @@ -4337,7 +4261,6 @@ packages: dependencies: base64-js: 1.5.1 ieee754: 1.1.13 - dev: false /builtin-modules@3.3.0: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} @@ -4570,7 +4493,7 @@ packages: /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - /connect-mongo@4.6.0(express-session@1.17.3)(mongodb@6.2.0): + /connect-mongo@4.6.0(express-session@1.17.3)(mongodb@4.17.1): resolution: {integrity: sha512-8new4Z7NLP3CGP65Aw6ls3xDBeKVvHRSh39CXuDZTQsvpeeU9oNMzfFgvqmHqZ6gWpxIl663RyoVEmCAGf1yOg==} engines: {node: '>=10'} peerDependencies: @@ -4580,7 +4503,7 @@ packages: debug: 4.3.4 express-session: 1.17.3 kruptein: 3.0.6 - mongodb: 6.2.0 + mongodb: 4.17.1 transitivePeerDependencies: - supports-color dev: false @@ -5287,7 +5210,6 @@ packages: requiresBuild: true dependencies: strnum: 1.0.5 - dev: false optional: true /fast-xml-parser@4.2.7: @@ -5795,7 +5717,6 @@ packages: /ieee754@1.1.13: resolution: {integrity: sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==} - dev: false /ignore-by-default@1.0.1: resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==} @@ -5827,7 +5748,6 @@ packages: /ip@2.0.0: resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} - dev: false /ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} @@ -6429,6 +6349,7 @@ packages: /memory-pager@1.5.0: resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} requiresBuild: true + optional: true /merge-descriptors@1.0.1: resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} @@ -6577,38 +6498,6 @@ packages: '@mongodb-js/saslprep': 1.1.0 transitivePeerDependencies: - aws-crt - dev: false - - /mongodb@6.2.0: - resolution: {integrity: sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==} - engines: {node: '>=16.20.1'} - peerDependencies: - '@aws-sdk/credential-providers': ^3.188.0 - '@mongodb-js/zstd': ^1.1.0 - gcp-metadata: ^5.2.0 - kerberos: ^2.0.1 - mongodb-client-encryption: '>=6.0.0 <7' - snappy: ^7.2.2 - socks: ^2.7.1 - peerDependenciesMeta: - '@aws-sdk/credential-providers': - optional: true - '@mongodb-js/zstd': - optional: true - gcp-metadata: - optional: true - kerberos: - optional: true - mongodb-client-encryption: - optional: true - snappy: - optional: true - socks: - optional: true - dependencies: - '@mongodb-js/saslprep': 1.1.0 - bson: 6.2.0 - mongodb-connection-string-url: 2.6.0 /mongoose@6.12.0: resolution: {integrity: sha512-sd/q83C6TBRPBrrD2A/POSbA/exbCFM2WOuY7Lf2JuIJFlHFG39zYSDTTAEiYlzIfahNOLmXPxBGFxdAch41Mw==} @@ -7822,7 +7711,6 @@ packages: /smart-buffer@4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} - dev: false /socket.io-adapter@2.5.2: resolution: {integrity: sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==} @@ -7866,7 +7754,6 @@ packages: dependencies: ip: 2.0.0 smart-buffer: 4.2.0 - dev: false /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} @@ -7895,6 +7782,7 @@ packages: requiresBuild: true dependencies: memory-pager: 1.5.0 + optional: true /stack-trace@0.0.10: resolution: {integrity: sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==} @@ -7946,7 +7834,6 @@ packages: /strnum@1.0.5: resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} requiresBuild: true - dev: false optional: true /stubs@3.0.0: @@ -8175,16 +8062,10 @@ packages: /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} requiresBuild: true - dev: false optional: true - /tslib@2.6.1: - resolution: {integrity: sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==} - dev: false - /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: false /type-check@0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} @@ -8359,7 +8240,6 @@ packages: /uuid@8.3.2: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true - dev: false /uuid@9.0.0: resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} From e77feef34b7f1dc7a83a09b357a98151011a202e Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 28 Jan 2024 14:47:38 +0000 Subject: [PATCH 101/108] Merge branch 'dev' of https://github.com/sparcs-kaist/taxi-back into #135.8-docs-rooms --- .env.example | 7 + .github/workflows/test_ci.yml | 14 - .gitmodules | 4 - README.md | 1 - app.js | 9 +- loadenv.js | 2 +- package.json | 4 +- pnpm-lock.yaml | 146 +------- sampleGenerator | 1 - src/modules/stores/mongo.js | 27 +- src/routes/docs/chats.js | 513 +++++++++++++++++++++++++++ src/routes/docs/chats.md | 99 ------ src/routes/docs/locations.js | 4 +- src/routes/docs/logininfo.js | 3 + src/routes/docs/reports.js | 10 + src/routes/docs/reportsSchema.js | 4 +- src/routes/docs/swaggerDocs.js | 6 + src/routes/docs/users.js | 1 + src/sampleGenerator/.gitignore | 107 ++++++ src/sampleGenerator/README.md | 28 ++ src/sampleGenerator/index.js | 47 +++ src/sampleGenerator/loadenv.js | 13 + src/sampleGenerator/package.json | 17 + src/sampleGenerator/sampleData.json | 112 ++++++ src/sampleGenerator/src/testData.js | 199 +++++++++++ src/sampleGenerator/tools/dump.js | 20 ++ src/sampleGenerator/tools/restore.js | 23 ++ src/services/chats.js | 4 +- test/utils.js | 3 +- 29 files changed, 1153 insertions(+), 275 deletions(-) delete mode 100644 .gitmodules delete mode 160000 sampleGenerator create mode 100644 src/routes/docs/chats.js delete mode 100644 src/routes/docs/chats.md create mode 100644 src/sampleGenerator/.gitignore create mode 100644 src/sampleGenerator/README.md create mode 100644 src/sampleGenerator/index.js create mode 100644 src/sampleGenerator/loadenv.js create mode 100644 src/sampleGenerator/package.json create mode 100644 src/sampleGenerator/sampleData.json create mode 100644 src/sampleGenerator/src/testData.js create mode 100644 src/sampleGenerator/tools/dump.js create mode 100644 src/sampleGenerator/tools/restore.js diff --git a/.env.example b/.env.example index 769e0fa8..ea107da9 100644 --- a/.env.example +++ b/.env.example @@ -16,3 +16,10 @@ CORS_WHITELIST=[CORS ์ •์ฑ…์—์„œ ํ—ˆ์šฉํ•˜๋Š” ๋„๋ฉ”์ธ์˜ ๋ชฉ๋ก(e.g. ["http:/ GOOGLE_APPLICATION_CREDENTIALS=[GOOGLE_APPLICATION_CREDENTIALS JSON] TEST_ACCOUNTS=[์ŠคํŒ์ŠคSSO๋กœ ๋กœ๊ทธ์ธ์‹œ ๋ฌด์กฐ๊ฑด ํ…Œ์ŠคํŠธ๋กœ ๋กœ๊ทธ์ธ์ด ๊ฐ€๋Šฅํ•œ ํ—ˆ์šฉ ์•„์ด๋”” ๋ชฉ๋ก] SLACK_REPORT_WEBHOOK_URL=[Slack ์›นํ›… URL๋“ค์ด ๋‹ด๊ธด JSON] + +# optional environment variables for taxiSampleGenerator +SAMPLE_NUM_OF_ROOMS=[๋ฐฉ์˜ ๊ฐœ์ˆ˜] +SAMPLE_NUM_OF_CHATS=[๊ฐ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜] +SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS=[์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์‹ค์ˆ˜๋„ ๊ฐ€๋Šฅ)] +SAMPLE_OCCURENCE_OF_JOIN=[์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ์ž…์žฅ ๋ฉ”์„ธ์ง€์ผ ํ™•๋ฅ (0 ~ 1 ์‚ฌ์ด์˜ ๊ฐ’)] +SAMPLE_OCCURENCE_OF_ABORT=[์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ํ‡ด์žฅ ๋ฉ”์„ธ์ง€์ผ ํ™•๋ฅ (0 ~ 1 ์‚ฌ์ด์˜ ๊ฐ’)] \ No newline at end of file diff --git a/.github/workflows/test_ci.yml b/.github/workflows/test_ci.yml index 29f7f21b..2ccc5415 100644 --- a/.github/workflows/test_ci.yml +++ b/.github/workflows/test_ci.yml @@ -29,20 +29,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'pnpm' - - id: submodule-local - name: Save local version of submodule - run: echo "ver=`cd sampleGenerator && git log --pretty="%h" -1 && cd ..`" >> $GITHUB_OUTPUT - - id: submodule-origin - name: Save origin version of submodule - run: echo "ver=`cd sampleGenerator && git log origin --pretty="%h" -1 && cd ..`" >> $GITHUB_OUTPUT - - name: Check submodule version - if: ${{ steps.submodule-local.outputs.ver != steps.submodule-origin.outputs.ver }} - uses: actions/github-script@v3 - with: - script: | - core.setFailed('Please update submodule to the latest version by using \"git submodule update --remote\"') - - name: Install sampleGenerator dependencies from package-lock.json - run: cd sampleGenerator && pnpm i --force --frozen-lockfile && cd .. - name: Install taxi-back dependencies from package-lock.json run: pnpm i --force --frozen-lockfile - name: Run unit tests diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f15db4d8..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "sampleGenerator"] - path = sampleGenerator - url = https://github.com/sparcs-kaist/taxiSampleGenerator - branch = main diff --git a/README.md b/README.md index 26cda418..9a335131 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,3 @@ See [contributors](https://github.com/sparcs-kaist/taxi-front/graphs/contributor - app : https://github.com/sparcs-kaist/taxi-app - docker : https://github.com/sparcs-kaist/taxi-docker - figma : https://www.figma.com/file/li34hP1oStJAzLNjcG5KjN/SPARCS-Taxi?node-id=0%3A1 - - taxiSampleGenerator : https://github.com/sparcs-kaist/taxiSampleGenerator diff --git a/app.js b/app.js index f8c24842..a26c4b46 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,12 @@ // ๋ชจ๋“ˆ require const express = require("express"); const http = require("http"); -const { nodeEnv, port: httpPort, eventConfig } = require("./loadenv"); +const { + nodeEnv, + port: httpPort, + eventConfig, + mongo: mongoUrl, +} = require("./loadenv"); const logger = require("./src/modules/logger"); const { connectDatabase } = require("./src/modules/stores/mongo"); const { startSocketServer } = require("./src/modules/socket"); @@ -13,7 +18,7 @@ require("./src/modules/fcm").initializeApp(); const app = express(); // ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ -connectDatabase(); +connectDatabase(mongoUrl); // [Middleware] request body ํŒŒ์‹ฑ app.use(express.urlencoded({ extended: false })); diff --git a/loadenv.js b/loadenv.js index f7224601..789e21db 100644 --- a/loadenv.js +++ b/loadenv.js @@ -43,5 +43,5 @@ module.exports = { slackWebhookUrl: { report: process.env.SLACK_REPORT_WEBHOOK_URL || "", // optional }, - eventConfig: process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG), + eventConfig: process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG), // optional }; diff --git a/package.json b/package.json index 307baba9..7c0c7248 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "serve": "cross-env TZ='Asia/Seoul' NODE_ENV=production node app.js", "runscript": "cross-env TZ='Asia/Seoul' NODE_ENV=production node", "lint": "npx eslint --fix .", - "sample": "cd sampleGenerator && npm start && cd .." + "sample": "cd src/sampleGenerator && npm start && cd .." }, "engines": { "node": ">=18.0.0", @@ -60,7 +60,7 @@ "eslint": "^8.22.0", "eslint-plugin-mocha": "^10.1.0", "mocha": "^10.2.0", - "mongodb": "^6.2.0", + "mongodb": "^4.1.0", "nodemon": "^3.0.1", "supertest": "^6.2.4" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 545f1c18..d7206c1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,7 +34,7 @@ dependencies: version: 2.2.0 connect-mongo: specifier: ^4.6.0 - version: 4.6.0(express-session@1.17.3)(mongodb@6.2.0) + version: 4.6.0(express-session@1.17.3)(mongodb@4.17.1) connect-redis: specifier: ^6.1.3 version: 6.1.3 @@ -122,8 +122,8 @@ devDependencies: specifier: ^10.2.0 version: 10.2.0 mongodb: - specifier: ^6.2.0 - version: 6.2.0 + specifier: ^4.1.0 + version: 4.17.1 nodemon: specifier: ^3.0.1 version: 3.0.1 @@ -228,7 +228,6 @@ packages: '@aws-crypto/util': 3.0.0 '@aws-sdk/types': 3.425.0 tslib: 1.14.1 - dev: false optional: true /@aws-crypto/ie11-detection@3.0.0: @@ -236,7 +235,6 @@ packages: requiresBuild: true dependencies: tslib: 1.14.1 - dev: false optional: true /@aws-crypto/sha256-browser@3.0.0: @@ -251,7 +249,6 @@ packages: '@aws-sdk/util-locate-window': 3.310.0 '@aws-sdk/util-utf8-browser': 3.259.0 tslib: 1.14.1 - dev: false optional: true /@aws-crypto/sha256-js@3.0.0: @@ -261,7 +258,6 @@ packages: '@aws-crypto/util': 3.0.0 '@aws-sdk/types': 3.425.0 tslib: 1.14.1 - dev: false optional: true /@aws-crypto/supports-web-crypto@3.0.0: @@ -269,7 +265,6 @@ packages: requiresBuild: true dependencies: tslib: 1.14.1 - dev: false optional: true /@aws-crypto/util@3.0.0: @@ -279,7 +274,6 @@ packages: '@aws-sdk/types': 3.425.0 '@aws-sdk/util-utf8-browser': 3.259.0 tslib: 1.14.1 - dev: false optional: true /@aws-sdk/client-cognito-identity@3.427.0: @@ -326,7 +320,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/client-sso@3.427.0: @@ -370,7 +363,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/client-sts@3.427.0: @@ -418,7 +410,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-cognito-identity@3.427.0: @@ -433,7 +424,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-env@3.425.0: @@ -445,7 +435,6 @@ packages: '@smithy/property-provider': 2.0.12 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-provider-http@3.425.0: @@ -460,7 +449,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-provider-ini@3.427.0: @@ -480,7 +468,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-node@3.427.0: @@ -501,7 +488,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-process@3.425.0: @@ -514,7 +500,6 @@ packages: '@smithy/shared-ini-file-loader': 2.2.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-provider-sso@3.427.0: @@ -531,7 +516,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/credential-provider-web-identity@3.425.0: @@ -543,7 +527,6 @@ packages: '@smithy/property-provider': 2.0.12 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/credential-providers@3.427.0: @@ -569,7 +552,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/middleware-host-header@3.425.0: @@ -581,7 +563,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-logger@3.425.0: @@ -592,7 +573,6 @@ packages: '@aws-sdk/types': 3.425.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-recursion-detection@3.425.0: @@ -604,7 +584,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-sdk-sts@3.425.0: @@ -616,7 +595,6 @@ packages: '@aws-sdk/types': 3.425.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-signing@3.425.0: @@ -631,7 +609,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/middleware-user-agent@3.427.0: @@ -644,7 +621,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/region-config-resolver@3.425.0: @@ -657,7 +633,6 @@ packages: '@smithy/util-config-provider': 2.0.0 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/token-providers@3.427.0: @@ -702,7 +677,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: false optional: true /@aws-sdk/types@3.425.0: @@ -712,7 +686,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-endpoints@3.427.0: @@ -723,7 +696,6 @@ packages: '@aws-sdk/types': 3.425.0 '@smithy/node-config-provider': 2.1.1 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-locate-window@3.310.0: @@ -732,7 +704,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-user-agent-browser@3.425.0: @@ -743,7 +714,6 @@ packages: '@smithy/types': 2.3.5 bowser: 2.11.0 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-user-agent-node@3.425.0: @@ -760,7 +730,6 @@ packages: '@smithy/node-config-provider': 2.1.1 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@aws-sdk/util-utf8-browser@3.259.0: @@ -768,7 +737,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@babel/code-frame@7.22.5: @@ -2276,7 +2244,7 @@ packages: resolution: {integrity: sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==} dependencies: '@firebase/util': 1.9.3 - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/database-compat@0.3.4: @@ -2287,7 +2255,7 @@ packages: '@firebase/database-types': 0.10.4 '@firebase/logger': 0.4.0 '@firebase/util': 1.9.3 - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/database-types@0.10.4: @@ -2305,19 +2273,19 @@ packages: '@firebase/logger': 0.4.0 '@firebase/util': 1.9.3 faye-websocket: 0.11.4 - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/logger@0.4.0: resolution: {integrity: sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@firebase/util@1.9.3: resolution: {integrity: sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 dev: false /@floating-ui/core@1.4.1: @@ -2533,6 +2501,7 @@ packages: requiresBuild: true dependencies: sparse-bitfield: 3.0.3 + optional: true /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -2787,7 +2756,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/config-resolver@2.0.14: @@ -2800,7 +2768,6 @@ packages: '@smithy/util-config-provider': 2.0.0 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@smithy/credential-provider-imds@2.0.16: @@ -2813,7 +2780,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/url-parser': 2.0.11 tslib: 2.6.2 - dev: false optional: true /@smithy/eventstream-codec@2.0.11: @@ -2824,7 +2790,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-hex-encoding': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/fetch-http-handler@2.2.2: @@ -2836,7 +2801,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-base64': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/hash-node@2.0.11: @@ -2848,7 +2812,6 @@ packages: '@smithy/util-buffer-from': 2.0.0 '@smithy/util-utf8': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/invalid-dependency@2.0.11: @@ -2857,7 +2820,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/is-array-buffer@2.0.0: @@ -2866,7 +2828,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-content-length@2.0.13: @@ -2877,7 +2838,6 @@ packages: '@smithy/protocol-http': 3.0.7 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-endpoint@2.0.11: @@ -2890,7 +2850,6 @@ packages: '@smithy/url-parser': 2.0.11 '@smithy/util-middleware': 2.0.4 tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-retry@2.0.16: @@ -2906,7 +2865,6 @@ packages: '@smithy/util-retry': 2.0.4 tslib: 2.6.2 uuid: 8.3.2 - dev: false optional: true /@smithy/middleware-serde@2.0.11: @@ -2916,7 +2874,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/middleware-stack@2.0.5: @@ -2926,7 +2883,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/node-config-provider@2.1.1: @@ -2938,7 +2894,6 @@ packages: '@smithy/shared-ini-file-loader': 2.2.0 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/node-http-handler@2.1.7: @@ -2951,7 +2906,6 @@ packages: '@smithy/querystring-builder': 2.0.11 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/property-provider@2.0.12: @@ -2961,7 +2915,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/protocol-http@3.0.7: @@ -2971,7 +2924,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/querystring-builder@2.0.11: @@ -2982,7 +2934,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-uri-escape': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/querystring-parser@2.0.11: @@ -2992,7 +2943,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/service-error-classification@2.0.4: @@ -3001,7 +2951,6 @@ packages: requiresBuild: true dependencies: '@smithy/types': 2.3.5 - dev: false optional: true /@smithy/shared-ini-file-loader@2.2.0: @@ -3011,7 +2960,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/signature-v4@2.0.11: @@ -3027,7 +2975,6 @@ packages: '@smithy/util-uri-escape': 2.0.0 '@smithy/util-utf8': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/smithy-client@2.1.10: @@ -3039,7 +2986,6 @@ packages: '@smithy/types': 2.3.5 '@smithy/util-stream': 2.0.15 tslib: 2.6.2 - dev: false optional: true /@smithy/types@2.3.5: @@ -3048,7 +2994,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/url-parser@2.0.11: @@ -3058,7 +3003,6 @@ packages: '@smithy/querystring-parser': 2.0.11 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-base64@2.0.0: @@ -3068,7 +3012,6 @@ packages: dependencies: '@smithy/util-buffer-from': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-body-length-browser@2.0.0: @@ -3076,7 +3019,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-body-length-node@2.1.0: @@ -3085,7 +3027,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-buffer-from@2.0.0: @@ -3095,7 +3036,6 @@ packages: dependencies: '@smithy/is-array-buffer': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-config-provider@2.0.0: @@ -3104,7 +3044,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-defaults-mode-browser@2.0.14: @@ -3117,7 +3056,6 @@ packages: '@smithy/types': 2.3.5 bowser: 2.11.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-defaults-mode-node@2.0.18: @@ -3132,7 +3070,6 @@ packages: '@smithy/smithy-client': 2.1.10 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-hex-encoding@2.0.0: @@ -3141,7 +3078,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-middleware@2.0.4: @@ -3151,7 +3087,6 @@ packages: dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-retry@2.0.4: @@ -3162,7 +3097,6 @@ packages: '@smithy/service-error-classification': 2.0.4 '@smithy/types': 2.3.5 tslib: 2.6.2 - dev: false optional: true /@smithy/util-stream@2.0.15: @@ -3178,7 +3112,6 @@ packages: '@smithy/util-hex-encoding': 2.0.0 '@smithy/util-utf8': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@smithy/util-uri-escape@2.0.0: @@ -3187,7 +3120,6 @@ packages: requiresBuild: true dependencies: tslib: 2.6.2 - dev: false optional: true /@smithy/util-utf8@2.0.0: @@ -3197,7 +3129,6 @@ packages: dependencies: '@smithy/util-buffer-from': 2.0.0 tslib: 2.6.2 - dev: false optional: true /@socket.io/component-emitter@3.1.0: @@ -4211,7 +4142,6 @@ packages: /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: false /base64id@2.0.0: resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==} @@ -4270,7 +4200,6 @@ packages: /bowser@2.11.0: resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==} requiresBuild: true - dev: false optional: true /brace-expansion@1.1.11: @@ -4310,11 +4239,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: buffer: 5.7.1 - dev: false - - /bson@6.2.0: - resolution: {integrity: sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==} - engines: {node: '>=16.20.1'} /buffer-equal-constant-time@1.0.1: resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} @@ -4337,7 +4261,6 @@ packages: dependencies: base64-js: 1.5.1 ieee754: 1.1.13 - dev: false /builtin-modules@3.3.0: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} @@ -4570,7 +4493,7 @@ packages: /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - /connect-mongo@4.6.0(express-session@1.17.3)(mongodb@6.2.0): + /connect-mongo@4.6.0(express-session@1.17.3)(mongodb@4.17.1): resolution: {integrity: sha512-8new4Z7NLP3CGP65Aw6ls3xDBeKVvHRSh39CXuDZTQsvpeeU9oNMzfFgvqmHqZ6gWpxIl663RyoVEmCAGf1yOg==} engines: {node: '>=10'} peerDependencies: @@ -4580,7 +4503,7 @@ packages: debug: 4.3.4 express-session: 1.17.3 kruptein: 3.0.6 - mongodb: 6.2.0 + mongodb: 4.17.1 transitivePeerDependencies: - supports-color dev: false @@ -5287,7 +5210,6 @@ packages: requiresBuild: true dependencies: strnum: 1.0.5 - dev: false optional: true /fast-xml-parser@4.2.7: @@ -5795,7 +5717,6 @@ packages: /ieee754@1.1.13: resolution: {integrity: sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==} - dev: false /ignore-by-default@1.0.1: resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==} @@ -5827,7 +5748,6 @@ packages: /ip@2.0.0: resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} - dev: false /ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} @@ -6429,6 +6349,7 @@ packages: /memory-pager@1.5.0: resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} requiresBuild: true + optional: true /merge-descriptors@1.0.1: resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} @@ -6577,38 +6498,6 @@ packages: '@mongodb-js/saslprep': 1.1.0 transitivePeerDependencies: - aws-crt - dev: false - - /mongodb@6.2.0: - resolution: {integrity: sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==} - engines: {node: '>=16.20.1'} - peerDependencies: - '@aws-sdk/credential-providers': ^3.188.0 - '@mongodb-js/zstd': ^1.1.0 - gcp-metadata: ^5.2.0 - kerberos: ^2.0.1 - mongodb-client-encryption: '>=6.0.0 <7' - snappy: ^7.2.2 - socks: ^2.7.1 - peerDependenciesMeta: - '@aws-sdk/credential-providers': - optional: true - '@mongodb-js/zstd': - optional: true - gcp-metadata: - optional: true - kerberos: - optional: true - mongodb-client-encryption: - optional: true - snappy: - optional: true - socks: - optional: true - dependencies: - '@mongodb-js/saslprep': 1.1.0 - bson: 6.2.0 - mongodb-connection-string-url: 2.6.0 /mongoose@6.12.0: resolution: {integrity: sha512-sd/q83C6TBRPBrrD2A/POSbA/exbCFM2WOuY7Lf2JuIJFlHFG39zYSDTTAEiYlzIfahNOLmXPxBGFxdAch41Mw==} @@ -7822,7 +7711,6 @@ packages: /smart-buffer@4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} - dev: false /socket.io-adapter@2.5.2: resolution: {integrity: sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==} @@ -7866,7 +7754,6 @@ packages: dependencies: ip: 2.0.0 smart-buffer: 4.2.0 - dev: false /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} @@ -7895,6 +7782,7 @@ packages: requiresBuild: true dependencies: memory-pager: 1.5.0 + optional: true /stack-trace@0.0.10: resolution: {integrity: sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==} @@ -7946,7 +7834,6 @@ packages: /strnum@1.0.5: resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} requiresBuild: true - dev: false optional: true /stubs@3.0.0: @@ -8175,16 +8062,10 @@ packages: /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} requiresBuild: true - dev: false optional: true - /tslib@2.6.1: - resolution: {integrity: sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==} - dev: false - /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: false /type-check@0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} @@ -8359,7 +8240,6 @@ packages: /uuid@8.3.2: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true - dev: false /uuid@9.0.0: resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} diff --git a/sampleGenerator b/sampleGenerator deleted file mode 160000 index bd4329c1..00000000 --- a/sampleGenerator +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bd4329c15405a09c94e7b78e19ff296b4c2d0fb3 diff --git a/src/modules/stores/mongo.js b/src/modules/stores/mongo.js index f05f266a..695845fc 100755 --- a/src/modules/stores/mongo.js +++ b/src/modules/stores/mongo.js @@ -1,7 +1,6 @@ const mongoose = require("mongoose"); const Schema = mongoose.Schema; -const { mongo: mongoUrl } = require("../../../loadenv"); const logger = require("../logger"); const userSchema = Schema({ @@ -184,23 +183,27 @@ database.on("error", function (err) { logger.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ ์—๋Ÿฌ ๋ฐœ์ƒ: " + err); mongoose.disconnect(); }); -database.on("disconnected", function () { - // ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง€๋ฉด 5์ดˆ ํ›„ ์žฌ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค. - logger.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); - setTimeout(() => { - mongoose.connect(mongoUrl, { - useNewUrlParser: true, - useUnifiedTopology: true, - }); - }, 5000); -}); -const connectDatabase = () => +const connectDatabase = (mongoUrl) => { + database.on("disconnected", function () { + // ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง€๋ฉด 5์ดˆ ํ›„ ์žฌ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค. + logger.error("๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์—ฐ๊ฒฐ์ด ๋Š์–ด์กŒ์Šต๋‹ˆ๋‹ค!"); + setTimeout(() => { + mongoose.connect(mongoUrl, { + useNewUrlParser: true, + useUnifiedTopology: true, + }); + }, 5000); + }); + mongoose.connect(mongoUrl, { useNewUrlParser: true, useUnifiedTopology: true, }); + return database; +}; + module.exports = { connectDatabase, userModel: mongoose.model("User", userSchema), diff --git a/src/routes/docs/chats.js b/src/routes/docs/chats.js new file mode 100644 index 00000000..97fc1352 --- /dev/null +++ b/src/routes/docs/chats.js @@ -0,0 +1,513 @@ +const { objectIdPattern } = require("./utils"); + +const tag = "chats"; +const apiPrefix = "/chats"; + +const chatsDocs = {}; +chatsDocs[`${apiPrefix}`] = { + post: { + tags: [tag], + summary: "๊ฐ€์žฅ ์ตœ๊ทผ ์ฑ„ํŒ… ๊ฐ€์ ธ์˜ค๊ธฐ", + description: "๊ฐ€์žฅ ์ตœ๊ทผ์— ๋„์ฐฉํ•œ 60๊ฐœ์˜ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { value: "Chat/ : socket did not connected" }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: "Chat/ : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/ : internal server error", + }, + }, + }, + }, + }, +}; + +chatsDocs[`${apiPrefix}/load/before`] = { + post: { + tags: [tag], + summary: "ํŠน์ • ์‹œ์  ์ด์ „์˜ ์ฑ„ํŒ… ๊ฐ€์ ธ์˜ค๊ธฐ", + description: "lastMsgDate ์ด์ „์— ๋„์ฐฉํ•œ 60๊ฐœ์˜ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + lastMsgDate: { + type: "string", + format: "date-time", + description: "์ด์ „ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ฌ ํŠน์ • ์‹œ์ ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { + value: "Chat/load/before : socket did not connected", + }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: + "Chat/load/before : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/load/before : internal server error", + }, + }, + }, + }, + }, +}; + +chatsDocs[`${apiPrefix}/load/after`] = { + post: { + tags: [tag], + summary: "ํŠน์ • ์‹œ์  ์ดํ›„ ์ฑ„ํŒ… ๊ฐ€์ ธ์˜ค๊ธฐ", + description: "lastMsgDate ์ดํ›„์— ๋„์ฐฉํ•œ 60๊ฐœ์˜ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + lastMsgDate: { + type: "string", + format: "date-time", + description: "์ด์ „ ์ฑ„ํŒ…์„ ๊ฐ€์ ธ์˜ฌ ํŠน์ • ์‹œ์ ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { + value: "Chat/load/after : socket did not connected", + }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: + "Chat/load/after : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/load/after : internal server error", + }, + }, + }, + }, + }, +}; + +chatsDocs[`${apiPrefix}/send`] = { + post: { + tags: [tag], + summary: "์ฑ„ํŒ… ์š”์ฒญ ์ฒ˜๋ฆฌ", + description: `์ฑ„ํŒ… ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ socker ํ†ต์‹ ์„ ํ†ตํ•˜์—ฌ ๊ฐ™์€ ๋ฐฉ์— ์žˆ๋Š” user๋“ค์—๊ฒŒ ์ด ์ฑ„ํŒ…์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.
+
+ ์ฑ„ํŒ… ๊ธฐ๋ก์€ ์•„๋ž˜์™€ ๊ฐ™์ด ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค.
+ + Chat { + roomId: ObjectId, //๋ฐฉ์˜ objectId + type: String, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜ ("text": ์ผ๋ฐ˜ ๋ฉ”์‹œ์ง€, "s3img": S3์— ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€, "in": ์ž…์žฅ ๋ฉ”์‹œ์ง€, "out": ํ‡ด์žฅ ๋ฉ”์‹œ์ง€, "payment": ๊ฒฐ์ œ ๋ฉ”์‹œ์ง€, "settlement": ์ •์‚ฐ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€, "account": ๊ณ„์ขŒ ์ „์†ก ๋ฉ”์‹œ์ง€) + authorId: ObejctId, //์ž‘์„ฑ์ž์˜ objectId + content: String, // ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ (๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜์— ๋”ฐ๋ผ ํฌ๋งท์ด ์ƒ์ดํ•จ) + time: String(ISO 8601), // ex) 2024-01-08T01:52:00.000Z + isValid: Boolean, // ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๊ฐ€ ์œ ํšจํ•œ ์ง€ ์—ฌ๋ถ€. ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ–ˆ์„ ๋•Œ, ํ•ด๋‹น ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ๋๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ์ง€ ์•Š๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋จ. + } + `, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + type: { + type: "string", + enum: [ + "text", + "s3img", + "in", + "out", + "payment", + "settlement", + "account", + "departure", + "arrival", + ], + description: `์ฑ„ํŒ… ๋ฉ”์‹œ์ง€์˜ ์œ ํ˜•
+ ์ผ๋ฐ˜ text์˜ ๊ฒฝ์šฐ *text*, ์‚ฌ์ง„์˜ ๊ฒฝ์šฐ *s3img*
+ ๊ธฐํƒ€ ์ข…๋ฅ˜์˜ ์ฑ„ํŒ…์˜ ๊ฒฝ์šฐ(์ž…์žฅ, ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ๋“ฑ) ์ •ํ•ด์ง„ type์˜ ์ฑ„ํŒ…์„ ์‚ฌ์šฉ`, + }, + content: { + type: "string", + example: "์•ˆ๋…•ํ•˜์„ธ์š”~!", + description: "์ฑ„ํŒ… ๋ฉ”์„ธ์ง€์˜ ๋ณธ๋ฌธ", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์—ฐ๊ฒฐ ์˜ค๋ฅ˜": { + value: "Chat/send : socket did not connected", + }, + "์œ ์ €๊ฐ€ ๋ฐฉ์— ์ฐธ์—ฌํ•˜์ง€ ์•Š์Œ": { + value: "Chat/send : user did not participated in the room", + }, + }, + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/send : internal server error", + }, + }, + }, + }, + }, +}; + +chatsDocs[`${apiPrefix}/read`] = { + post: { + tags: [tag], + summary: "์ฑ„ํŒ… ์ฝ์€ ์‹œ๊ฐ ์—…๋ฐ์ดํŠธ ์š”์ฒญ", + description: `์ฑ„ํŒ… ์ฝ์€ ์‹œ๊ฐ์˜ ์—…๋ฐ์ดํŠธ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ socket ํ†ต์‹ ์„ ํ†ตํ•˜์—ฌ ๊ฐ™์€ ๋ฐฉ์— ์žˆ๋Š” user๋“ค์—๊ฒŒ ์—…๋ฐ์ดํŠธ๋ฅผ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ…์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + example: "Chat/read : socket did not connected", + }, + }, + }, + 404: { + content: { + "text/html": { + example: "Chat/read : cannot find room info", + }, + }, + }, + 500: { + content: { + "text/html": { + examples: { + "์†Œ์ผ“ ์ด๋ฒคํŠธ ์ „์†ก ์˜ค๋ฅ˜": { + value: "Chat/read : failed to emit socket events", + }, + "๊ธฐํƒ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜": { + value: "Chat/read : internal server error", + }, + }, + }, + }, + }, + }, + }, +}; + +chatsDocs[`${apiPrefix}/uploadChatImg/getPUrl`] = { + post: { + tags: [tag], + summary: "์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” Presigned-url์„ ๋ฐœ๊ธ‰", + description: `์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ํ•˜๊ธฐ ์œ„ํ•œ Presigned-url์„ ๋ฐœ๊ธ‰ํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋ฏธ์ง€ ์ „์†ก์„ ์œ„ํ•ด \`s3img\` ํ˜•์‹์˜ chat document๋ฅผ ์ƒ์„ฑ ํ›„ ์ €์žฅํ•˜๋ฉฐ,
+ presigned-url์€ aws S3 api๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + type: { + type: "string", + enum: ["image/png", "image/jpg", "image/jpeg"], + description: "์ฑ„ํŒ… ์ด๋ฏธ์ง€์˜ ํŒŒ์ผ ํ˜•์‹", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + id: { + type: "string", + pattern: objectIdPattern, + description: "์ƒ์„ฑ๋œ chat Document์˜ object id", + }, + url: { + type: "string", + example: "https://s3.{region}.amazonaws.com/{bucket-name}", + description: "taxi s3 url ์ฃผ์†Œ", + }, + fields: { + type: "object", + properties: { + bucket: { + type: "string", + example: "bucket-name", + }, + "Content-Type": { + type: "string", + enum: ["image/png", "image/jpg", "image/jpeg"], + }, + key: { + type: "string", + pattern: `^chat-img/[a-fA-F\d]{24}$`, + }, + }, + description: "image์˜ key, type, bucket์™€ ๊ฐ™์€ ์ •๋ณด", + }, + }, + }, + }, + }, + }, + 403: { + content: { + "text/html": { + example: "Chat/uploadChatImg/getPUrl : did not joined the chatting", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/uploadChatImg/getPUrl : internal server error", + }, + }, + }, + }, + }, +}; + +chatsDocs[`${apiPrefix}/uploadChatImg/done`] = { + post: { + tags: [tag], + summary: "์ฑ„ํŒ… ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์™„๋ฃŒ ์—ฌ๋ถ€ ํ™•์ธ", + description: `์ฑ„ํŒ… ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ ๋˜์—ˆ๋‹ค๋ฉด, socket ํ†ต์‹ ์„ ํ†ตํ•ด ์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋•Œ ์ฑ„ํŒ…์˜ \`content\`์—๋Š” s3์— ์ €์žฅ๋œ url์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ฑ„ํŒ…์˜ object id๋ฅผ ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + description: "์ฑ„ํŒ… ์ด๋ฏธ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ๋ฐฉ์˜ id", + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + result: { + type: "boolean", + value: true, + }, + }, + }, + }, + }, + }, + 404: { + content: { + "text/html": { + example: "Chat/uploadChatImg/done : no corresponding chat", + }, + }, + }, + 500: { + content: { + "text/html": { + example: "Chat/uploadChatImg/getPUrl : internal server error", + }, + }, + }, + }, + }, +}; + +module.exports = chatsDocs; diff --git a/src/routes/docs/chats.md b/src/routes/docs/chats.md deleted file mode 100644 index 307d2def..00000000 --- a/src/routes/docs/chats.md +++ /dev/null @@ -1,99 +0,0 @@ -## `chats`: ์ฑ„ํŒ… ์‹œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ ์ •๋ฆฌ - -Taxi์˜ ์ฑ„ํŒ… ๊ธฐ๋Šฅ์€ Socket.IO ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. -ํด๋ผ์ด์–ธํŠธ์—์„œ์˜ ์ผ๋ฐ˜์ ์ธ Socket.IO ์‚ฌ์šฉ๋ฒ•์€ [๊ณต์‹ ๋ฌธ์„œ](https://socket.io/docs/v4/client-socket-instance/)๋ฅผ ์ฐธ์กฐํ•ด์ฃผ์„ธ์š”. -์•„๋ž˜์™€ ๊ฐ™์€ ์ฑ„ํŒ… ์ด๋ฒคํŠธ๋“ค์ด ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. - -- `chats-join` -- `chats-receive` -- `chats-send` -- `chats-load` -- `chats-disconnected` (์‚ญ์ œํ•ด์•ผ ํ•จ) - -์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ชจ๋“  ์ฑ„ํŒ… ๊ธฐ๋ก์€ ์•„๋ž˜์™€ ๊ฐ™์€ ์ž๋ฃŒํ˜•์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. - -```javascript -Chat { - roomId: ObjectId, //๋ฐฉ์˜ objectId - type: String, // ๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜("text": ์ผ๋ฐ˜ ๋ฉ”์‹œ์ง€, "in": ์ž…์žฅ ๋ฉ”์‹œ์ง€, "out": ํ‡ด์žฅ ๋ฉ”์‹œ์ง€, "s3img": S3์— ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€, "payment": ๊ฒฐ์ œ ๋ฉ”์‹œ์ง€, "settlement": ์ •์‚ฐ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€) - authorId: ObejctId, //์ž‘์„ฑ์ž์˜ objectId - content: String, // ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ(๋ฉ”์‹œ์ง€ ์ข…๋ฅ˜์— ๋”ฐ๋ผ ํฌ๋งท์ด ์ƒ์ดํ•˜๋ฉฐ, ํ•˜๋‹จ ์ฐธ์กฐ) - time: String(ISO 8601), // ex) '2022-01-12T13:58:20.180Z' - isValid: Boolean, // ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ณด๋‚ธ ๋ฉ”์‹œ์ง€๊ฐ€ ์œ ํšจํ•œ ์ง€ ์—ฌ๋ถ€. ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ–ˆ์„ ๋•Œ, ํ•ด๋‹น ์ด๋ฏธ์ง€๊ฐ€ ์ œ๋Œ€๋กœ ์—…๋กœ๋“œ๋๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ์ง€ ์•Š๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋จ. -} -``` - -### 1. `chats-join` - -๋ฐฉ์— ์ƒˆ ์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌํ•  ๋•Œ ์ด ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค์„ธ์š”. -ํ•„์š”ํ•œ ์ธ์ž๋Š” `roomId`์ž…๋‹ˆ๋‹ค. - -- `roomId`: ๋ฐฉ์˜ ObjectID (`String`), Socket.IO ์„œ๋ฒ„์™€ ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•  ๋•Œ ์‚ฌ์šฉ์ž๋Š” ๋กœ๊ทธ์ธ์ด ๋˜์–ด ์žˆ์–ด์•ผ ํ•˜๋ฉฐ, ๋“ค์–ด๊ฐ€๋ ค๋Š” ์ฑ„ํŒ…๋ฐฉ์— ์ฐธ์—ฌ์ž๋กœ ์ฐธ์—ฌํ•˜๊ณ  ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. - -```javascript -const socket = io(server_address, { withCredentials: true }); -socket.emit("chats-join", roomId); -``` - -์ฑ„ํŒ…๋ฐฉ ์ ‘์†์ด ์ •์ƒ์ ์œผ๋กœ ์™„๋ฃŒ๋˜๋ฉด, Socket.io ์„œ๋ฒ„๋Š” ์ตœ๊ทผ 30๊ฐœ์˜ ๋ฉ”์‹œ์ง€๋“ค(`Chat` ๋ฐฐ์—ด)์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-join", (chats) => { - // ์ตœ๊ทผ 30๊ฐœ์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ - console.log(chats); -}); -``` - -### 2. `chats-send` - -์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ผ ๋•Œ ์ด ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค์„ธ์š”. -ํ•„์š”ํ•œ ์ธ์ž๋Š” `roomId`์™€ `content`์ž…๋‹ˆ๋‹ค. - -- `roomId`: ์ฐธ์—ฌ์ค‘์ธ ๋ฐฉ์˜ ObjectID(`String`) -- `content`: ๋ณด๋‚ผ ํ…์ŠคํŠธ(`String`) - -```javascript -socket.emit("chats-send", { roomId, content }); -``` - -๋ฉ”์‹œ์ง€ ์ „์†ก์ด ์„ฑ๊ณต/์‹คํŒจํ•˜๋ฉด, Socket.IO ์„œ๋ฒ„๋„ `chats-send` ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-send", (response) => { - // ์ตœ๊ทผ 30๊ฐœ์˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ - console.log(response); -}); -``` - -`response`๋Š” ์ „์†ก์ด ์„ฑ๊ณตํ–ˆ์„ ๊ฒฝ์šฐ `{done: true}`, ์‹คํŒจํ–ˆ์„ ๊ฒฝ์šฐ `{err: true}`์ž…๋‹ˆ๋‹ค. - -### 3. `chats-receive` - -์ด ์ด๋ฒคํŠธ๋Š” ์„œ๋ฒ„๋‚˜ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๊ฐ€ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ–ˆ์„ ๋•Œ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์ด `chat`์— ์ ‘๊ทผํ•˜์—ฌ ํ•ด๋‹น ๋ฉ”์‹œ์ง€์˜ ๋‚ด์šฉ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-receive", (chat) => { - // ์ƒˆ๋กœ์šด ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ - console.log(chat); -}); -``` - -### 4. `chats-load` - -๊ณผ๊ฑฐ ๋Œ€ํ™” ๋ชฉ๋ก์„ ๋” ๋ถˆ๋Ÿฌ์˜ค๋ ค๋ฉด ์ด ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค์„ธ์š”. ํ•„์š”ํ•œ ์ธ์ž๋Š” `lastDate`์™€ `amount`(์„ ํƒ ์‚ฌํ•ญ) ์ž…๋‹ˆ๋‹ค. - -- `lastDate`: ํ˜„์žฌ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋ถˆ๋Ÿฌ์˜จ ์ฑ„ํŒ…๋“ค ์ค‘ ๊ฐ€์žฅ ์˜ค๋ž˜๋œ ๊ฒƒ์˜ ์ƒ์„ฑ ์‹œ๊ฐ. ์„œ๋ฒ„๋Š” ์ด๋ณด๋‹ค ๋จผ์ € ์ƒ์„ฑ๋œ ๋ฉ”์‹œ์ง€๋“ค์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ISO8601์„ ๋งŒ์กฑํ•˜๋Š” `String`์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. e.g.) `"2022-03-15T13:57:04.732Z"` -- `amount` (์„ ํƒ ์‚ฌํ•ญ): ๋ถˆ๋Ÿฌ์˜ฌ ๊ณผ๊ฑฐ ๋ฉ”์‹œ์ง€์˜ ์ˆ˜. 1~50์˜ ์ž์—ฐ์ˆ˜์—ฌ์•ผ ํ•˜๋ฉฐ, ์ž…๋ ฅํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ 30๊ฐœ์˜ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. - -```javascript -socket.emit("chats-load", { lastDate: "2022-03-15T13:57:04.732Z", amount: 30 }); -``` - -`chats-load` ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์„œ๋ฒ„๋Š” ํด๋ผ์ด์–ธํŠธ์— ๋‹ค์‹œ `chats-load` ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œ์ผœ ๊ณผ๊ฑฐ ์ฑ„ํŒ…๋“ค(`Chat` ๋ฐฐ์—ด)์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค. - -```javascript -socket.on("chats-load", (chats) => { - // ๊ณผ๊ฑฐ ๋ฉ”์‹œ์ง€๋“ค ์ถœ๋ ฅ - console.log(chats); -}); -``` diff --git a/src/routes/docs/locations.js b/src/routes/docs/locations.js index 1fb445b9..34773482 100644 --- a/src/routes/docs/locations.js +++ b/src/routes/docs/locations.js @@ -6,8 +6,8 @@ locationsDocs[`${apiPrefix}`] = { get: { tags: [tag], summary: "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€ ์ •๋ณด ๋ฐ˜ํ™˜", - description: - "์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
\n (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)", + description: `์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์†Œ ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ์š”์ฒญ ์ฒ˜๋ฆฌ ๋‹น์‹œ ์„œ๋ฒ„ ์‹œ๊ฐ ๋ฐ˜ํ™˜
+ (๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ)`, responses: { 200: { description: "์„œ๋ฒ„์— ์ €์žฅ๋œ location์ด ์—†์„ ๊ฒฝ์šฐ, locations์€ ๋นˆ ๋ฐฐ์—ด", diff --git a/src/routes/docs/logininfo.js b/src/routes/docs/logininfo.js index e752d3b0..59b5e0a8 100644 --- a/src/routes/docs/logininfo.js +++ b/src/routes/docs/logininfo.js @@ -1,3 +1,5 @@ +const { objectIdPattern } = require("./utils"); + const tag = "logininfo"; const apiPrefix = "/logininfo"; @@ -18,6 +20,7 @@ logininfoDocs[`${apiPrefix}`] = { properties: { oid: { type: "string", + type: objectIdPattern, }, id: { type: "string", diff --git a/src/routes/docs/reports.js b/src/routes/docs/reports.js index 0f5b8e76..b3976e7b 100644 --- a/src/routes/docs/reports.js +++ b/src/routes/docs/reports.js @@ -1,3 +1,5 @@ +const { objectIdPattern } = require("./utils"); + const tag = "reports"; const apiPrefix = "/reports"; @@ -57,9 +59,17 @@ reportsDocs[`${apiPrefix}/searchByUser`] = { properties: { reporting: { type: "array", + items: { + type: "string", + pattern: objectIdPattern, + }, }, reported: { type: "array", + items: { + type: "string", + pattern: objectIdPattern, + }, }, }, }, diff --git a/src/routes/docs/reportsSchema.js b/src/routes/docs/reportsSchema.js index 841918cf..654e1178 100644 --- a/src/routes/docs/reportsSchema.js +++ b/src/routes/docs/reportsSchema.js @@ -1,3 +1,5 @@ +const { objectIdPattern } = require("./utils"); + const reportsSchema = { createHandler: { type: "object", @@ -5,7 +7,7 @@ const reportsSchema = { properties: { reportedId: { type: "string", - pattern: "^[a-fA-F\\d]{24}$", + pattern: objectIdPattern, }, type: { type: "string", diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index 35231aaa..a6dab17a 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -6,6 +6,7 @@ const locationsDocs = require("./locations"); const authDocs = require("./auth"); const usersDocs = require("./users"); const roomsDocs = require("./rooms"); +const chatsDocs = require("./chats"); const { port, nodeEnv } = require("../../../loadenv"); const serverList = [ @@ -62,6 +63,10 @@ const swaggerDocs = { name: "rooms", description: "๋ฐฉ ์ƒ์„ฑ/์ˆ˜์ •/์‚ญ์ œ/์กฐํšŒ ๋ฐ ๊ด€๋ฆฌ ์ง€์›", }, + { + name: "chats", + description: "์ฑ„ํŒ… ์‹œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ ์ •๋ฆฌ", + }, ], consumes: ["application/json"], produces: ["application/json"], @@ -71,6 +76,7 @@ const swaggerDocs = { ...locationsDocs, ...usersDocs, ...authDocs, + ...chatsDocs, ...roomsDocs, }, components: { diff --git a/src/routes/docs/users.js b/src/routes/docs/users.js index 193eb702..3cd8aa96 100644 --- a/src/routes/docs/users.js +++ b/src/routes/docs/users.js @@ -82,6 +82,7 @@ usersDocs[`${apiPrefix}/editNickname`] = { properties: { nickname: { type: "string", + example: "๋ˆ์งˆ๊ธด ์—ด๊ณผ ๋ถ„์ž์˜ ์ด๋™", description: "์œ ์ €์˜ ์ƒˆ ๋‹‰๋„ค์ž„", }, }, diff --git a/src/sampleGenerator/.gitignore b/src/sampleGenerator/.gitignore new file mode 100644 index 00000000..2909449b --- /dev/null +++ b/src/sampleGenerator/.gitignore @@ -0,0 +1,107 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# MongoDB Dump +dump/ diff --git a/src/sampleGenerator/README.md b/src/sampleGenerator/README.md new file mode 100644 index 00000000..5afd5960 --- /dev/null +++ b/src/sampleGenerator/README.md @@ -0,0 +1,28 @@ +# taxiSampleGenerator + +์ด node ํ”„๋กœ๊ทธ๋žจ์€ SPARCS-Taxi ํ”„๋กœ์ ํŠธ๋ฅผ ์œ„ํ•œ ์ƒ˜ํ”Œ ์‚ฌ์šฉ์ž, ๋ฐฉ, ์ฑ„ํŒ… ๋ชฉ๋ก์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. +ํ˜„์žฌ ์ด ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ์ƒ์„ฑ๋œ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋Š” ์ž…, ํ‡ด์žฅ ๋ฉ”์‹œ์ง€๋“ค๊ณผ ์ผ๋ฐ˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋“ค๋กœ๋งŒ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. + +**WARNING** +์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰ ์‹œ ๊ธฐ์กด์— MongoDB์— ์ €์žฅ๋œ ์‚ฌ์šฉ์ž, ๋ฐฉ, ์ฑ„ํŒ… ์ •๋ณด๋Š” **์‚ญ์ œ**๋ฉ๋‹ˆ๋‹ค! + +**SETUP** + +1. *(optional)* Root directory์˜ `.env.test` ํŒŒ์ผ์— ๋‹ค์Œ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. + ``` + #๋ฐฉ๊ณผ ๊ฐ๊ฐ์˜ ๋ฐฉ์˜ ์ฑ„ํŒ… ๊ฐœ์ˆ˜ + SAMPLE_NUM_OF_ROOMS=2 + SAMPLE_NUM_OF_CHATS=200 + #์ฑ„ํŒ… ๊ฐ„ ์ตœ๋Œ€ ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(๋‹จ์œ„: ์ดˆ, ์†Œ์ˆ˜๋„ ๊ฐ€๋Šฅ) + SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS=20 + #์ƒˆ๋กœ์šด ์ฑ„ํŒ…์ด ๊ฐ๊ฐ ์ž…/ํ‡ด์žฅ ๋ฉ”์‹œ์ง€์ผ ํ™•๋ฅ (๊ฐ๊ฐ 10%) + SAMPLE_OCCURENCE_OF_JOIN=0.1 + SAMPLE_OCCURENCE_OF_ABORT=0.1 + ``` +1. sampleData.json์— ์žฅ์†Œ, ์œ ์ €, ๋ฐฉ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. + javascript `User { "id": "sampleId", ์‚ฌ์šฉ์ž id }` + +1. `pnpm start`๋กœ ์ƒ˜ํ”Œ ์ฑ„ํŒ… ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. + +1. `pnpm run dumpDB`์œผ๋กœ ํ˜„์žฌ DB๋ฅผ ๋คํ”„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +1. `pnpm run restoreDB`๋กœ ๊ณผ๊ฑฐ DB๋ฅผ ๋คํ”„ ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ๋ณต์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. diff --git a/src/sampleGenerator/index.js b/src/sampleGenerator/index.js new file mode 100644 index 00000000..e83a9335 --- /dev/null +++ b/src/sampleGenerator/index.js @@ -0,0 +1,47 @@ +const { + generateUser, + generateRoom, + generateSampleLocations, + generateChats, +} = require("./src/testData"); +const { connectDatabase } = require("../modules/stores/mongo"); +const { mongo: mongoUrl, numberOfChats, numberOfRooms } = require("./loadenv"); + +const database = connectDatabase(mongoUrl); + +const fs = require("fs"); +const sampleData = JSON.parse(fs.readFileSync("./sampleData.json")); + +const main = async () => { + await database.db.dropDatabase(); + + const { users, locations } = sampleData; + + const userOids = []; + const roomOids = []; + + for (const [index, user] of users.entries()) { + const userOid = await generateUser(user.id, index + 1, user.isAdmin); + userOids.push(userOid); + } + + const sampleLocationOids = await generateSampleLocations(locations); + + for (const index of Array(numberOfRooms).keys()) { + const roomOid = await generateRoom( + sampleLocationOids, + index + 1, + 7, + userOids[0] + ); //ํ•˜๋“œ์ฝ”๋”ฉ: ์ผ์ฃผ์ผ ๋’ค์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ(๋“ค)์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. + roomOids.push(roomOid); + } + + for (const roomOid of roomOids) { + await generateChats(roomOid, userOids, numberOfChats); + } + console.log("๋! ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์„ ์ค‘๋‹จํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค."); + process.exit(0); +}; + +database.on("open", main); diff --git a/src/sampleGenerator/loadenv.js b/src/sampleGenerator/loadenv.js new file mode 100644 index 00000000..0843789b --- /dev/null +++ b/src/sampleGenerator/loadenv.js @@ -0,0 +1,13 @@ +// Root directory์— ์žˆ๋Š” .env.test ํŒŒ์ผ์„ ์ฝ์–ด์˜ด +require("dotenv").config({ path: "../../.env.test" }); + +module.exports = { + mongo: process.env.DB_PATH, // required + numberOfRooms: parseInt(process.env.SAMPLE_NUM_OF_ROOMS ?? 2), // optional + numberOfChats: parseInt(process.env.SAMPLE_NUM_OF_CHATS ?? 200), // optional + maximumIntervalBtwChats: parseFloat( + process.env.SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS ?? 20 + ), // optional + occurenceOfJoin: parseFloat(process.env.SAMPLE_OCCURENCE_OF_JOIN ?? 0.1), // optional + occurenceOfAbort: parseFloat(process.env.SAMPLE_OCCURENCE_OF_ABORT ?? 0.1), // optional +}; diff --git a/src/sampleGenerator/package.json b/src/sampleGenerator/package.json new file mode 100644 index 00000000..3c7473bc --- /dev/null +++ b/src/sampleGenerator/package.json @@ -0,0 +1,17 @@ +{ + "name": "taxisamplegenerator", + "version": "1.0.0", + "description": "sample generator", + "main": "index.js", + "scripts": { + "preinstall": "npx only-allow pnpm", + "start": "node index.js", + "test": "echo \"Error: no test specified\" && exit 1", + "dumpDB": "node tools/dump.js", + "restoreDB": "node tools/restore.js" + }, + "keywords": [ + "test" + ], + "license": "ISC" +} diff --git a/src/sampleGenerator/sampleData.json b/src/sampleGenerator/sampleData.json new file mode 100644 index 00000000..546812cd --- /dev/null +++ b/src/sampleGenerator/sampleData.json @@ -0,0 +1,112 @@ +{ + "users": [ + { + "id": "sunday", + "isAdmin": true + }, + { + "id": "monday", + "isAdmin": true + }, + { + "id": "tuesday", + "isAdmin": true + }, + { + "id": "wednesday", + "isAdmin": true + } + ], + "locations": [ + { + "koName": "ํƒ์‹œ์Šน๊ฐ•์žฅ", + "enName": "Taxi Stand", + "longitude": 127.359507, + "latitude": 36.373199 + }, + { + "koName": "๋Œ€์ „์—ญ", + "enName": "Daejeon Station", + "longitude": 127.434522, + "latitude": 36.331894 + }, + { + "koName": "๊ฐค๋Ÿฌ๋ฆฌ์•„ ํƒ€์ž„์›”๋“œ", + "enName": "Galleria Timeworld", + "longitude": 127.378188, + "latitude": 36.351938 + }, + { + "koName": "๊ถ๋™ ๋กœ๋ฐ์˜ค๊ฑฐ๋ฆฌ", + "enName": "Gung-dong Rodeo Street", + "longitude": 127.350161, + "latitude": 36.362785 + }, + { + "koName": "๋Œ€์ „๋ณตํ•ฉํ„ฐ๋ฏธ๋„", + "enName": "Daejeon Terminal Complex", + "longitude": 127.350161, + "latitude": 36.362785 + }, + { + "koName": "๋งŒ๋…„์ค‘ํ•™๊ต", + "enName": "Mannyon Middle School", + "longitude": 127.375993, + "latitude": 36.366990 + }, + { + "koName": "์„œ๋Œ€์ „์—ญ", + "enName": "Seodaejeon Station", + "longitude": 127.403933, + "latitude": 36.322517 + }, + { + "koName": "์‹ ์„ธ๊ณ„๋ฐฑํ™”์ ", + "enName": "Shinsegae Department Store", + "longitude": 127.381905, + "latitude": 36.375168 + }, + { + "koName": "์˜ค๋ฆฌ์—ฐ๋ชป", + "enName": "Duck Pond", + "longitude": 127.362371, + "latitude": 36.367715 + }, + { + "koName": "์›”ํ‰์—ญ", + "enName": "Wolpyeong Station", + "longitude": 127.364352, + "latitude": 36.358271 + }, + { + "koName": "์œ ์„ฑ๊ตฌ์ฒญ", + "enName": "Yuseong-gu Office", + "longitude": 127.356384, + "latitude": 36.362084 + }, + { + "koName": "์œ ์„ฑ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Yuseong Express Bus Terminal", + "longitude": 127.336467, + "latitude": 36.358279 + }, + { + "koName": "์œ ์„ฑ ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Yuseong Intercity Bus Terminal", + "longitude": 127.335971, + "latitude": 36.355604 + }, + { + "koName": "๋Œ€์ „์ฒญ์‚ฌ ๊ณ ์†๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Government Complex Express Bus Terminal", + "longitude": 127.390504, + "latitude": 36.361462 + }, + { + "koName": "๋Œ€์ „์ฒญ์‚ฌ ์‹œ์™ธ๋ฒ„์Šคํ„ฐ๋ฏธ๋„", + "enName": "Government Complex Intercity Bus Terminal", + "longitude": 127.379759, + "latitude": 36.361512 + } + ] +} diff --git a/src/sampleGenerator/src/testData.js b/src/sampleGenerator/src/testData.js new file mode 100644 index 00000000..1209c52a --- /dev/null +++ b/src/sampleGenerator/src/testData.js @@ -0,0 +1,199 @@ +const { + userModel, + roomModel, + locationModel, + chatModel, +} = require("../../modules/stores/mongo"); +const { generateProfileImageUrl } = require("../../modules/modifyProfile"); + +const { + maximumIntervalBtwChats, + occurenceOfJoin, + occurenceOfAbort, +} = require("../loadenv"); + +const generateUser = async (id, num, isAdmin) => { + const newUser = new userModel({ + id: id, + name: `${id}-name`, + nickname: `${id}-nickname`, + profileImageUrl: generateProfileImageUrl(), + joinat: Date.now(), + subinfo: { + kaist: new String(20230000 + num), // ^-^ + sparcs: "", + facebook: "", + twitter: "", + }, + email: `${id}@kaist.ac.kr`, + isAdmin: isAdmin, + }); + await newUser.save(); + return newUser._id; +}; + +const generateSampleLocations = async (locations) => { + if (locations.length === 0) { + console.log("Please provide location(s)!"); + } + + for (const location of locations) { + const locationDocument = new locationModel({ + koName: location.koName, + enName: location.enName, + longitude: location.longitude, + latitude: location.latitude, + }); + await locationDocument.save(); + } + + const locationDocuments = await locationModel.find().lean(); + return locationDocuments.map((locationDocument) => locationDocument._id); +}; + +const generateRoom = async (sampleLocationOids, num, daysAfter, creatorId) => { + const date = new Date(); + date.setDate(date.getDate() + daysAfter); + + let fromIdx = 0; + let toIdx = 0; + + while (fromIdx === toIdx) { + fromIdx = Math.floor(Math.random() * sampleLocationOids.length); + toIdx = Math.floor(Math.random() * sampleLocationOids.length); + } + + const newRoom = new roomModel({ + name: `test-${num}`, + from: sampleLocationOids[fromIdx], + to: sampleLocationOids[toIdx], + time: date, + part: [{ user: creatorId }], + madeat: Date.now(), + maxPartLength: 4, + }); + await newRoom.save(); + return newRoom._id; +}; + +const joinUserToRoom = async (userIdsInRoom, userIdsOutRoom, roomId) => { + // ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ + const authorIdx = Math.floor(Math.random() * userIdsOutRoom.length); + const userOid = userIdsOutRoom[authorIdx]; + + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + userIdsInRoom.push(userOid); + userIdsOutRoom.splice(authorIdx, 1); + const user = await userModel.findById(userOid, "ongoingRoom"); + user.ongoingRoom.push(roomId); + await user.save(); + + return { userIdsInRoom, userIdsOutRoom, userOid }; +}; + +const abortUserfromRoom = async (userIdsInRoom, userIdsOutRoom, roomId) => { + // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ ํƒ + const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); + const userOid = userIdsInRoom[authorIdx]; + + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + userIdsOutRoom.push(userOid); + userIdsInRoom.splice(authorIdx, 1); + const user = await userModel.findById(userOid, "ongoingRoom"); + user.ongoingRoom.splice(user.ongoingRoom.indexOf(roomId), 1); + await user.save(); + + return { userIdsInRoom, userIdsOutRoom, userOid }; +}; + +const generateNormalChat = async (i, roomId, userOid, time) => { + const user = await userModel.findById(userOid); + const newChat = new chatModel({ + roomId: roomId, + type: "text", + authorId: user._id, + content: `์•ˆ๋…•ํ•˜์„ธ์š”! (${i}๋ฒˆ์งธ ๋ฉ”์‹œ์ง€)`, + time: time, + inValid: false, + }); + await newChat.save(); +}; + +const generateJoinAbortChat = async (roomId, userOid, isJoining, time) => { + const user = await userModel.findById(userOid); + const newChat = new chatModel({ + roomId: roomId, + type: isJoining ? "in" : "out", + authorId: user._id, + content: user.id, + time: time, + isValid: false, + }); + await newChat.save(); +}; + +const generateChats = async (roomId, userOids, numOfChats) => { + const roomPopulateQuery = [{ path: "part", select: "id name nickname -_id" }]; + const room = await roomModel.findById(roomId).populate(roomPopulateQuery); + + let userIdsInRoom = []; + let userIdsOutRoom = userOids.map((userOid) => userOid); + let lastTime = Date.now(); + const maximumIntervalBtwChatsMilliseconds = 1000 * maximumIntervalBtwChats; + + for (const i of Array(numOfChats).keys()) { + lastTime += Math.floor(Math.random() * maximumIntervalBtwChatsMilliseconds); + const event = Math.random(); + + if ( + userIdsInRoom.length === 0 || + (event < occurenceOfJoin && userIdsOutRoom.length !== 0) + ) { + // ๋” ๋“ค์–ด์˜ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋” ๋“ค์–ด์˜ด + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + let userOid; + ({ userIdsInRoom, userIdsOutRoom, userOid } = await joinUserToRoom( + userIdsInRoom, + userIdsOutRoom, + roomId + )); + // ์ž…์žฅ ๋ฉ”์‹œ์ง€ ์ƒ์„ฑ + await generateJoinAbortChat(roomId, userOid, true, lastTime); + } else if ( + occurenceOfJoin <= event && + event < occurenceOfJoin + occurenceOfAbort && + userIdsInRoom.length > 1 + ) { + // ๋‚˜๊ฐˆ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ๋‚˜๊ฐ + // ๋ฐฉ, ์œ ์ € ์ƒํƒœ ๊ฐฑ์‹  + let userOid; + ({ userIdsInRoom, userIdsOutRoom, userOid } = await abortUserfromRoom( + userIdsInRoom, + userIdsOutRoom, + roomId + )); + // ํ‡ด์žฅ ๋ฉ”์‹œ์ง€ ์ƒ์„ฑ + await generateJoinAbortChat(roomId, userOid, false, lastTime); + } else { + // ๋ฐฉ์ด ๋น„์–ด์žˆ์ง€ ์•Š์„ ๊ฒฝ์šฐ, ์ผ๋ฐ˜ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ฆ + if (userIdsInRoom.length !== 0) { + const authorIdx = Math.floor(Math.random() * userIdsInRoom.length); + const user = userIdsInRoom[authorIdx]; + await generateNormalChat(i, roomId, user, lastTime); + } + } + } + // ํ˜„์žฌ ์ฐธ์—ฌ์ค‘์ธ ์‚ฌ์šฉ์ž ๊ธฐ์ค€์œผ๋กœ ๋ฐฉ์˜ part ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•จ + room.part = userIdsInRoom.map((userOid) => { + return { user: userOid }; + }); + await room.save(); + return; +}; + +module.exports = { + generateUser, + generateRoom, + generateSampleLocations, + generateChats, +}; diff --git a/src/sampleGenerator/tools/dump.js b/src/sampleGenerator/tools/dump.js new file mode 100644 index 00000000..7d26d802 --- /dev/null +++ b/src/sampleGenerator/tools/dump.js @@ -0,0 +1,20 @@ +const util = require("util"); +const path = require("path"); +const exec = util.promisify(require("child_process").exec); +const { mongo: mongoUrl } = require("../loadenv"); + +const main = async () => { + const { stdout, stderr } = await exec( + `mongodump ${mongoUrl} --out ${path.resolve("dump")}` + ); + console.log("dump ๋””๋ ‰ํ† ๋ฆฌ์— ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ๋คํ”„ํ–ˆ์Šต๋‹ˆ๋‹ค."); + process.exit(0); +}; + +try { + main(); +} catch { + console.log( + "DB ์—ฐ๊ฒฐ ์ฃผ์†Œ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. DB ์—ฐ๊ฒฐ ์ฃผ์†Œ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”." + ); +} diff --git a/src/sampleGenerator/tools/restore.js b/src/sampleGenerator/tools/restore.js new file mode 100644 index 00000000..5c14c98b --- /dev/null +++ b/src/sampleGenerator/tools/restore.js @@ -0,0 +1,23 @@ +const util = require("util"); +const path = require("path"); +const exec = util.promisify(require("child_process").exec); +const { mongo: mongoUrl } = require("../loadenv"); + +const main = async () => { + const dbName = mongoUrl.split("/").pop(); + const { stdout, stderr } = await exec( + `mongorestore ${mongoUrl} ${path.resolve("dump", dbName)}` + ); + console.log( + "dump ๋””๋ ‰ํ† ๋ฆฌ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ๋ณต์›ํ–ˆ์Šต๋‹ˆ๋‹ค." + ); + process.exit(0); +}; + +try { + main(); +} catch { + console.log( + "DB๋ฅผ ๋คํ”„ํ•ด์˜ฌ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”." + ); +} diff --git a/src/services/chats.js b/src/services/chats.js index abcbd073..ca74d774 100644 --- a/src/services/chats.js +++ b/src/services/chats.js @@ -273,7 +273,7 @@ const uploadChatImgDoneHandler = async (req, res) => { if (!user) { return res .status(500) - .send("Chat/uploadChatImg/getPUrl : internal server error"); + .send("Chat/uploadChatImg/done : internal server error"); } if (!chat) { return res.status(404).json({ @@ -294,7 +294,7 @@ const uploadChatImgDoneHandler = async (req, res) => { if (err) { return res .status(500) - .send("Chat/uploadChatImg/getPUrl : internal server error"); + .send("Chat/uploadChatImg/done : internal server error"); } chat.content = chat._id; diff --git a/test/utils.js b/test/utils.js index b3920e83..e537913b 100644 --- a/test/utils.js +++ b/test/utils.js @@ -7,8 +7,9 @@ const { connectDatabase, } = require("../src/modules/stores/mongo"); const { generateProfileImageUrl } = require("../src/modules/modifyProfile"); +const { mongo: mongoUrl } = require("../loadenv"); -connectDatabase(); +connectDatabase(mongoUrl); // ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ์œ ์ € ์ƒ์„ฑ ํ•จ์ˆ˜ const userGenerator = async (username, testData) => { From 2ebc0f82d0c17fe50ec99d0dcf587ce85e8a9777 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 28 Jan 2024 16:02:55 +0000 Subject: [PATCH 102/108] Fix: send message prefix --- src/services/rooms.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/services/rooms.js b/src/services/rooms.js index d4b7557e..a2562c67 100644 --- a/src/services/rooms.js +++ b/src/services/rooms.js @@ -110,13 +110,13 @@ const publicInfoHandler = async (req, res) => { res.send(formatSettlement(roomObject, { includeSettlement: false })); } else { res.status(404).json({ - error: "Rooms/info : id does not exist", + error: "Rooms/publicInfo : id does not exist", }); } } catch (err) { logger.error(err); res.status(500).json({ - error: "Rooms/info : internal server error", + error: "Rooms/publicInfo : internal server error", }); } }; @@ -153,7 +153,7 @@ const joinHandler = async (req, res) => { // ์‚ฌ์šฉ์ž์˜ ์ฐธ์—ฌ์ค‘์ธ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ์ด 5๊ฐœ ์ด์ƒ์ด๋ฉด ์˜ค๋ฅ˜๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. if (user.ongoingRoom.length >= 5) { return res.status(400).json({ - error: "Rooms/create : participating in too many rooms", + error: "Rooms/join : participating in too many rooms", }); } @@ -244,7 +244,7 @@ const abortHandler = async (req, res) => { .indexOf(user._id.toString()); if (roomPartIndex === -1) { return res.status(403).json({ - error: "Rooms/info : did not joined the room", + error: "Rooms/abort : did not joined the room", }); } @@ -254,7 +254,7 @@ const abortHandler = async (req, res) => { // ๋ฐฉ์˜ ์ถœ๋ฐœ์‹œ๊ฐ„์ด ์ง€๋‚˜๊ณ  ์ •์‚ฐ์ด ๋˜์ง€ ์•Š์œผ๋ฉด ๋‚˜๊ฐˆ ์ˆ˜ ์—†์Œ if (isOvertime(room, req.timestamp) && userOngoingRoomIndex !== -1) { return res.status(400).json({ - error: "Rooms/info : cannot exit room. Settlement is not done", + error: "Rooms/abort : cannot exit room. Settlement is not done", }); } @@ -377,7 +377,6 @@ const searchHandler = async (req, res) => { .limit(1000) .populate(roomPopulateOption) .lean(); - res.json( rooms.map((room) => formatSettlement(room, { includeSettlement: false })) ); From 6cdd54ec7c4ef4128fd5447ff7b3c82f2311acee Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Sun, 28 Jan 2024 16:03:06 +0000 Subject: [PATCH 103/108] Docs: rooms.js --- src/routes/docs/rooms.js | 432 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 410 insertions(+), 22 deletions(-) diff --git a/src/routes/docs/rooms.js b/src/routes/docs/rooms.js index 56dcda9d..b2f24f72 100644 --- a/src/routes/docs/rooms.js +++ b/src/routes/docs/rooms.js @@ -1,3 +1,4 @@ +const { roomsSchema } = require("./roomsSchema"); const { objectIdPattern, roomsPattern } = require("./utils"); const tag = "rooms"; @@ -99,8 +100,18 @@ roomsDocs[`${apiPrefix}/create`] = { 500: { description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", content: { - "text/html": { - example: "Rooms/create : internal server error", + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/create : internal server error", + }, }, }, }, @@ -139,16 +150,36 @@ roomsDocs[`${apiPrefix}/publicInfo`] = { 404: { description: "ํ•ด๋‹น id๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ", content: { - "text/html": { - example: "Rooms/publicInfo : id does not exist", + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/publicInfo : id does not exist", + }, }, }, }, 500: { description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", content: { - "text/html": { - example: "Rooms/publicInfo : internal server error", + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/publicInfo : internal server error", + }, }, }, }, @@ -186,16 +217,36 @@ roomsDocs[`${apiPrefix}/info`] = { 404: { description: "ํ•ด๋‹น id๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ", content: { - "text/html": { - example: "Rooms/info : id does not exist", + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/info : id does not exist", + }, }, }, }, 500: { description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", content: { - "text/html": { - example: "Rooms/info : internal server error", + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/info : internal server error", + }, }, }, }, @@ -206,30 +257,367 @@ roomsDocs[`${apiPrefix}/info`] = { roomsDocs[`${apiPrefix}/join`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ง„ํ–‰ ์ค‘์ธ ๋ฐฉ์— ์ฐธ์—ฌ", + description: `room์˜ ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น room์˜ ์ฐธ๊ฐ€์ž ๋ชฉ๋ก์— ์š”์ฒญ์„ ๋ณด๋‚ธ ์‚ฌ์šฉ์ž๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
+ ํ•˜๋‚˜์˜ User๋Š” ์ตœ๋Œ€ 5๊ฐœ์˜ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ์— ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
+ ์•„์ง ์ •์›์ด ์ฐจ์ง€ ์•Š์€ ๋ฐฉ๊ณผ ์•„์ง ์ถœ๋ฐœํ•˜์ง€ ์•Š์€ ๋ฐฉ์—๋งŒ ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: "๋ฐฉ์˜ ์„ธ๋ถ€ ์ •๋ณด๊ฐ€ ๋‹ด๊ธด room Object", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 400: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + examples: { + "์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌํ•˜๋Š” ์ง„ํ–‰ ์ค‘ ๋ฐฉ์ด 5๊ฐœ ์ด์ƒ": { + value: { + error: "Rooms/join : participating in too many rooms", + }, + }, + "์ž…๋ ฅํ•œ ์‹œ๊ฐ„์˜ ๋ฐฉ์ด ์ด๋ฏธ ์ถœ๋ฐœํ•จ": { + value: { + error: "Room/join : The room has already departed", + }, + }, + "๋ฐฉ์˜ ์ธ์›์ด ๋ชจ๋‘ ์ฐผ์Œ": { + value: { + error: "Room/join : The room is already full", + }, + }, + }, + }, + }, + }, + 404: { + description: "ํ•ด๋‹น id๋ฅผ ๊ฐ€์ง„ ๋ฐฉ์ด ์กด์žฌํ•˜์ง€ ์•Š์Œ", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/join : no corresponding room", + }, + }, + }, + }, + 409: { + description: "์‚ฌ์šฉ์ž๊ฐ€ ์ด๋ฏธ ์ฐธ์—ฌ์ค‘์ž„", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/join : {userID} Already in room", + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "text/html": { + example: "Rooms/join : internal server error", + }, + }, + }, + }, }, }; roomsDocs[`${apiPrefix}/abort`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์ฐธ์—ฌ ์ค‘์ธ ๋ฐฉ์—์„œ ํ‡ด์žฅ", + description: `room์˜ ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น room์˜ ์ฐธ๊ฐ€์ž ๋ชฉ๋ก์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ์‚ฌ์šฉ์ž๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.
+ ์ถœ๋ฐœํ–ˆ์ง€๋งŒ ์ •์‚ฐ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์€ ๋ฐฉ์—์„œ๋Š” ๋‚˜๊ฐˆ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + }, + }, + }, + }, + }, + }, + responses: { + 200: { + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 400: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + examples: { + "์ž˜๋ชป๋œ userId๋ฅผ ํฌํ•จํ•œ ์š”์ฒญ์ž„": { + value: { + error: "Rooms/abort : Bad request", + }, + }, + "์ •์‚ฐ์ด ๋˜์ง€ ์•Š์€ ์ถœ๋ฐœํ•œ ๋ฐฉ์€ ๋‚˜๊ฐˆ ์ˆ˜ ์—†์Œ": { + value: { + error: + "Rooms/abort : cannot exit room. Settlement is not done", + }, + }, + }, + }, + }, + }, + 403: { + description: "์‚ฌ์šฉ์ž๊ฐ€ ํ•ด๋‹น ๋ฐฉ์˜ ๊ตฌ์„ฑ์›์ด ์•„๋‹˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/abort : did not joined the room", + }, + }, + }, + }, + 404: { + description: "ํ•ด๋‹น id๋ฅผ ๊ฐ€์ง„ ๋ฐฉ์ด ์กด์žฌํ•˜์ง€ ์•Š์Œ", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/abort : no corresponding room", + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/abort : internal server error", + }, + }, + }, + }, + }, }, }; roomsDocs[`${apiPrefix}/search`] = { get: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "๋ฐฉ ๊ฒ€์ƒ‰", + description: `์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€/๋‚ ์งœ๋ฅผ ๋ฐ›์•„ ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐฉ์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
+ ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐฉ์ด ์žˆ์„ ๊ฒฝ์šฐ, ๋ฐฉ๋“ค์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ  ์—†๋‹ค๋ฉด ๋นˆ ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.`, + parameters: [ + { + in: "query", + name: "name", + schema: { + type: "string", + }, + description: `๊ฒ€์ƒ‰ํ•  ๋ฐฉ์˜ ์ด๋ฆ„
+ ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ํ•ด๋‹น ํ…์ŠคํŠธ๊ฐ€ ๋ฐฉ์˜ ์ด๋ฆ„์— ํฌํ•จ๋œ ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜.
+ ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ์ด๋ฆ„์„ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰.`, + }, + { + in: "query", + name: "from", + schema: { + type: "string", + pattern: objectIdPattern, + }, + description: `์ถœ๋ฐœ์ง€ Document์˜ ObjectId
+ ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ์ถœ๋ฐœ์ง€๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜.
+ ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ์ถœ๋ฐœ์ง€๋ฅผ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰.`, + }, + { + in: "query", + name: "to", + schema: { + type: "string", + pattern: objectIdPattern, + }, + description: `๋„์ฐฉ์ง€ Document์˜ ObjectId
+ ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ๋„์ฐฉ์ง€๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜.
+ ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ๋„์ฐฉ์ง€๋ฅผ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰.`, + }, + { + in: "query", + name: "time", + schema: { + type: "string", + format: "date-time", + }, + description: `์ถœ๋ฐœ ์‹œ๊ฐ
+ ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ์ฃผ์–ด์ง„ ์‹œ๊ฐ„๋ถ€ํ„ฐ ์ฃผ์–ด์ง„ ์‹œ๊ฐ„๋ถ€ํ„ฐ ๊ทธ ๋‹ค์Œ์— ์ฐพ์•„์˜ค๋Š” ์˜ค์ „ 5์‹œ ์ „์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜.
+ ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ํ˜„์žฌ ์‹œ๊ฐ๋ถ€ํ„ฐ ๊ทธ ๋‹ค์Œ์œผ๋กœ ์ฐพ์•„์˜ค๋Š” ์˜ค์ „ 5์‹œ ์ „๊นŒ์ง€์˜ ๋ฐฉ๋“ค์„ ๋ฐ˜ํ™˜.`, + }, + { + in: "query", + name: "withTime", + schema: { + type: "boolean", + }, + description: `๊ฒ€์ƒ‰ ์˜ต์…˜์— ์‹œ๊ฐ„ ์˜ต์…˜์ด ํฌํ•จ๋˜์–ด ์žˆ๋Š”์ง€ ์—ฌ๋ถ€.
+ false์ด๊ณ  ๊ฒ€์ƒ‰ํ•˜๋Š” ๋‚ ์งœ๊ฐ€ ์˜ค๋Š˜ ์ดํ›„์ธ ๊ฒฝ์šฐ ๊ฒ€์ƒ‰ํ•˜๋Š” ์‹œ๊ฐ„์„ 0์‹œ 0๋ถ„ 0์ดˆ๋กœ ์„ค์ •ํ•จ.`, + }, + { + in: "query", + name: "maxPartLength", + schema: { + type: "integer", + }, + description: ` ๋ฐฉ์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜.
+ ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ์ตœ๋Œ€ ์ธ์› ์ˆ˜๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜.
+ ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜๋ฅผ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰.`, + }, + { + in: "query", + name: "isHome", + schema: { + type: "boolean", + }, + description: `ํ™ˆ ํŽ˜์ด์ง€ ๊ฒ€์ƒ‰์ธ์ง€ ์—ฌ๋ถ€
+ true์ธ ๊ฒฝ์šฐ ๊ฒ€์ƒ‰ ๋‚ ์งœ ๋ฒ”์œ„๋ฅผ 7์ผ๋กœ ์„ค์ •.
+ false์ธ ๊ฒฝ์šฐ ๊ฒ€์ƒ‰ ๋‚ ์งœ ๋ฒ”์œ„๋ฅผ 14์ผ๋กœ ์„ค์ •.
`, + }, + ], + responses: { + /* TODO: change to array */ + 200: { + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 400: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + examples: { + "์ถœ๋ฐœ์ง€์™€ ๋„์ฐฉ์ง€๊ฐ€ ๊ฐ™์Œ": { + value: { + error: "Room/search : Bad request", + }, + }, + "์ถœ๋ฐœ/๋„์ฐฉ์ง€๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ์žฅ์†Œ": { + value: { + error: "Room/search : no corresponding locations", + }, + }, + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/search : internal server error", + }, + }, + }, + }, + }, }, }; From bb7f18e9271c570994d71c552a5bb1e72eafe285 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Mon, 29 Jan 2024 17:06:35 +0000 Subject: [PATCH 104/108] Docs: rooms.js --- src/routes/docs/rooms.js | 205 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 190 insertions(+), 15 deletions(-) diff --git a/src/routes/docs/rooms.js b/src/routes/docs/rooms.js index b2f24f72..d22088cb 100644 --- a/src/routes/docs/rooms.js +++ b/src/routes/docs/rooms.js @@ -563,12 +563,14 @@ roomsDocs[`${apiPrefix}/search`] = { }, ], responses: { - /* TODO: change to array */ 200: { content: { "application/json": { schema: { - $ref: "#/components/schemas/room", + type: "array", + items: { + $ref: "#/components/schemas/room", + }, }, }, }, @@ -622,32 +624,205 @@ roomsDocs[`${apiPrefix}/search`] = { }; roomsDocs[`${apiPrefix}/searchByUser`] = { - post: { + get: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ ์ค‘์ธ ๋ฐฉ ๊ฒ€์ƒ‰", + description: `๋กœ๊ทธ์ธ ๋œ ์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ ์ค‘์ธ ๋ฐฉ์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
+ ์ •์‚ฐ ์™„๋ฃŒ ์—ฌ๋ถ€ ๊ธฐ์ค€์œผ๋กœ ์ง„ํ–‰ ์ค‘์ธ ๋ฐฉ๊ณผ ์™„๋ฃŒ๋œ ๋ฐฉ์„ \`ongoing\`๊ณผ \`done\`์œผ๋กœ ๊ฐ๊ฐ ๋ถ„๋ฆฌํ•˜์—ฌ ์‘๋‹ต์„ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.
+ (\`ongoing\`์€ \`isOver\`์ด flase์ธ ๋ฐฉ, \`done\`์€ \`isOver\`์ด true์ธ ๋ฐฉ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.)`, + parameters: {}, + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + ongoing: { + type: "array", + items: { + $ref: "#/components/schemas/room", + }, + }, + done: { + type: "array", + items: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/searchByUser : internal server error", + }, + }, + }, + }, + }, }, }; roomsDocs[`${apiPrefix}/commitPayment`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "๋ฐฉ ๊ฒฐ์ œ ์ฒ˜๋ฆฌ", + description: `ํ•ด๋‹น ๋ฐฉ์— ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €๋ฅผ ๊ฒฐ์ œ์ž๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ ์ด๋ฏธ ์ถœ๋ฐœํ•œ ๋ฐฉ์— ๋Œ€ํ•ด์„œ๋งŒ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ ๋ฐฉ์˜ \`part\` ๋ฐฐ์—ด์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ \`isSettlement\` ์†์„ฑ์€ \`paid\`๋กœ ์„ค์ •๋ฉ๋‹ˆ๋‹ค.
+ ๋‚˜๋จธ์ง€ ์œ ์ €๋“ค์˜ \`isSettlement\` ์†์„ฑ์„ \`send-required\`๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: "๊ฒฐ์ œ ์ •๋ณด๊ฐ€ ์ˆ˜์ •๋œ ๋ฐฉ์˜ ์„ธ๋ถ€ ์ •๋ณด๊ฐ€ ๋‹ด๊ธด room Object", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 404: { + description: `์ž˜๋ชป๋œ ๋ฐฉ ์š”์ฒญ
+ (์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ ์ค‘์ธ ๋ฐฉ์ด ์•„๋‹ˆ๊ฑฐ๋‚˜, ์ด๋ฏธ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด ๊ฒฐ์ œ์ž์ด๊ฑฐ๋‚˜, ์•„์ง ๋ฐฉ์ด ์ถœ๋ฐœํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ)`, + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/:id/commitPayment : cannot find settlement info", + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/:id/commitPayment : internal server error", + }, + }, + }, + }, + }, }, }; roomsDocs[`${apiPrefix}/commitSettlement`] = { post: { tags: [tag], - summary: "", - description: "", - requestBody: {}, - responses: {}, + summary: "๋ฐฉ ์ •์‚ฐ ์™„๋ฃŒ ์ฒ˜๋ฆฌ", + description: `ํ•ด๋‹น ๋ฐฉ์— ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €๋ฅผ ์ •์‚ฐ ์™„๋ฃŒ๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
+ ๋ฐฉ์˜ \`part\` ๋ฐฐ์—ด์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ \`isSettlement\` ์†์„ฑ์€ \`send-required\`์—์„œ \`sent\`๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
+ ๋ฐฉ์˜ ์ฐธ์—ฌํ•œ ์œ ์ €๋“ค์ด ๋ชจ๋‘ ์ •์‚ฐ์™„๋ฃŒ๋ฅผ ํ•˜๋ฉด ๋ฐฉ์˜ \`isOver\` ์†์„ฑ์ด \`true\`๋กœ ๋ณ€๊ฒฝ๋˜๋ฉฐ, ๊ณผ๊ฑฐ ๋ฐฉ์œผ๋กœ ์ทจ๊ธ‰๋ฉ๋‹ˆ๋‹ค.`, + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + roomId: { + type: "string", + pattern: objectIdPattern, + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: "๊ฒฐ์ œ ์ •๋ณด๊ฐ€ ์ˆ˜์ •๋œ ๋ฐฉ์˜ ์„ธ๋ถ€ ์ •๋ณด๊ฐ€ ๋‹ด๊ธด room Object", + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/room", + }, + }, + }, + }, + 404: { + description: `์ž˜๋ชป๋œ ๋ฐฉ ์š”์ฒญ
+ (์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ ์ค‘์ธ ๋ฐฉ์ด ์•„๋‹ˆ๊ฑฐ๋‚˜, ์‚ฌ์šฉ์ž๊ฐ€ ๊ฒฐ์ œ๋ฅผ ํ–ˆ๊ฑฐ๋‚˜ ์ด๋ฏธ ์ •์‚ฐํ•œ ๊ฒฝ์šฐ)`, + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/:id/settlement : cannot find settlement info", + }, + }, + }, + }, + 500: { + description: "๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { + type: "string", + }, + }, + }, + example: { + error: "Rooms/:id/settlement : internal server error", + }, + }, + }, + }, + }, }, }; From a8689b7933f3edb2e941736f38138c0dfba8baae Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Mon, 29 Jan 2024 17:10:39 +0000 Subject: [PATCH 105/108] Docs: add login info --- src/routes/docs/rooms.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/docs/rooms.js b/src/routes/docs/rooms.js index d22088cb..3292b127 100644 --- a/src/routes/docs/rooms.js +++ b/src/routes/docs/rooms.js @@ -122,7 +122,7 @@ roomsDocs[`${apiPrefix}/create`] = { roomsDocs[`${apiPrefix}/publicInfo`] = { get: { tags: [tag], - summary: "์ •์‚ฐ ์ •๋ณด๋ฅผ ์ œ์™ธํ•œ ๋ฐฉ ์„ธ๋ถ€ ์‚ฌํ•ญ ๋ฐ˜ํ™˜ (๋กœ๊ทธ์ธ ํ•„์š” x)", + summary: "์ •์‚ฐ ์ •๋ณด๋ฅผ ์ œ์™ธํ•œ ๋ฐฉ ์„ธ๋ถ€ ์‚ฌํ•ญ ๋ฐ˜ํ™˜", description: "ํŠน์ • id ๋ฐฉ์˜ ์ •์‚ฐ ์ •๋ณด๋ฅผ ์ œ์™ธํ•œ ์„ธ๋ถ€์‚ฌํ•ญ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ์„ ํ•˜์ง€ ์•Š์•„๋„ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.", parameters: [ @@ -487,7 +487,8 @@ roomsDocs[`${apiPrefix}/search`] = { tags: [tag], summary: "๋ฐฉ ๊ฒ€์ƒ‰", description: `์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€/๋‚ ์งœ๋ฅผ ๋ฐ›์•„ ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐฉ์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
- ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐฉ์ด ์žˆ์„ ๊ฒฝ์šฐ, ๋ฐฉ๋“ค์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ  ์—†๋‹ค๋ฉด ๋นˆ ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.`, + ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐฉ์ด ์žˆ์„ ๊ฒฝ์šฐ, ๋ฐฉ๋“ค์˜ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ  ์—†๋‹ค๋ฉด ๋นˆ ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
+ ๋กœ๊ทธ์ธ์„ ํ•˜์ง€ ์•Š์•„๋„ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.`, parameters: [ { in: "query", From 81f3d763f85d281f8eafc524d8feae5b46c08550 Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Mon, 29 Jan 2024 17:13:38 +0000 Subject: [PATCH 106/108] Docs: remove docs.md --- src/routes/docs/rooms.md | 367 --------------------------------------- 1 file changed, 367 deletions(-) delete mode 100755 src/routes/docs/rooms.md diff --git a/src/routes/docs/rooms.md b/src/routes/docs/rooms.md deleted file mode 100755 index 3346d753..00000000 --- a/src/routes/docs/rooms.md +++ /dev/null @@ -1,367 +0,0 @@ -# `/rooms` API - -## Table of contents - -- [`/rooms` API](#rooms-api) - - [Table of contents](#table-of-contents) - - [Description](#description) - - [Available endpoints](#available-endpoints) - - [`/publicInfo` **(GET)**](#publicinfo-get) - - [URL parameters](#url-parameters) - - [Response](#response) - - [Errors](#errors) - - [`/info` **(GET)**](#info-get) - - [URL parameters](#url-parameters-1) - - [Response](#response-1) - - [Errors](#errors-1) - - [`/create` **(POST)**](#create-post) - - [POST request form](#post-request-form) - - [Errors](#errors-2) - - [Response](#response-2) - - [`/join` (POST)](#join-post) - - [request JSON form](#request-json-form) - - [Errors](#errors-3) - - [`/abort` (POST)](#abort-post) - - [request JSON form](#request-json-form-1) - - [Errors](#errors-4) - - [`/search` **(GET)**](#search-get) - - [URL parameters](#url-parameters-2) - - [Response](#response-3) - - [Errors](#errors-5) - - [`/searchByUser` **(GET)**](#searchbyuser-get) - - [URL parameters](#url-parameters-3) - - [Response](#response-4) - - [Errors](#errors-6) - - [`/commitPayment` **(POST)**](#commitpayment-post) - - [Request Body](#request-body) - - [Response](#response-5) - - [Errors](#errors-7) - - [`/commitSettlement/` **(POST)**](#commitsettlement-post) - - [Request Body](#request-body-1) - - [Response](#response-6) - - [Errors](#errors-8) - - [`/edit/` **(POST)** **(for dev)**](#edit-post-for-dev) - - [POST request form](#post-request-form-1) - - [Response](#response-7) - - [Errors](#errors-9) - - [`/getAllRoom` **(GET)** (for dev)](#getallroom-get-for-dev) - - [`/removeAllRoom` **(GET)** (for dev)](#removeallroom-get-for-dev) - - [`/:id/delete/` **(GET)** **(for dev)**](#iddelete-get-for-dev) - - [URL Parameters](#url-parameters-4) - - [Response](#response-8) - - [Errors](#errors-10) - -## Description - -- ๋ฐฉ ์ƒ์„ฑ/์ˆ˜์ •/์‚ญ์ œ/์กฐํšŒ ๊ธฐ๋Šฅ์„ ์ง€์›ํ•˜๋Š” API. -- `/publicInfo`, `/search`๋ฅผ ์ œ์™ธํ•œ endpoint๋Š” ๋กœ๊ทธ์ธ๋œ ์ƒํƒœ์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ -- Request form์—์„œ ์š”๊ตฌํ•˜๋Š” property ์ด๋ฆ„์— ? ์ด ๋ถ™์€ ๊ฒฝ์šฐ ํ•„์ˆ˜๊ฐ€ ์•„๋‹ˆ๋ผ๋Š” ๋œป -- ๋ฐฉ์„ ๋ฐ˜ํ™˜ํ•  ๊ฒฝ์šฐ ๊ทธ type์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. - -```javascript -Room { - _id: ObjectId, //ObjectID - name: String, // 1~50๊ธ€์ž๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ ์˜์–ด ๋Œ€์†Œ๋ฌธ์ž, ์ˆซ์ž, ํ•œ๊ธ€, "-", ",", ".", "?", "!", "_"๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•จ. - from: { - _id: ObjectId, // ์ถœ๋ฐœ์ง€ document์˜ ObjectId - koName: String, // ์ถœ๋ฐœ์ง€์˜ ํ•œ๊ตญ์–ด ๋ช…์นญ - enName: String, // ์ถœ๋ฐœ์ง€์˜ ์˜์–ด ๋ช…์นญ - }, - to: { - _id: ObjectId, // ๋„์ฐฉ์ง€ document์˜ ObjectId - koName: String, // ๋„์ฐฉ์ง€์˜ ํ•œ๊ตญ์–ด ๋ช…์นญ - enName: String, // ๋„์ฐฉ์ง€์˜ ์˜์–ด ๋ช…์นญ - }, - time: String(ISO 8601), // ex) ๋ฐฉ ์ถœ๋ฐœ ์‹œ๊ฐ. '2022-01-12T13:58:20.180Z' - isDeparted: Boolean, // ์ด๋ฏธ ์ถœ๋ฐœํ•œ ํƒ์‹œ์ธ์ง€ ์—ฌ๋ถ€ (์ถœ๋ฐœํ–ˆ์œผ๋ฉด true) - part: [ - { - _id: ObjectId, // part์˜ ObjectId - user: { - _id: ObjectId, // ์ฐธ์—ฌ ์ค‘์ธ ์‚ฌ์šฉ์ž Document์˜ ObjectId - name: String, // ์ฐธ์—ฌ ์ค‘์ธ ์‚ฌ์šฉ์ž ์ด๋ฆ„ - nickname: String, // ์ฐธ์—ฌ ์ค‘์ธ ์‚ฌ์šฉ์ž ๋‹‰๋„ค์ž„ - profileImageUrl: String, // ํ”„๋กœํ•„ ์‚ฌ์ง„ url - isSettlement: String || undefined, //ํ•ด๋‹น ์‚ฌ์šฉ์ž์˜ ์ •์‚ฐ ์ƒํƒœ (์ฃผ์˜: "/publicInfo"์™€ "/search"์—์„œ๋Š” isSettlement ์†์„ฑ์ด undefined๋กœ ์„ค์ •๋จ). - }, - } - ], - maxPartLength: Number(2~4), //๋ฐฉ์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜ - madeat: String(ISO 8601), // ex) ๋ฐฉ ์ƒ์„ฑ ์‹œ๊ฐ. '2022-01-12T13:58:20.180Z' - settlementTotal: Number(2~4), // ์ •์‚ฐ์ด ์™„๋ฃŒ๋œ ์‚ฌ์šฉ์ž ์ˆ˜ (์ฃผ์˜: "/publicInfo"์™€ "/search"์—์„œ๋Š” settlementTotal ์†์„ฑ์ด undefined๋กœ ์„ค์ •๋จ). - isOver: Boolean, // ์š”์ฒญ์„ ๋ณด๋‚ธ ์‚ฌ์šฉ์ž๊ฐ€ ํ•ด๋‹น ๋ฐฉ์˜ ์ •์‚ฐ์„ ์™„๋ฃŒ๋๋Š”์ง€ ์—ฌ๋ถ€(์™„๋ฃŒ ์‹œ true) (์ฃผ์˜: rooms/search์—์„œ๋Š” isOver ์†์„ฑ์„ ๋ฐ˜ํ™˜ํ•˜์ง€ ์•Š๊ณ  undefined๋ฅผ ๋ฐ˜ํ™˜ํ•จ). - __v: Number, // ๋ฌธ์„œ ๋ฒ„์ „. mongoDB ๋‚ด๋ถ€์ ์œผ๋กœ ์‚ฌ์šฉ๋จ. -} -``` - -`settlementStatus` ์†์„ฑ์€ ์•„๋ž˜ ๋„ค ๊ฐ€์ง€ ๊ฐ’๋“ค ์ค‘ ํ•˜๋‚˜๋ฅผ ๊ฐ€์ง„๋‹ค. - -1. `"not-departed"` : ์•„๋ฌด๋„ ๊ฒฐ์ œ/์ •์‚ฐํ•˜์ง€ ์•Š์€ ์ƒํƒœ -2. `"paid"` : ํƒ์‹œ๋น„๋ฅผ ๊ฒฐ์ œํ•œ ์ฐธ๊ฐ€๊ฐ€ "๊ฒฐ์ œํ•˜๊ธฐ" ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ํ•ด๋‹น ์ฐธ๊ฐ€์ž์—๊ฒŒ ์„ค์ •๋˜๋Š” ์ •์‚ฐ ์ƒํƒœ. -3. `"send-required"` : ํŠน์ • ์ฐธ๊ฐ€์ž๊ฐ€ "๊ฒฐ์ œํ•˜๊ธฐ" ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๊ทธ ๋ฐฉ์˜ ๋‚˜๋จธ์ง€ ์ฐธ๊ฐ€์ž์—๊ฒŒ ์„ค์ •๋˜๋Š” ์ •์‚ฐ ์ƒํƒœ. -4. `"sent"` : ์ •์‚ฐ ์ƒํƒœ๊ฐ€`"send-required"`์ธ ์‚ฌ์šฉ์ž๊ฐ€ "์ •์‚ฐํ•˜๊ธฐ" ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๊ทธ ์‚ฌ์šฉ์ž์—๊ฒŒ ์„ค์ •๋˜๋Š” ์ •์‚ฐ ์ƒํƒœ. - -## Available endpoints - -### `/publicInfo` **(GET)** - -ID๋ฅผ parameter๋กœ ๋ฐ›์•„ ํ•ด๋‹น ID์˜ room์˜ ์ •๋ณด ์ถœ๋ ฅ - -#### URL parameters - -- id : ์กฐํšŒํ•  room์˜ ID - -#### Response - -- ํ•ด๋‹น ๋ฐฉ์˜ ์ •๋ณด -- ๊ฐ ์ฐธ์—ฌ์ž์˜ isSettlement ์†์„ฑ๊ณผ ๋ฐฉ์˜ settlementTotal ์†์„ฑ์€ undefined๋กœ ์„ค์ •๋จ. - -#### Errors - -- 404 "id does not exist" -- 500 "internal server error" - -### `/info` **(GET)** - -ID๋ฅผ parameter๋กœ ๋ฐ›์•„ ํ•ด๋‹น ID์˜ room์˜ ์ •๋ณด ์ถœ๋ ฅ - -#### URL parameters - -- id : ์กฐํšŒํ•  room์˜ ID - -#### Response - -- ํ•ด๋‹น ๋ฐฉ์˜ ์ •๋ณด - -#### Errors - -- 403 "not logged in" -- 403 "did not joined the room" -- 404 "id does not exist" -- 500 "internal server error" - -### `/create` **(POST)** - -์š”์ฒญ์„ ๋ฐ›์•„ room์„ ์ƒ์„ฑ -ํ•˜๋‚˜์˜ User๋Š” ์ตœ๋Œ€ 5๊ฐœ์˜ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ์— ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค. - -#### POST request form - -`Request body` - -```javascript -{ - name : String, // ๋ฐฉ ์ด๋ฆ„. ๋ฌธ์„œ ์ƒ๋‹จ์— ๋ช…์‹œ๋œ ๊ทœ์น™์„ ๋งŒ์กฑ์‹œ์ผœ์•ผ ํ•จ - from : ObjectId, // ์ถœ๋ฐœ์ง€ Document์˜ ObjectId - to : ObjectId, // ๋„์ฐฉ์ง€ Document์˜ ObjectId - time : Date, // ๋ฐฉ ์ถœ๋ฐœ ์‹œ๊ฐ. ํ˜„์žฌ ์ดํ›„์—ฌ์•ผ ํ•จ. - part? : String[], // ๋ฐฉ ์‚ฌ๋žŒ๋“ค์˜ ObjectId. ๋”ฐ๋ผ์„œ ๋นˆ ๋ฐฐ์—ด๋กœ ์š”์ฒญํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. - maxPartLength: Number(2~4), //๋ฐฉ์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜ -} -``` - -#### Errors - -- 400 "bad request" -- 400 "participating in too many rooms" -- 400 "locations are same" -- 400 "no corresponding locations" -- 500 "internal server error" - -#### Response - -- ์ƒˆ๋กœ์ด ๋งŒ๋“ค์–ด์ง„ ๋ฐฉ - -### `/join` (POST) - -room์˜ ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น room์˜ ์ฐธ๊ฐ€์ž ๋ชฉ๋ก์— ์š”์ฒญ์„ ๋ณด๋‚ธ ์‚ฌ์šฉ์ž๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. -ํ•˜๋‚˜์˜ User๋Š” ์ตœ๋Œ€ 5๊ฐœ์˜ ์ง„ํ–‰์ค‘์ธ ๋ฐฉ์— ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค. -์•„์ง ์ •์›์ด ์ฐจ์ง€ ์•Š์€ ๋ฐฉ๊ณผ ์•„์ง ์ถœ๋ฐœํ•˜์ง€ ์•Š์€ ๋ฐฉ์—๋งŒ ์ฐธ์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค. - -#### request JSON form - -```javascript -{ - roomId : ObjectId, // ์ดˆ๋Œ€ ํ˜น์€ ์ฐธ์—ฌํ•˜๋ ค๋Š” ๋ฐฉ Document์˜ ObjectId -} -``` - -#### Errors - -- 400 "Bad request" -- 400 "participating in too many rooms" -- 400 "The room is full" -- 400 "The room has already departed" -- 404 "no corresponding room" -- 409 "{userID} Already in room" -- 500 "internal server error" - -### `/abort` (POST) - -room์˜ ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น room์˜ ์ฐธ๊ฐ€์ž ๋ชฉ๋ก์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ์‚ฌ์šฉ์ž๋ฅผ ์‚ญ์ œํ•œ๋‹ค. -์ถœ๋ฐœํ–ˆ์ง€๋งŒ ์ •์‚ฐ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์€ ๋ฐฉ์—์„œ๋Š” ๋‚˜๊ฐˆ ์ˆ˜ ์—†๋‹ค. - -#### request JSON form - -```javascript -{ - roomId : ObjectId, // ์ดˆ๋Œ€ ํ˜น์€ ์ฐธ์—ฌํ•˜๋ ค๋Š” ๋ฐฉ Document์˜ ObjectId -} -``` - -#### Errors - -- 400 "Bad request" -- 400 "cannot exit room. Settlement is not done" -- 404 "no corresponding room" -- 500 "internal server error" - - -### `/search` **(GET)** - -์ถœ๋ฐœ์ง€/๋„์ฐฉ์ง€/๋‚ ์งœ๋ฅผ ๋ฐ›์•„ ํ•ด๋‹นํ•˜๋Š” room๋“ค์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. - -#### URL parameters - -- name?: String, // ๊ฒ€์ƒ‰ํ•  ๋ฐฉ์˜ ์ด๋ฆ„. ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ํ•ด๋‹น ํ…์ŠคํŠธ๊ฐ€ ๋ฐฉ์˜ ์ด๋ฆ„์— ํฌํ•จ๋œ ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜. ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ์ด๋ฆ„์„ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰. -- from? : ObjectId, // ์ถœ๋ฐœ์ง€ Document์˜ ObjectId. ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ์ถœ๋ฐœ์ง€๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜. ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ์ถœ๋ฐœ์ง€๋ฅผ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰. -- to? : ObjectId, // ๋„์ฐฉ์ง€ Document์˜ ObjectId. ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ๋„์ฐฉ์ง€๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜. ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ๋„์ฐฉ์ง€๋ฅผ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰. -- time? : Date, // ์ถœ๋ฐœ ์‹œ๊ฐ. ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ์ฃผ์–ด์ง„ ์‹œ๊ฐ„๋ถ€ํ„ฐ ์ฃผ์–ด์ง„ ์‹œ๊ฐ„๋ถ€ํ„ฐ ๊ทธ ๋‹ค์Œ์— ์ฐพ์•„์˜ค๋Š” ์˜ค์ „ 5์‹œ ์ „์— ์ถœ๋ฐœํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜. ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ํ˜„์žฌ ์‹œ๊ฐ๋ถ€ํ„ฐ ๊ทธ ๋‹ค์Œ์œผ๋กœ ์ฐพ์•„์˜ค๋Š” ์˜ค์ „ 5์‹œ ์ „๊นŒ์ง€์˜ ๋ฐฉ๋“ค์„ ๋ฐ˜ํ™˜. -- withTime? : Boolean, // ๊ฒ€์ƒ‰ ์˜ต์…˜์— ์‹œ๊ฐ„ ์˜ต์…˜์ด ํฌํ•จ๋˜์–ด ์žˆ๋Š”์ง€ ์—ฌ๋ถ€. false์ด๊ณ  ๊ฒ€์ƒ‰ํ•˜๋Š” ๋‚ ์งœ๊ฐ€ ์˜ค๋Š˜ ์ดํ›„์ธ ๊ฒฝ์šฐ ๊ฒ€์ƒ‰ํ•˜๋Š” ์‹œ๊ฐ„์„ 0์‹œ 0๋ถ„ 0์ดˆ๋กœ ์„ค์ •ํ•จ. -- maxPartLength?: Number(2~4), // ๋ฐฉ์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜. ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ ์ตœ๋Œ€ ์ธ์› ์ˆ˜๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๋ฐฉ๋“ค๋งŒ ๋ฐ˜ํ™˜. ์ฃผ์–ด์ง€์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ž„์˜์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜๋ฅผ ๊ฐ€์ง€๋Š” ๋ฐฉ๋“ค์„ ๊ฒ€์ƒ‰. - - -#### Response - -์กฐ๊ฑด์— ๋งž๋Š” ๋ฐฉ**๋“ค**์˜ ์ •๋ณด: `Room[]` -์กฐ๊ฑด์— ์ผ์น˜ํ•˜๋Š” ๋ฐฉ์ด ์—†๋”๋ผ๋„ ๋นˆ ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•จ. - -#### Errors - -- 400 "Bad request" -- 400 "no corresponding locations" -- 500 "Internal server error" - -### `/searchByUser` **(GET)** - -๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ ์ค‘์ธ room๋“ค์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. - -#### URL parameters - -์—†์Œ. - -#### Response - -```javascript -{ - ongoing: [Room], // ์ •์‚ฐ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์€ ๋ฐฉ (๋ฐฉ์˜ isOver ์†์„ฑ์ด false์ธ ๋ฐฉ) - done: [Room], // ์ •์‚ฐ์ด ์™„๋ฃŒ๋œ ๋ฐฉ (๋ฐฉ์˜ isOver ์†์„ฑ์ด true์ธ ๋ฐฉ) -} -``` - -#### Errors - -- 403 "not logged in" -- 500 "internal server error" - - -### `/commitPayment` **(POST)** - -- ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น ๋ฐฉ์— ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €๋ฅผ ๊ฒฐ์ œ์ž๋กœ ์ฒ˜๋ฆฌ -- ์ด๋ฏธ ์ถœ๋ฐœํ•œ ๋ฐฉ(ํ˜„์žฌ ์‹œ๊ฐ์ด ์ถœ๋ฐœ ์‹œ๊ฐ ์ดํ›„์ธ ๊ฒฝ์šฐ)์— ๋Œ€ํ•ด์„œ๋งŒ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•จ -- ๋ฐฉ์˜ part ๋ฐฐ์—ด์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ isSettlement ์†์„ฑ์„ `paid`๋กœ ์„ค์ •ํ•˜๊ณ , ๋‚˜๋จธ์ง€ ์œ ์ €๋“ค์˜ isSettlement ์†์„ฑ์„ `"send-required"`๋กœ ์„ค์ •ํ•จ. - -#### Request Body - -- roomId : ์ •์‚ฐํ•  room์˜ ID - -#### Response - -- ๋ฉค๋ฒ„๋“ค์˜ ์ •์‚ฐ์ •๋ณด๊ฐ€ ๋ฐ˜์˜๋œ ๋ฐฉ์˜ ์ •๋ณด - -#### Errors - -- 400 "Bad request": ๋กœ๊ทธ์ธ์ด ๋˜์–ด์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ -- 404 "cannot find settlement info": ์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ ์ค‘์ธ ๋ฐฉ์ด ์•„๋‹ˆ๊ฑฐ๋‚˜, ์ด๋ฏธ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด ๊ฒฐ์ œ์ž์ด๊ฑฐ๋‚˜, ์•„์ง ๋ฐฉ์ด ์ถœ๋ฐœํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ -- 500 "internal server error" - - - -### `/commitSettlement/` **(POST)** - -- ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น ๋ฐฉ์— ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ ์ •์‚ฐ์„ ์™„๋ฃŒ๋กœ ์ฒ˜๋ฆฌ -- ๋ฐฉ์˜ part ๋ฐฐ์—ด์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ์œ ์ €์˜ isSettlement ์†์„ฑ์„ `send-required`์—์„œ `"sent"`๋กœ ๋ณ€๊ฒฝํ•จ. -- ๋ฐฉ์— ์ฐธ์—ฌํ•œ ๋ฉค๋ฒ„๋“ค์ด ๋ชจ๋‘ ์ •์‚ฐ์™„๋ฃŒ๋ฅผ ํ•˜๋ฉด ๋ฐฉ์˜ `isOver` ์†์„ฑ์ด `true`๋กœ ๋ณ€๊ฒฝ๋˜๋ฉฐ, ๊ณผ๊ฑฐ ๋ฐฉ์œผ๋กœ ์ทจ๊ธ‰๋จ - -#### Request Body - -- roomId : ์ •์‚ฐํ•  room์˜ ID - -#### Response - -- ๋ฉค๋ฒ„๋“ค์˜ ์ •์‚ฐ์ •๋ณด๊ฐ€ ๋ฐ˜์˜๋œ ๋ฐฉ์˜ ์ •๋ณด - -#### Errors - -- 400 "Bad request" : ๋กœ๊ทธ์ธ์ด ๋˜์–ด์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ -- 404 "cannot find settlement info": ์‚ฌ์šฉ์ž๊ฐ€ ์ฐธ์—ฌ์ค‘์ธ ๋ฐฉ์ด ์•„๋‹ˆ๊ฑฐ๋‚˜, ์‚ฌ์šฉ์ž๊ฐ€ ๊ฒฐ์ œ๋ฅผ ํ–ˆ๊ฑฐ๋‚˜ ์ด๋ฏธ ์ •์‚ฐํ•œ ๊ฒฝ์šฐ -- 500 "internal server error" - -### `/edit/` **(POST)** **(for dev)** - -- ID์™€ ์ˆ˜์ •ํ•  ๋ฐ์ดํ„ฐ๋ฅผ JSON์œผ๋กœ ๋ฐ›์•„ ํ•ด๋‹น ID์˜ room์„ ์ˆ˜์ • -- ๋ฐฉ์— ์ฐธ์—ฌ์ค‘์ธ ์‚ฌ์šฉ์ž๋งŒ ์ •๋ณด๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Œ. -- ํ”„๋ก ํŠธ์—”๋“œ์—์„œ ์“ฐ์ผ ์ผ์€ ์—†์–ด ๋ณด์ž„. - -#### POST request form - -```javascript -{ - roomId : String, // ์ˆ˜์ •ํ•  room์˜ ID - name? : String, // ๋ฐฉ ์ด๋ฆ„. ๋ฌธ์„œ ์ƒ๋‹จ์— ๋ช…์‹œ๋œ ๊ทœ์น™์„ ๋งŒ์กฑ์‹œ์ผœ์•ผ ํ•จ - from? : ObjectId, // ์ถœ๋ฐœ์ง€ Document์˜ ObjectId - to? : ObjectId, // ๋„์ฐฉ์ง€ Document์˜ ObjectId - time? : Date, // ๋ฐฉ ์ถœ๋ฐœ ์‹œ๊ฐ. ํ˜„์žฌ ์ดํ›„์—ฌ์•ผ ํ•จ. - maxPartLength?: Number(2~4), // ๋ฐฉ์˜ ์ตœ๋Œ€ ์ธ์› ์ˆ˜. ํ˜„์žฌ ์ฐธ์—ฌ ์ธ์›์ˆ˜๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์€ ๊ฐ’์ด์–ด์•ผ ํ•จ. -} -``` - -#### Response - -- ๋ณ€๊ฒฝ๋œ ๋ฐฉ์˜ ์ •๋ณด - -#### Errors - -- 400 "Bad request" -- 404 "id does not exist" -- 500 "internal server error" - -### `/getAllRoom` **(GET)** (for dev) - -๋ชจ๋“  ๋ฐฉ ๊ฐ€์ ธ์˜ด - -### `/removeAllRoom` **(GET)** (for dev) - -๋ชจ๋“  ๋ฐฉ ์‚ญ์ œ - -### `/:id/delete/` **(GET)** **(for dev)** - -ID๋ฅผ ๋ฐ›์•„ ํ•ด๋‹น ID์˜ room์„ ์ œ๊ฑฐ - -#### URL Parameters - -- id : ์‚ญ์ œํ•  room์˜ ID - -#### Response - -```javascript -{ - id: ObjectId, // ์‚ญ์ œํ•  ๋ฐฉ Document์˜ ObjectId - isDeleted: true -} -``` - -#### Errors - -- 404 "ID does not exist" -- 500 "Internal server error" \ No newline at end of file From b20e362daf1435309f84ba46850723c6a087eacd Mon Sep 17 00:00:00 2001 From: static Date: Sat, 3 Feb 2024 15:39:56 +0900 Subject: [PATCH 107/108] Refactor: use sessionMiddleware directly --- src/modules/socket.js | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/modules/socket.js b/src/modules/socket.js index 312a6b77..38da23d5 100644 --- a/src/modules/socket.js +++ b/src/modules/socket.js @@ -235,37 +235,13 @@ const emitUpdateEvent = async (io, roomId) => { // https://socket.io/how-to/use-with-express-session ์ฐธ๊ณ  const startSocketServer = (server) => { const io = new Server(server, { - allowRequest: (req, callback) => { - const fakeRes = { - getHeader() { - return []; - }, - setHeader(key, values) { - req.cookieHolder = values[0]; - }, - writeHead() {}, - }; - sessionMiddleware(req, fakeRes, () => { - if (req.session) { - fakeRes.writeHead(); - req.session.save(); - } - callback(null, true); - }); - }, cors: { origin: corsWhiteList, methods: ["GET", "POST"], credentials: true, }, }); - - io.engine.on("initial_headers", (headers, req) => { - if (req.cookieHolder) { - headers["set-cookie"] = req.cookieHolder; - delete req.cookieHolder; - } - }); + io.engine.use(sessionMiddleware); io.on("connection", (socket) => { try { From a60fc1d055a9be4686e9c16a7fe8d5ded9291f7f Mon Sep 17 00:00:00 2001 From: Dongwon Choi Date: Mon, 5 Feb 2024 15:50:25 +0000 Subject: [PATCH 108/108] Docs: fix required --- src/routes/docs/roomsSchema.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/routes/docs/roomsSchema.js b/src/routes/docs/roomsSchema.js index 0cbe79b5..e256c5dd 100644 --- a/src/routes/docs/roomsSchema.js +++ b/src/routes/docs/roomsSchema.js @@ -3,13 +3,22 @@ const { objectIdPattern, roomsPattern } = require("./utils"); const participantSchema = { part: { type: "object", - required: ["user", "settlementStatus", "readAt"], + required: ["_id", "name", "nickname", "profileImageUrl", "readAt"], properties: { - user: { + _id: { type: "string", pattern: objectIdPattern, }, - settlementStatus: { + name: { + type: "string", + }, + nickname: { + type: "string", + }, + profileImageUrl: { + type: "string", + }, + isSettlement: { type: "string", enum: ["not-departed", "paid", "send-required", "sent"], default: "not-departed", @@ -30,9 +39,10 @@ const roomsSchema = { "from", "to", "time", + "part", "madeat", - "settlementTotal", "maxPartLength", + "isDeparted", ], properties: { name: { @@ -59,13 +69,19 @@ const roomsSchema = { type: "string", format: "date-time", }, + maxPartLength: { + type: "integer", + default: 4, + }, settlementTotal: { type: "integer", default: 0, }, - maxPartLength: { - type: "integer", - default: 4, + isOver: { + type: "boolean", + }, + isDeparted: { + type: "boolean", }, }, },