diff --git a/message-queue/package-lock.json b/message-queue/package-lock.json index fa5b4cccad..70ecfbb17e 100644 --- a/message-queue/package-lock.json +++ b/message-queue/package-lock.json @@ -1,5 +1,5 @@ { - "name": "app", + "name": "message-queue", "lockfileVersion": 3, "requires": true, "packages": { @@ -11,7 +11,7 @@ "cors": "^2.8.5", "dotenv": "^16.4.5", "express": "^4.21.1", - "nodemon": "^3.1.7", + "mongodb": "^6.10.0", "tsc-watch": "^6.2.0" }, "devDependencies": { @@ -33,6 +33,14 @@ "node": ">=0.8" } }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz", + "integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==", + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, "node_modules/@types/amqplib": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/@types/amqplib/-/amqplib-0.10.5.tgz", @@ -137,6 +145,19 @@ "@types/send": "*" } }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", + "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" + }, + "node_modules/@types/whatwg-url": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz", + "integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -163,39 +184,11 @@ "node": ">=10" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, - "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/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -232,24 +225,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "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/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dependencies": { - "fill-range": "^7.1.1" - }, + "node_modules/bson": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.9.0.tgz", + "integrity": "sha512-X9hJeyeM0//Fus+0pc5dSUMhhrrmWwQUtdavaQeF3Ta6m69matZkGWV/MrBcnwUeLC8W9kwwc2hfkZgUuCX3Ig==", "engines": { - "node": ">=8" + "node": ">=16.20.1" } }, "node_modules/buffer-more-ints": { @@ -283,34 +264,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -589,17 +542,6 @@ } ] }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/finalhandler": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", @@ -651,19 +593,6 @@ "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -690,17 +619,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -712,14 +630,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, "node_modules/has-property-descriptors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", @@ -790,11 +700,6 @@ "node": ">=0.10.0" } }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==" - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -808,44 +713,6 @@ "node": ">= 0.10" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "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/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -869,6 +736,11 @@ "node": ">= 0.6" } }, + "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==" + }, "node_modules/merge-descriptors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", @@ -915,15 +787,58 @@ "node": ">= 0.6" } }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/mongodb": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.10.0.tgz", + "integrity": "sha512-gP9vduuYWb9ZkDM546M+MP2qKVk5ZG2wPF63OvSRuUbqCR+11ZCAE1mOfllhlAG0wcoJY5yDL/rV3OmYEwXIzg==", "dependencies": { - "brace-expansion": "^1.1.7" + "@mongodb-js/saslprep": "^1.1.5", + "bson": "^6.7.0", + "mongodb-connection-string-url": "^3.0.0" }, "engines": { - "node": "*" + "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 + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz", + "integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==", + "dependencies": { + "@types/whatwg-url": "^11.0.2", + "whatwg-url": "^13.0.0" } }, "node_modules/ms": { @@ -944,41 +859,6 @@ "resolved": "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz", "integrity": "sha512-qN8v/s2PAJwGUtr1/hYTpNKlD6Y9rc4p8KSmJXyGdYGZsDGKXrGThikLFP9OCHFeLeEpQzPwiAtdIvBLqm//Hw==" }, - "node_modules/nodemon": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.7.tgz", - "integrity": "sha512-hLj7fuMow6f0lbB0cD14Lz2xNjwsyruH251Pk4t/yIitCFJbmY1myuLlHm/q06aST4jg6EgAh74PIBBrRqpVAQ==", - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^4", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^7.5.3", - "simple-update-notifier": "^2.0.0", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -1038,17 +918,6 @@ "through": "~2.3" } }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -1075,10 +944,13 @@ "node": ">= 0.10" } }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "engines": { + "node": ">=6" + } }, "node_modules/qs": { "version": "6.13.0", @@ -1132,17 +1004,6 @@ "string_decoder": "~0.10.x" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -1158,17 +1019,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/send": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", @@ -1284,15 +1134,12 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/simple-update-notifier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", - "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "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==", "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" + "memory-pager": "^1.0.2" } }, "node_modules/split": { @@ -1335,33 +1182,11 @@ "node": ">=0.6.19" } }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -1370,12 +1195,15 @@ "node": ">=0.6" } }, - "node_modules/touch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", - "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", - "bin": { - "nodetouch": "bin/nodetouch.js" + "node_modules/tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "dependencies": { + "punycode": "^2.3.0" + }, + "engines": { + "node": ">=14" } }, "node_modules/tsc-watch": { @@ -1422,11 +1250,6 @@ "node": ">=14.17" } }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" - }, "node_modules/undici-types": { "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", @@ -1465,6 +1288,26 @@ "node": ">= 0.8" } }, + "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": "13.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", + "dependencies": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/message-queue/package.json b/message-queue/package.json index 64f8f131ca..b30fe2f3e8 100644 --- a/message-queue/package.json +++ b/message-queue/package.json @@ -11,7 +11,7 @@ "cors": "^2.8.5", "dotenv": "^16.4.5", "express": "^4.21.1", - "nodemon": "^3.1.7", + "mongodb": "^6.10.0", "tsc-watch": "^6.2.0" }, "devDependencies": { diff --git a/message-queue/src/constants.ts b/message-queue/src/constants.ts index 22937f7c46..8aa23a21ba 100644 --- a/message-queue/src/constants.ts +++ b/message-queue/src/constants.ts @@ -1,9 +1,11 @@ export const DIFFICULTY_QUEUE = "DIFFICULTY_QUEUE"; export const DIFFICULTY_ROUTING_KEY = "difficulty"; export const EXCHANGE = "difficulty_exchange" -export const HARD_ROUTING_KEY = "HARD_QUEUE"; -export const MEDIUM_ROUTING_KEY = "MEDIUM_QUEUE"; -export const EASY_ROUTING_KEY = "EASY_QUEUE"; +export const COLLAB_EXCHANGE = "collab_exchange" +export const COLLAB_KEY = "collab" +export const HARD_ROUTING_KEY = "hard_queue"; +export const MEDIUM_ROUTING_KEY = "medium_queue"; +export const EASY_ROUTING_KEY = "easy_queue"; export const HARD = "Hard"; export const MEDIUM = "Medium"; export const EASY = "Easy"; diff --git a/message-queue/src/db.js b/message-queue/src/db.js new file mode 100644 index 0000000000..a205c965a3 --- /dev/null +++ b/message-queue/src/db.js @@ -0,0 +1,25 @@ +import { MongoClient } from "mongodb" + +const MONGODB_URI = process.env.MONGODB_URI || "mongodb://localhost:27017" +const DB_NAME = "matchmakingDB" + +let db +const connectToMongoDB = async () => { + if (db) { + return db + } + + try { + const client = await MongoClient.connect(MONGODB_URI, { + useNewUrlParser: true, + useUnifiedTopology: true + }) + db = client.db(DB_NAME) + console.log("Connected to MongoDB") + return db + } catch (err) { + console.error("Failed to connect to MongoDB", err) + throw err + } +} +export { connectToMongoDB, db } diff --git a/message-queue/src/helper.ts b/message-queue/src/helper.ts index d83ac18f7e..5790e2ffc7 100644 --- a/message-queue/src/helper.ts +++ b/message-queue/src/helper.ts @@ -1,16 +1,9 @@ -export const getRandomIntegerInclusive = (min, max) => { - min = Math.ceil(min) - max = Math.floor(max) +import crypto from "crypto" - return Math.floor(Math.random() * (max - min + 1)) + min -} - -export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)) +import { UserData } from "./types" -export const deepEqual = (x, y) => { - return (x && y && typeof x === 'object' && typeof y === 'object') ? - (Object.keys(x).length === Object.keys(y).length) && - Object.keys(x).reduce(function(isEqual, key) { - return isEqual && deepEqual(x[key], y[key]); - }, true) : (x === y); - } \ No newline at end of file +export const generateSessionId = (user1Id: UserData, user2Id: UserData) => { + const combinedId = [user1Id.user_id, user2Id.user_id].sort().join("-") // e.g. user1-user2 + const sessionId = crypto.createHash("sha256").update(combinedId).digest("hex") + return sessionId +} diff --git a/message-queue/src/index.ts b/message-queue/src/index.ts index 3563fdaa90..4b16eedbec 100644 --- a/message-queue/src/index.ts +++ b/message-queue/src/index.ts @@ -1,11 +1,13 @@ -import amqp, { Channel, Connection, ConsumeMessage } from "amqplib" +import amqp, { Channel, Connection } from "amqplib" import cors from "cors" import dotenv from "dotenv" import express, { Express, Request, Response } from "express" +import { ChangeStream } from "mongodb" -import { DIFFICULTY_QUEUE_MAPPING, DIFFICULTY_ROUTING_KEYS, DIFFICULTY_ROUTING_MAPPING, EXCHANGE } from "./constants" -import { deepEqual, getRandomIntegerInclusive, sleep } from "./helper" -import { UserData } from "./types" +import { COLLAB_EXCHANGE, COLLAB_KEY, EXCHANGE } from "./constants" +import { connectToMongoDB, db } from "./db" +import { generateSessionId } from "./helper" +import { CollabExchangeData, UserData } from "./types" const app: Express = express() @@ -14,17 +16,15 @@ dotenv.config() app.use(express.json()) app.use(cors()) -let users: UserData[] = [] - let connection: Connection, channel: Channel +const amqpServer = process.env.AMQP_SERVER const connectRabbitMQ = async () => { try { - const amqpServer = process.env.AMQP_SERVER - console.log(amqpServer) connection = await amqp.connect(amqpServer) channel = await connection.createChannel() await channel.assertExchange(EXCHANGE, "topic", { durable: true }) + await channel.assertExchange(COLLAB_EXCHANGE, "direct", { durable: true }) console.log("Connected to RabbitMQ") } catch (err) { console.error(err) @@ -32,370 +32,217 @@ const connectRabbitMQ = async () => { } connectRabbitMQ() +connectToMongoDB() -const handleIncomingNotification = (msg: string) => { - try { - const parsedMessage = JSON.parse(msg) - - // console.log(`Received Notification`, parsedMessage) - users.push(parsedMessage) - console.log(">>USERS: ", users) - return parsedMessage - } catch (error) { - console.error(`Error while parsing the message`) - } -} - -// Decide again if needs to be asynchronous -const addDataToExchange = (userData: UserData, key: string) => { - channel.publish(EXCHANGE, key, Buffer.from(JSON.stringify(userData))) +const addDataToCollabExchange = (data: CollabExchangeData, key: string) => { + channel.publish(COLLAB_EXCHANGE, key, Buffer.from(JSON.stringify(data))) } -const pullDataFromExchange = async (queueName: string) => { - let message: amqp.ConsumeMessage - await channel.assertQueue(queueName, { - durable: true - }) +let waitingUsers: { [key: string]: (data: any) => void } = {} - await channel.consume(queueName, (msg) => { - if (!msg) { - return console.error("Invalid incoming message") - } - message = msg - try { - handleIncomingNotification(msg?.content?.toString()) - channel.ack(msg) - } catch (e) { - console.log("Invalid message received") - console.error(e) - return { - channel, - message: "" - } +const matchUsers = async (userData: any, key: string): Promise<{ matchedUsers: any[] }> => { + let changeStream: ChangeStream = null + try { + // Check for a matching user in the queue based on difficulty and topic + const matchQuery = { + difficulty: userData.difficulty, + topic: userData.topic, + user_id: { $ne: userData.user_id } // Exclude the current user } - }) - return { - channel, - message - } -} - -const matchUsers = async (userData: UserData, key: string) => { - let matchedUsers: UserData[] = [] + // Match on both difficulty and topic first + let matchedUser = await db.collection("usersQueue").findOne(matchQuery) - let filteredUsers: UserData[] = users.filter((user: UserData) => { - return user.user_id !== userData.user_id - }) - - matchedUsers.push(userData) - - // Case 3: Only 1 person in the queue - let timeWaitedForMessage = 0 - let currentTotalUsersWaiting = users.length - - console.log(">>USER LENGTH: ", filteredUsers.length) - - if (filteredUsers.length == 0) { - const waitForNewMessagesInterval = setInterval(async () => { - timeWaitedForMessage += 2 - console.log(userData.user_id + ": Time waited for message Case 3: ", timeWaitedForMessage) - if (timeWaitedForMessage == 30 || users.length != currentTotalUsersWaiting) { - clearInterval(waitForNewMessagesInterval) - } - }, 2000) + if (!matchedUser) { + console.log("Step 1.1: No exact match found, checking for difficulty only") + const difficultyOnlyQuery = { + difficulty: userData.difficulty, + user_id: { $ne: userData.user_id } // Exclude the current user + } + matchedUser = await db.collection("usersQueue").findOne(difficultyOnlyQuery) + } - while (timeWaitedForMessage < 30 && users.length == currentTotalUsersWaiting) { - await sleep(1000) + if (!matchedUser) { + console.log("Step 1: No exact match found, checking for topic only") + const topicOnlyQuery = { + topic: userData.topic, + user_id: { $ne: userData.user_id } // Exclude the current user } - - filteredUsers = users.filter((user: UserData) => { - return user.user_id !== userData.user_id - }) + matchedUser = await db.collection("usersQueue").findOne(topicOnlyQuery) + } - // Means if new users have been added to the overall queue - if (currentTotalUsersWaiting != filteredUsers.length) { - for (const user of filteredUsers) { - if (user.topic == userData.topic && user.user_id != userData.user_id) { - matchedUsers.push(user) - break - } - } + if (matchedUser) { + console.log("Step 2: Match found, notifying both users") + await db.collection("usersQueue").deleteOne({ user_id: matchedUser.user_id }) + await db.collection("usersQueue").deleteOne({ user_id: userData.user_id }) - // Possible that there isn't a perfect match - // In that case jump to next if statement - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false - } - } + const matchedResponse = { + matchedUsers: [userData, matchedUser] } - if (filteredUsers.length > 0) { - console.log("Reach the default route") - // Filter one more level (Obtain users that are of the requested difficulty, try) - // To try and match on difficulty at least (tie-break) - const filteredUsersForDesiredDifficulty = filteredUsers.filter((user: UserData) => { - return DIFFICULTY_ROUTING_MAPPING[key] == user.difficulty - }) - - - let nextUser: UserData - if (filteredUsersForDesiredDifficulty.length > 0) { - const randomlySelectedIndex = getRandomIntegerInclusive(0, filteredUsersForDesiredDifficulty.length - 1) - nextUser = filteredUsersForDesiredDifficulty[randomlySelectedIndex] - const userIdxOriginalArr = filteredUsers.findIndex((user) => deepEqual(nextUser, user)) - filteredUsers.splice(userIdxOriginalArr, 1) - } else { - const randomlySelectedIndex = getRandomIntegerInclusive(0, filteredUsers.length - 1) - nextUser = filteredUsers.splice(randomlySelectedIndex, 1)[0] - } + if (waitingUsers[userData.user_id]) { + waitingUsers[userData.user_id](matchedResponse) + delete waitingUsers[userData.user_id] + } + if (waitingUsers[matchedUser.user_id]) { + waitingUsers[matchedUser.user_id](matchedResponse) + delete waitingUsers[matchedUser.user_id] + } - // if (nextUser.user_id == userData.user_id) { - // return { - // matchedUsers: [], // don't allow 2 same user to match - // timeout: true - // } - // } - matchedUsers.push(nextUser) - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false - } - } else { - return { - matchedUsers: [], // don't allow 2 same user to match - timeout: true - } - } - } else { - console.log("Reach the filtered route") - // Try to pull data from other difficulty queues - const filteredQueueNames = DIFFICULTY_ROUTING_KEYS.filter((routeKey) => { - return routeKey != key - }) - - for (const queueName of filteredQueueNames) { - await pullDataFromExchange(queueName as string) - } + return matchedResponse + } - filteredUsers = users.filter((user: UserData) => { - return user.user_id !== userData.user_id - }) + const existingUser = await db.collection("usersQueue").findOne({ user_id: userData.user_id }) + if (!existingUser) { + console.log("Step 3: No existing entry, adding user to queue") + await db.collection("usersQueue").insertOne(userData) + } else { + console.log("Step 3: User already exists in the queue, skipping insert") + return { matchedUsers: [] } + } - for (const user of filteredUsers) { - console.log(user.topic + " " + userData.topic) - console.log(user.user_id + " " + userData.user_id) - if (user.topic == userData.topic && user.user_id != userData.user_id) { - matchedUsers.push(user) - break + // **Create Change Stream and Handle Event** + return new Promise((resolve) => { + waitingUsers[userData.user_id] = resolve + + const timer = setInterval(async () => { + console.log("Step 4: Timeout reached, removing user from queue") + await db.collection("usersQueue").deleteOne({ user_id: userData.user_id }) + resolve({ matchedUsers: [] }) + delete waitingUsers[userData.user_id] + + // Close change stream on timeout + if (changeStream) { + try { + console.log("Closing change stream on timeout") + changeStream.close() + } catch (e) { + console.error(e) + return { matchedUsers: [] } } } + }, 30000) + + // **Create the change stream and manage lifecycle** + changeStream = db.collection("usersQueue").watch() + changeStream.on("change", async (change) => { + console.log("Step 5: Change detected", change.operationType) + + if (change.operationType === "insert") { + const newUser = change.fullDocument + + if ( + newUser.difficulty === userData.difficulty && + newUser.topic === userData.topic && + newUser.user_id !== userData.user_id // Avoid matching with oneself + ) { + console.log("Step 5.1: Match found through change stream") + clearInterval(timer) + await db.collection("usersQueue").deleteOne({ user_id: newUser.user_id }) + await db.collection("usersQueue").deleteOne({ user_id: userData.user_id }) + + const matchedResponse = { + matchedUsers: [userData, newUser] + } - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false + if (waitingUsers[userData.user_id]) { + waitingUsers[userData.user_id](matchedResponse) + delete waitingUsers[userData.user_id] + } + if (waitingUsers[newUser.user_id]) { + waitingUsers[newUser.user_id](matchedResponse) + delete waitingUsers[newUser.user_id] } - } - // Timeout, cannot find match; assumes matchedUsers.length != 2 - return { - matchedUsers: [], - timeout: true + // **Close the change stream once a match is found** + if (changeStream) { + console.log("Closing change stream after match") + changeStream.close() + } + } + } else { + clearInterval(timer) + // **Close the change stream once a match is found** + if (changeStream) { + console.log("Closing change stream after delete event") + changeStream.close() + } } - } - } + }) + }) + } catch (error) { + console.error("Error in matchUsers:", error) - for (const user of filteredUsers) { - console.log("Reached Case 1") - // Case (1) - 2 people in queue have matching topic - if (user.topic == userData.topic && user.user_id != userData.user_id) { - matchedUsers.push(user) - break - } + // **Ensure the change stream is closed on error** + if (changeStream) { + console.log("Closing change stream on error") + changeStream.close() } - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false - } - } + return { matchedUsers: [] } + } +} - // Case (2) -> 1 person in queue, non matched topic so far - timeWaitedForMessage = 0 - currentTotalUsersWaiting = users.length - const waitForNewMessagesInterval = setInterval(async () => { - timeWaitedForMessage += 2 - console.log("Time waited for message Case 2: ", timeWaitedForMessage) - if (timeWaitedForMessage == 30 || users.length != currentTotalUsersWaiting) { - clearInterval(waitForNewMessagesInterval) - } - }, 2000) +app.post("/match", async (req: Request, res: Response) => { + const { userData, key } = req.body - while (timeWaitedForMessage < 30 && users.length == currentTotalUsersWaiting) { - await sleep(1000) - } + try { + console.log("Data Sent: ", req.body) - filteredUsers = users.filter((user: UserData) => { - return user.user_id !== userData.user_id - }) + const MAX_WAIT_TIME = 30000 + let matchFound = false + let response = { matchedUsers: [] } - // Check currentTotalUsersWaiting with current user's length - // If different, means new user added - if (currentTotalUsersWaiting != filteredUsers.length) { - for (const user of filteredUsers) { - if (user.topic == userData.topic && user.user_id != userData.user_id) { - matchedUsers.push(user) + const waitForMatch = async () => { + const startTime = Date.now() + while (Date.now() - startTime < MAX_WAIT_TIME && !matchFound) { + response = (await matchUsers(userData, key)) as { matchedUsers: UserData[] } + if (response.matchedUsers.length === 2) { + matchFound = true break } - } - - // Possible that there isn't a perfect match - // In that case jump to next if statement - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false - } + await new Promise((resolve) => setTimeout(resolve, 1000)) } } - if (filteredUsers.length > 0) { - // If still stuck with the same number of people - // Randomly match amongst current users - console.log("Randomly matched amongst current users case 3") + await waitForMatch() - // Filter one more level (Obtain users that are of the requested difficulty, try) - // To try and match on difficulty at least (tie-break) - const filteredUsersForDesiredDifficulty = filteredUsers.filter((user: UserData) => { - return DIFFICULTY_ROUTING_MAPPING[key] == user.difficulty - }) + if (response.matchedUsers.length === 2) { + const matchedUserIds = response.matchedUsers.map((user) => user.user_id) + await db.collection("usersQueue").deleteMany({ user_id: { $in: matchedUserIds } }) - let nextUser: UserData - if (filteredUsersForDesiredDifficulty.length > 0) { - const randomlySelectedIndex = getRandomIntegerInclusive(0, filteredUsersForDesiredDifficulty.length - 1) - nextUser = filteredUsersForDesiredDifficulty[randomlySelectedIndex] - const userIdxOriginalArr = filteredUsers.findIndex((user) => deepEqual(nextUser, user)) - filteredUsers.splice(userIdxOriginalArr, 1) - } else { - const randomlySelectedIndex = getRandomIntegerInclusive(0, filteredUsers.length - 1) - nextUser = filteredUsers.splice(randomlySelectedIndex, 1)[0] + delete waitingUsers[response.matchedUsers[0].user_id] + delete waitingUsers[response.matchedUsers[1].user_id] + const sessionId = generateSessionId(response.matchedUsers[0], response.matchedUsers[1]) + const dataToExchange: CollabExchangeData = { + matchedUsers: response.matchedUsers, + sessionId: sessionId } - matchedUsers.push(nextUser) - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false - } - } else { - return { - matchedUsers: [], // don't allow 2 same user to match - timeout: true - } + if (userData === response.matchedUsers[0]) { + // First user in response.matchedUser to push to Collab exchange + addDataToCollabExchange(dataToExchange, COLLAB_KEY) //Send to exchange } - } else { - // Try to pull data from other difficulty queues - console.log("Checking other queues") - const filteredQueueNames = DIFFICULTY_ROUTING_KEYS.filter((routeKey) => { - return routeKey != key + res.json({ + matchedUsers: response.matchedUsers, + sessionId: sessionId, + timeout: false }) - - for (const queueName of filteredQueueNames) { - await pullDataFromExchange(queueName as string) - } - - for (const user of filteredUsers) { - if (user.topic == userData.topic && user.user_id != userData.user_id) { - matchedUsers.push(user) - break - } - - if (matchedUsers.length == 2) { - return { - matchedUsers, - timeout: false - } - } - } - - // Timeout, cannot find match; assumes matchedUsers.length != 2 - return { + } else { + await db.collection("usersQueue").deleteOne({ user_id: userData.user_id }) + res.json({ matchedUsers: [], timeout: true - } - } -} - - - -// Publish message to exchange -app.post("/match", async (req: Request, res: Response) => { - try { - const { userData, key } = req.body //key-value pair of userData will be . - addDataToExchange(userData, key) - console.log("Data Sent: ", req.body) - - await pullDataFromExchange(DIFFICULTY_QUEUE_MAPPING[key]) - const response = await matchUsers(userData, key) - //Remove the 2 matched users from backend - if (response.matchedUsers.length == 2) { - users = users.filter((user) => { - return user.user_id != response.matchedUsers[0].user_id - }) - users = users.filter((user) => { - return user.user_id != response.matchedUsers[1].user_id - }) - } else { - //Remove user if no match found after 30s - users = users.filter((user) => { - return user.user_id != userData.user_id }) - //console.log("Length of users: " + users.length) } - - console.log("SUCCESSFUL MATCH: " + JSON.stringify(response.matchedUsers)) - - // Timeout, cannot find match; assumes matchedUsers.length != 2 - res.json(response) - - } catch (e) { - console.error("Message incorrectly sent out") - console.error(e) - res.json({ + } catch (error) { + console.error("Error while matching:", error) + res.status(500).json({ matchedUsers: [], timeout: true }) } }) -app.post("/match/delete", (req: Request, res: Response) => { - users = users.filter((user) => { - return user.user_id != req.body.user_id - }) - - res.json({ - "message": "User removed from the queue" - }) -}) - -app.use((req: Request, res: Response, next) => { - const error: Error = new Error("Route Not Found") - next(error) -}) - -app.use((error, req: Request, res: Response, next) => { - res.status(error.status || 500) - res.json({ - error: { - message: error.message - } - }) -}) - app.listen(3002, () => { - console.log("Publisher running.") -}) \ No newline at end of file + console.log("Matching service running.") +}) diff --git a/message-queue/src/types/index.ts b/message-queue/src/types/index.ts index 09e4a4d234..63fe5d85bf 100644 --- a/message-queue/src/types/index.ts +++ b/message-queue/src/types/index.ts @@ -1,5 +1,11 @@ export interface UserData { - difficulty: string - topic: string - user_id: string -} \ No newline at end of file + difficulty: string + topic: string + user_id: string + username: string +} + +export type CollabExchangeData = { + matchedUsers: UserData[] + sessionId: string +} diff --git a/peer-prep-fe/src/app/constants/queue-constants.ts b/peer-prep-fe/src/app/constants/queue-constants.ts index c4d949b9d6..591ab5a07f 100644 --- a/peer-prep-fe/src/app/constants/queue-constants.ts +++ b/peer-prep-fe/src/app/constants/queue-constants.ts @@ -5,7 +5,7 @@ export const QUEUE_NAMES = { }; export const DIFFICULTY = { - EASY: 'EASY', - MEDIUM: 'MEDIUM', - HARD: 'HARD' + EASY: 'Easy', + MEDIUM: 'Medium', + HARD: 'Hard' }; \ No newline at end of file diff --git a/peer-prep-fe/src/components/search-and-filter/search-and-filter.component.css b/peer-prep-fe/src/components/search-and-filter/search-and-filter.component.css index 1f09c886cd..0e92de5945 100644 --- a/peer-prep-fe/src/components/search-and-filter/search-and-filter.component.css +++ b/peer-prep-fe/src/components/search-and-filter/search-and-filter.component.css @@ -69,15 +69,12 @@ button[type="submit"]:hover { background-color: transparent; z-index: 1; width: 100%; - font-family: 'Signika Negative', sans-serif; + font-family: "Signika Negative", sans-serif; border-radius: 10px; border-radius: 0 0 10px 10px; top: 100%; - left: 0; - padding: 6px 15px; - - /* border-radius: 10px; - padding: 6px 15px; */ + left: 0px; + /* padding: 6px 15px; */ } .filter-container:hover .dropdown-content { @@ -93,18 +90,15 @@ button[type="submit"]:hover { /* Styling for buttons inside dropdowns */ .dropdown-btn { - color: #FFF; - padding: 8px 12px; + color: #fff; + width: 100%; + padding: 8px 8px; text-decoration: none; - display: block; - /* margin-top: 1px; */ + text-align: center; background-color: #414141; - width: 100%; - font-family: 'Signika Negative', sans-serif; - font-size: 0.8rem; - padding: 10px 10px; + font-family: "Signika Negative", sans-serif; + font-size: 0.75rem; border: none; - } .dropdown-btn:hover { @@ -112,7 +106,6 @@ button[type="submit"]:hover { color: #000; } - /* #button:last-child { margin-right: 0; diff --git a/peer-prep-fe/src/landing-page/landing-page.component.html b/peer-prep-fe/src/landing-page/landing-page.component.html index e76d4bfc4c..0c520cb28f 100644 --- a/peer-prep-fe/src/landing-page/landing-page.component.html +++ b/peer-prep-fe/src/landing-page/landing-page.component.html @@ -8,9 +8,9 @@

PICK 1 DIFFICULTY & AT LEAST 1 TOPIC.

- - - + + +

diff --git a/peer-prep-fe/src/landing-page/landing-page.component.ts b/peer-prep-fe/src/landing-page/landing-page.component.ts index 40a56fe0c7..0574b054cf 100644 --- a/peer-prep-fe/src/landing-page/landing-page.component.ts +++ b/peer-prep-fe/src/landing-page/landing-page.component.ts @@ -77,7 +77,8 @@ export class LandingPageComponent { // ================================================= async findMatch() { - // const selectedTopic = this.question_categories.filter(topic => topic.selected).map(topic => topic.name); + // const selectedTopic = this.question_categories.filter(topic => topic.selected).map(topic => topic.name);) + console.log("tell me the fucking difficulty: ", this.selectedDifficulty) const userData = { difficulty: this.selectedDifficulty || '', topic: this.selectedCategory || '',