From 15e085e7b46e64a4703310cc53804581b29ec429 Mon Sep 17 00:00:00 2001 From: Lara Date: Fri, 26 Apr 2024 13:31:58 +0200 Subject: [PATCH 01/39] Comprobar que el usuario no esta repetido al crear cuenta --- gatewayservice/gateway-service.js | 34 ++- userservice/userservice/package-lock.json | 267 ++++++++++++++++++++++ userservice/userservice/user-service.js | 13 ++ webapp/src/components/AddUser.js | 24 +- 4 files changed, 319 insertions(+), 19 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 5dff392..918b9df 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -37,27 +37,16 @@ app.post('/login', async (req, res) => { } }); - -function validateCredentials(username, password) { - // Verifica si la contraseña es erronea - if (password.length < 8) { - return false; - } - - return true; -} - app.post('/adduser', async (req, res) => { - - const isValidUser = validateCredentials(req.body.username, req.body.password); + try { + const { username, password, valido, mensajeError } = req.body; - if (!isValidUser) { - // Si las credenciales son inválidas, devuelve un error 401 - res.status(401).json({ error: 'Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres' }); - return; // Termina la ejecución de la función para evitar ejecutar el código restante - } + if (!valido) { + // Si las credenciales son inválidas, devuelve un error 401 + res.status(401).json({ error: mensajeError }); + return; // Termina la ejecución de la función para evitar ejecutar el código restante + } - try { // Forward the add user request to the user service const userResponse = await axios.post(userServiceUrl+'/adduser', req.body); res.json(userResponse.data); @@ -110,6 +99,15 @@ app.get('/getUserData', async (req, res) => { } }); +app.get('/getUsernames', async (req, res) => { + try{ + const getUserDataResponse = await axios.get(userServiceUrl+ `/getUsernames`) + res.json(getUserDataResponse.data); + }catch(error){ + res.status(error.response.status).json({error: error.response.data.error}); + } +}); + // Read the OpenAPI YAML file synchronously let openapiPath='./openapi.yaml'; if (fs.existsSync(openapiPath)) { diff --git a/userservice/userservice/package-lock.json b/userservice/userservice/package-lock.json index f9148b3..4b4db8a 100644 --- a/userservice/userservice/package-lock.json +++ b/userservice/userservice/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "userservice", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -12,6 +13,7 @@ "body-parser": "^1.20.2", "dotenv": "^16.4.5", "express": "^4.18.2", + "express-prom-bundle": "^7.0.0", "mongodb": "^6.5.0", "mongoose": "^8.0.4" }, @@ -1122,6 +1124,15 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1187,6 +1198,45 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1196,6 +1246,11 @@ "@types/node": "*" } }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1220,6 +1275,11 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "node_modules/@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -1228,6 +1288,35 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1555,6 +1644,12 @@ "node": ">= 10.0.0" } }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -2251,6 +2346,23 @@ "node": ">= 0.10.0" } }, + "node_modules/express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "dependencies": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prom-client": ">=15.0.0" + } + }, "node_modules/express/node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -4552,6 +4664,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -5177,6 +5302,15 @@ "streamx": "^2.15.0" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -5319,6 +5453,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6358,6 +6500,12 @@ "sparse-bitfield": "^3.0.3" } }, + "@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true + }, "@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -6423,6 +6571,45 @@ "@babel/types": "^7.20.7" } }, + "@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -6432,6 +6619,11 @@ "@types/node": "*" } }, + "@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -6456,6 +6648,11 @@ "@types/istanbul-lib-report": "*" } }, + "@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -6464,6 +6661,35 @@ "undici-types": "~5.26.4" } }, + "@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "requires": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -6729,6 +6955,12 @@ "node-addon-api": "^5.0.0" } }, + "bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -7259,6 +7491,17 @@ } } }, + "express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "requires": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + } + }, "fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -8882,6 +9125,16 @@ } } }, + "prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "requires": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + } + }, "prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -9342,6 +9595,15 @@ "streamx": "^2.15.0" } }, + "tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "requires": { + "bintrees": "1.0.2" + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -9434,6 +9696,11 @@ "picocolors": "^1.0.0" } }, + "url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/userservice/userservice/user-service.js b/userservice/userservice/user-service.js index 5fe4f2e..4b88f7f 100644 --- a/userservice/userservice/user-service.js +++ b/userservice/userservice/user-service.js @@ -83,6 +83,19 @@ app.get('/getUserData', async (req, res) => { } }); +app.get('/getUsernames', async (req, res) => { + try { + const users = await User.find(); + if (!users || users.length===0) { + return res.status(200).json({ success: true, message: 'No hay usuarios en la base de datos' }); + } + const usernames = users.map(user => user.username); + return res.status(200).json({ usernames }); + } catch (error) { + return res.status(500).json({ success: false, message: 'Error al obtener los datos de usuario' }); + } +}); + const server = app.listen(port, () => { console.log(`User Service listening at http://localhost:${port}`); }); diff --git a/webapp/src/components/AddUser.js b/webapp/src/components/AddUser.js index 0eadcac..f6eedb8 100644 --- a/webapp/src/components/AddUser.js +++ b/webapp/src/components/AddUser.js @@ -10,16 +10,38 @@ const AddUser = () => { const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [openSnackbar, setOpenSnackbar] = useState(false); + const [mensajeError, setMensajeError] =useState(''); const addUser = async () => { try { - await axios.post(`${apiEndpoint}/adduser`, { username, password }); + var valido = await validateCredentials(username, password); + await axios.post(`${apiEndpoint}/adduser`, { username, password, valido, mensajeError }); setOpenSnackbar(true); } catch (error) { setError(error.response.data.error); } }; + + + async function validateCredentials(username, password){ + try { + const response = await axios.get(`${apiEndpoint}/getUsernames`); + const usernames = response.data.usernames; + if (usernames.includes(username)){ + setMensajeError('Credenciales incorrectas. El nombre de usuario esta en uso') + return false; + } + if (password.length < 8) { + setMensajeError('Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres') + return false; + } + return true; + } catch (error) { + setError('Error al cargar la información'); + } + }; + const handleCloseSnackbar = () => { setOpenSnackbar(false); }; From 859d2323a8b8e42d05f7253c848eabc5c653a2f0 Mon Sep 17 00:00:00 2001 From: Lara Date: Fri, 26 Apr 2024 13:40:15 +0200 Subject: [PATCH 02/39] Intentando arreglar problemas de tests --- userservice/authservice/package-lock.json | 267 ++++++++++++++++++ .../userservice/authservice/package-lock.json | 35 +++ .../userservice/authservice/package.json | 5 + 3 files changed, 307 insertions(+) create mode 100644 userservice/authservice/userservice/authservice/package-lock.json create mode 100644 userservice/authservice/userservice/authservice/package.json diff --git a/userservice/authservice/package-lock.json b/userservice/authservice/package-lock.json index 24346ea..a9b862b 100644 --- a/userservice/authservice/package-lock.json +++ b/userservice/authservice/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "authservice", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -12,6 +13,7 @@ "body-parser": "^1.20.2", "dotenv": "^16.4.5", "express": "^4.18.2", + "express-prom-bundle": "^7.0.0", "jsonwebtoken": "^9.0.2", "mongodb": "^6.5.0", "mongoose": "^8.0.4" @@ -1114,6 +1116,15 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1179,6 +1190,45 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1188,6 +1238,11 @@ "@types/node": "*" } }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1212,6 +1267,11 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "node_modules/@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -1220,6 +1280,35 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1547,6 +1636,12 @@ "node": ">= 10.0.0" } }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -2253,6 +2348,23 @@ "node": ">= 0.10.0" } }, + "node_modules/express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "dependencies": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prom-client": ">=15.0.0" + } + }, "node_modules/express/node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -4628,6 +4740,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -5253,6 +5378,15 @@ "streamx": "^2.15.0" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -5395,6 +5529,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6426,6 +6568,12 @@ "sparse-bitfield": "^3.0.3" } }, + "@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true + }, "@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -6491,6 +6639,45 @@ "@babel/types": "^7.20.7" } }, + "@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -6500,6 +6687,11 @@ "@types/node": "*" } }, + "@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -6524,6 +6716,11 @@ "@types/istanbul-lib-report": "*" } }, + "@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -6532,6 +6729,35 @@ "undici-types": "~5.26.4" } }, + "@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "requires": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -6797,6 +7023,12 @@ "node-addon-api": "^5.0.0" } }, + "bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -7340,6 +7572,17 @@ } } }, + "express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "requires": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + } + }, "fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -9033,6 +9276,16 @@ } } }, + "prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "requires": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + } + }, "prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -9493,6 +9746,15 @@ "streamx": "^2.15.0" } }, + "tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "requires": { + "bintrees": "1.0.2" + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -9585,6 +9847,11 @@ "picocolors": "^1.0.0" } }, + "url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/userservice/authservice/userservice/authservice/package-lock.json b/userservice/authservice/userservice/authservice/package-lock.json new file mode 100644 index 0000000..8c66fd9 --- /dev/null +++ b/userservice/authservice/userservice/authservice/package-lock.json @@ -0,0 +1,35 @@ +{ + "name": "authservice", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "authservice": "file:../.." + } + }, + "../..": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "bcrypt": "^5.1.1", + "body-parser": "^1.20.2", + "dotenv": "^16.4.5", + "express": "^4.18.2", + "express-prom-bundle": "^7.0.0", + "jsonwebtoken": "^9.0.2", + "mongodb": "^6.5.0", + "mongoose": "^8.0.4" + }, + "devDependencies": { + "jest": "^29.7.0", + "mongodb-memory-server": "^9.1.5", + "supertest": "^6.3.4" + } + }, + "node_modules/authservice": { + "resolved": "../..", + "link": true + } + } +} diff --git a/userservice/authservice/userservice/authservice/package.json b/userservice/authservice/userservice/authservice/package.json new file mode 100644 index 0000000..81b6679 --- /dev/null +++ b/userservice/authservice/userservice/authservice/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "authservice": "file:../.." + } +} From 02b6454d8477d77aa329a8a412be4d74a6f187f1 Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra Date: Fri, 26 Apr 2024 13:43:14 +0200 Subject: [PATCH 03/39] Update package-lock falta dependencias --- docker-compose.yml | 10 +- userservice/authservice/package-lock.json | 267 ++++++++++++++++++++++ userservice/userservice/package-lock.json | 267 ++++++++++++++++++++++ 3 files changed, 539 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5005eae..6c53765 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: questionservice: container_name: questionservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_es05a/questionservice:latest + image: ghcr.io/arquisoft/wiq_5a/questionservice:latest profiles: ["dev", "prod"] build: ./questionservice ports: @@ -26,7 +26,7 @@ services: authservice: container_name: authservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_0/authservice:latest + image: ghcr.io/arquisoft/wiq_5a/authservice:latest profiles: ["dev", "prod"] build: ./userservice/authservice depends_on: @@ -40,7 +40,7 @@ services: userservice: container_name: userservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_0/userservice:latest + image: ghcr.io/arquisoft/wiq_5a/userservice:latest profiles: ["dev", "prod"] build: ./userservice/userservice depends_on: @@ -54,7 +54,7 @@ services: gatewayservice: container_name: gatewayservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_0/gatewayservice:latest + image: ghcr.io/arquisoft/wiq_5a/gatewayservice:latest profiles: ["dev", "prod"] build: ./gatewayservice depends_on: @@ -73,7 +73,7 @@ services: webapp: container_name: webapp-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_es05a/webapp:latest + image: ghcr.io/arquisoft/wiq_5a/webapp:latest profiles: ["dev", "prod"] build: ./webapp depends_on: diff --git a/userservice/authservice/package-lock.json b/userservice/authservice/package-lock.json index 24346ea..a9b862b 100644 --- a/userservice/authservice/package-lock.json +++ b/userservice/authservice/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "authservice", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -12,6 +13,7 @@ "body-parser": "^1.20.2", "dotenv": "^16.4.5", "express": "^4.18.2", + "express-prom-bundle": "^7.0.0", "jsonwebtoken": "^9.0.2", "mongodb": "^6.5.0", "mongoose": "^8.0.4" @@ -1114,6 +1116,15 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1179,6 +1190,45 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1188,6 +1238,11 @@ "@types/node": "*" } }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1212,6 +1267,11 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "node_modules/@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -1220,6 +1280,35 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1547,6 +1636,12 @@ "node": ">= 10.0.0" } }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -2253,6 +2348,23 @@ "node": ">= 0.10.0" } }, + "node_modules/express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "dependencies": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prom-client": ">=15.0.0" + } + }, "node_modules/express/node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -4628,6 +4740,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -5253,6 +5378,15 @@ "streamx": "^2.15.0" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -5395,6 +5529,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6426,6 +6568,12 @@ "sparse-bitfield": "^3.0.3" } }, + "@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true + }, "@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -6491,6 +6639,45 @@ "@babel/types": "^7.20.7" } }, + "@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -6500,6 +6687,11 @@ "@types/node": "*" } }, + "@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -6524,6 +6716,11 @@ "@types/istanbul-lib-report": "*" } }, + "@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -6532,6 +6729,35 @@ "undici-types": "~5.26.4" } }, + "@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "requires": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -6797,6 +7023,12 @@ "node-addon-api": "^5.0.0" } }, + "bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -7340,6 +7572,17 @@ } } }, + "express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "requires": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + } + }, "fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -9033,6 +9276,16 @@ } } }, + "prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "requires": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + } + }, "prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -9493,6 +9746,15 @@ "streamx": "^2.15.0" } }, + "tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "requires": { + "bintrees": "1.0.2" + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -9585,6 +9847,11 @@ "picocolors": "^1.0.0" } }, + "url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/userservice/userservice/package-lock.json b/userservice/userservice/package-lock.json index f9148b3..4b4db8a 100644 --- a/userservice/userservice/package-lock.json +++ b/userservice/userservice/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "userservice", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -12,6 +13,7 @@ "body-parser": "^1.20.2", "dotenv": "^16.4.5", "express": "^4.18.2", + "express-prom-bundle": "^7.0.0", "mongodb": "^6.5.0", "mongoose": "^8.0.4" }, @@ -1122,6 +1124,15 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1187,6 +1198,45 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1196,6 +1246,11 @@ "@types/node": "*" } }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1220,6 +1275,11 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "node_modules/@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -1228,6 +1288,35 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1555,6 +1644,12 @@ "node": ">= 10.0.0" } }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -2251,6 +2346,23 @@ "node": ">= 0.10.0" } }, + "node_modules/express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "dependencies": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prom-client": ">=15.0.0" + } + }, "node_modules/express/node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -4552,6 +4664,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -5177,6 +5302,15 @@ "streamx": "^2.15.0" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -5319,6 +5453,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6358,6 +6500,12 @@ "sparse-bitfield": "^3.0.3" } }, + "@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true + }, "@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -6423,6 +6571,45 @@ "@babel/types": "^7.20.7" } }, + "@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -6432,6 +6619,11 @@ "@types/node": "*" } }, + "@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -6456,6 +6648,11 @@ "@types/istanbul-lib-report": "*" } }, + "@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "@types/node": { "version": "20.10.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", @@ -6464,6 +6661,35 @@ "undici-types": "~5.26.4" } }, + "@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "requires": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -6729,6 +6955,12 @@ "node-addon-api": "^5.0.0" } }, + "bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -7259,6 +7491,17 @@ } } }, + "express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "requires": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + } + }, "fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -8882,6 +9125,16 @@ } } }, + "prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "requires": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + } + }, "prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -9342,6 +9595,15 @@ "streamx": "^2.15.0" } }, + "tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "requires": { + "bintrees": "1.0.2" + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -9434,6 +9696,11 @@ "picocolors": "^1.0.0" } }, + "url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", From 0506d98686ca3d3f45251a8d97516f0fd5836374 Mon Sep 17 00:00:00 2001 From: Lara Date: Fri, 26 Apr 2024 13:43:54 +0200 Subject: [PATCH 04/39] Mas arreglos --- questionservice/package-lock.json | 141 ++++++++++++++++++ .../questionservice/package-lock.json | 99 ++++++++++++ questionservice/questionservice/package.json | 5 + 3 files changed, 245 insertions(+) create mode 100644 questionservice/questionservice/package-lock.json create mode 100644 questionservice/questionservice/package.json diff --git a/questionservice/package-lock.json b/questionservice/package-lock.json index 8b60600..d120505 100644 --- a/questionservice/package-lock.json +++ b/questionservice/package-lock.json @@ -35,6 +35,7 @@ "escape-html": "^1.0.3", "etag": "^1.8.1", "express": "^4.18.3", + "express-prom-bundle": "^7.0.0", "finalhandler": "^1.2.0", "follow-redirects": "^1.15.5", "form-data": "^4.0.0", @@ -1008,6 +1009,15 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1066,6 +1076,45 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1074,6 +1123,11 @@ "@types/node": "*" } }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1095,6 +1149,11 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "node_modules/@types/node": { "version": "20.12.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", @@ -1103,6 +1162,35 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1328,6 +1416,12 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -2042,6 +2136,23 @@ "node": ">= 0.10.0" } }, + "node_modules/express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "dependencies": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prom-client": ">=15.0.0" + } + }, "node_modules/ext": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", @@ -3580,6 +3691,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -4069,6 +4193,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -4200,6 +4333,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", diff --git a/questionservice/questionservice/package-lock.json b/questionservice/questionservice/package-lock.json new file mode 100644 index 0000000..e90bc8d --- /dev/null +++ b/questionservice/questionservice/package-lock.json @@ -0,0 +1,99 @@ +{ + "name": "questionservice", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "questionservice": "file:.." + } + }, + "..": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "accepts": "^1.3.8", + "array-flatten": "^1.1.1", + "asynckit": "^0.4.0", + "axios": "^1.6.7", + "body-parser": "^1.20.2", + "bytes": "^3.1.2", + "call-bind": "^1.0.7", + "combined-stream": "^1.0.8", + "content-disposition": "^0.5.4", + "content-type": "^1.0.5", + "cookie": "^0.5.0", + "cookie-signature": "^1.0.6", + "cors": "^2.8.5", + "crypto": "^1.0.1", + "debug": "^2.6.9", + "define-data-property": "^1.1.4", + "delayed-stream": "^1.0.0", + "depd": "^2.0.0", + "destroy": "^1.2.0", + "ee-first": "^1.1.1", + "encodeurl": "^1.0.2", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "express": "^4.18.3", + "express-prom-bundle": "^7.0.0", + "finalhandler": "^1.2.0", + "follow-redirects": "^1.15.5", + "form-data": "^4.0.0", + "forwarded": "^0.2.0", + "fresh": "^0.5.2", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.1", + "http-errors": "^2.0.0", + "iconv-lite": "^0.4.24", + "inherits": "^2.0.4", + "ipaddr.js": "^1.9.1", + "jest": "^29.7.0", + "log": "^6.3.1", + "media-typer": "^0.3.0", + "merge-descriptors": "^1.0.1", + "methods": "^1.1.2", + "mime": "^1.6.0", + "mime-db": "^1.52.0", + "mime-types": "^2.1.35", + "ms": "^2.0.0", + "negotiator": "^0.6.3", + "object-assign": "^4.1.1", + "object-inspect": "^1.13.1", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "path-to-regexp": "^0.1.7", + "proxy-addr": "^2.0.7", + "proxy-from-env": "^1.1.0", + "qs": "^6.11.0", + "range-parser": "^1.2.1", + "raw-body": "^2.5.2", + "safe-buffer": "^5.2.1", + "safer-buffer": "^2.1.2", + "send": "^0.18.0", + "serve-static": "^1.15.0", + "set-function-length": "^1.2.1", + "setprototypeof": "^1.2.0", + "side-channel": "^1.0.6", + "statuses": "^2.0.1", + "supertest": "^6.3.4", + "toidentifier": "^1.0.1", + "type-is": "^1.6.18", + "unpipe": "^1.0.0", + "utils-merge": "^1.0.1", + "vary": "^1.1.2" + } + }, + "node_modules/questionservice": { + "resolved": "..", + "link": true + } + } +} diff --git a/questionservice/questionservice/package.json b/questionservice/questionservice/package.json new file mode 100644 index 0000000..a0e8caf --- /dev/null +++ b/questionservice/questionservice/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "questionservice": "file:.." + } +} From 4a38cb16e2471453bf49a0c6e2726a67519ac899 Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra <90760906+UO277938@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:44:59 +0200 Subject: [PATCH 05/39] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 207909d..a15c313 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: - develop - LaraFMz - Pablo-Arreglos - - Jota + - jota pull_request: types: [opened, synchronize, reopened] jobs: From bf9bf6396ceca5be58539879992d6ffb697f6d57 Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra <90760906+UO277938@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:47:26 +0200 Subject: [PATCH 06/39] Delete webapp/webapp directory --- webapp/webapp/package-lock.json | 48 --------------------------------- webapp/webapp/package.json | 5 ---- 2 files changed, 53 deletions(-) delete mode 100644 webapp/webapp/package-lock.json delete mode 100644 webapp/webapp/package.json diff --git a/webapp/webapp/package-lock.json b/webapp/webapp/package-lock.json deleted file mode 100644 index cf1946e..0000000 --- a/webapp/webapp/package-lock.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "webapp", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "dependencies": { - "webapp": "file:.." - } - }, - "..": { - "version": "0.1.0", - "dependencies": { - "@emotion/react": "^11.11.3", - "@emotion/styled": "^11.11.0", - "@mui/material": "^5.15.3", - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^14.1.2", - "@testing-library/user-event": "^14.5.2", - "axios": "^1.6.5", - "bootstrap": "^5.3.3", - "firebase": "^10.8.0", - "react": "^18.2.0", - "react-bootstrap": "^2.10.1", - "react-dom": "^18.2.0", - "react-router-bootstrap": "^0.26.2", - "react-router-dom": "^6.22.2", - "react-scripts": "5.0.1", - "web-vitals": "^3.5.1" - }, - "devDependencies": { - "axios-mock-adapter": "^1.22.0", - "expect-puppeteer": "^9.0.2", - "jest": "^29.3.1", - "jest-cucumber": "^3.0.1", - "jest-environment-node": "^29.7.0", - "mongodb-memory-server": "^9.1.4", - "puppeteer": "^21.7.0", - "serve": "^14.2.1", - "start-server-and-test": "^2.0.3" - } - }, - "node_modules/webapp": { - "resolved": "..", - "link": true - } - } -} diff --git a/webapp/webapp/package.json b/webapp/webapp/package.json deleted file mode 100644 index 96fd912..0000000 --- a/webapp/webapp/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "webapp": "file:.." - } -} From 7cd3cf244a1d4b952ab3e3e428824431ceba5753 Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra Date: Fri, 26 Apr 2024 13:48:23 +0200 Subject: [PATCH 07/39] Package lock update webapp y question --- questionservice/package-lock.json | 141 ++++++++++++++++++++++++++++++ webapp/webapp/package-lock.json | 48 ---------- webapp/webapp/package.json | 5 -- 3 files changed, 141 insertions(+), 53 deletions(-) delete mode 100644 webapp/webapp/package-lock.json delete mode 100644 webapp/webapp/package.json diff --git a/questionservice/package-lock.json b/questionservice/package-lock.json index 8b60600..d120505 100644 --- a/questionservice/package-lock.json +++ b/questionservice/package-lock.json @@ -35,6 +35,7 @@ "escape-html": "^1.0.3", "etag": "^1.8.1", "express": "^4.18.3", + "express-prom-bundle": "^7.0.0", "finalhandler": "^1.2.0", "follow-redirects": "^1.15.5", "form-data": "^4.0.0", @@ -1008,6 +1009,15 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1066,6 +1076,45 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz", + "integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -1074,6 +1123,11 @@ "@types/node": "*" } }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1095,6 +1149,11 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, "node_modules/@types/node": { "version": "20.12.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", @@ -1103,6 +1162,35 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1328,6 +1416,12 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "peer": true + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -2042,6 +2136,23 @@ "node": ">= 0.10.0" } }, + "node_modules/express-prom-bundle": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/express-prom-bundle/-/express-prom-bundle-7.0.0.tgz", + "integrity": "sha512-VwVaCyGBGHkHdecpTqRdW1Jm2fXK8weCUKjGjNWorc9g4M+cZ3xoj+N9uQzfRWfIPXJG5QOaiAziOIalQzMwgA==", + "dependencies": { + "@types/express": "^4.17.21", + "express": "^4.18.2", + "on-finished": "^2.3.0", + "url-value-parser": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prom-client": ">=15.0.0" + } + }, "node_modules/ext": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", @@ -3580,6 +3691,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", + "peer": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -4069,6 +4193,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "peer": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -4200,6 +4333,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-value-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/url-value-parser/-/url-value-parser-2.2.0.tgz", + "integrity": "sha512-yIQdxJpgkPamPPAPuGdS7Q548rLhny42tg8d4vyTNzFqvOnwqrgHXvgehT09U7fwrzxi3RxCiXjoNUNnNOlQ8A==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", diff --git a/webapp/webapp/package-lock.json b/webapp/webapp/package-lock.json deleted file mode 100644 index cf1946e..0000000 --- a/webapp/webapp/package-lock.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "webapp", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "dependencies": { - "webapp": "file:.." - } - }, - "..": { - "version": "0.1.0", - "dependencies": { - "@emotion/react": "^11.11.3", - "@emotion/styled": "^11.11.0", - "@mui/material": "^5.15.3", - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^14.1.2", - "@testing-library/user-event": "^14.5.2", - "axios": "^1.6.5", - "bootstrap": "^5.3.3", - "firebase": "^10.8.0", - "react": "^18.2.0", - "react-bootstrap": "^2.10.1", - "react-dom": "^18.2.0", - "react-router-bootstrap": "^0.26.2", - "react-router-dom": "^6.22.2", - "react-scripts": "5.0.1", - "web-vitals": "^3.5.1" - }, - "devDependencies": { - "axios-mock-adapter": "^1.22.0", - "expect-puppeteer": "^9.0.2", - "jest": "^29.3.1", - "jest-cucumber": "^3.0.1", - "jest-environment-node": "^29.7.0", - "mongodb-memory-server": "^9.1.4", - "puppeteer": "^21.7.0", - "serve": "^14.2.1", - "start-server-and-test": "^2.0.3" - } - }, - "node_modules/webapp": { - "resolved": "..", - "link": true - } - } -} diff --git a/webapp/webapp/package.json b/webapp/webapp/package.json deleted file mode 100644 index 96fd912..0000000 --- a/webapp/webapp/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "webapp": "file:.." - } -} From 9a8b17494d7804cb751653bbd1ffa846d38c5cdb Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra Date: Fri, 26 Apr 2024 13:56:35 +0200 Subject: [PATCH 08/39] Reparando --- webapp/src/components/Estilos/home.css | 2 +- webapp/src/components/Estilos/juego.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/src/components/Estilos/home.css b/webapp/src/components/Estilos/home.css index e7d760c..864ffe6 100644 --- a/webapp/src/components/Estilos/home.css +++ b/webapp/src/components/Estilos/home.css @@ -35,6 +35,6 @@ font-weight: 400; /* Añadimos padding para dar más espacio alrededor del texto del botón */ padding: 1em 4em; - font-family:'Trebuchet MS, Arial, Verdana, Tahoma, sans-serif'; + font-family: Trebuchet MS, sans-serif; } \ No newline at end of file diff --git a/webapp/src/components/Estilos/juego.css b/webapp/src/components/Estilos/juego.css index 6642e46..889a670 100644 --- a/webapp/src/components/Estilos/juego.css +++ b/webapp/src/components/Estilos/juego.css @@ -67,6 +67,6 @@ body h2 { color: white; - font-family: 'Verdana, Arial, Verdana, Tahoma, sans-serif'; + font-family: Verdana, sans-serif; text-align: center; /* Centra el texto */ } \ No newline at end of file From 045cd599e02f1e352eafae1563a0aaee75d2c345 Mon Sep 17 00:00:00 2001 From: Lara Date: Fri, 26 Apr 2024 14:24:24 +0200 Subject: [PATCH 09/39] chao pescao --- gatewayservice/gateway-service.test.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/gatewayservice/gateway-service.test.js b/gatewayservice/gateway-service.test.js index 3a08129..c3e55c5 100644 --- a/gatewayservice/gateway-service.test.js +++ b/gatewayservice/gateway-service.test.js @@ -49,17 +49,6 @@ describe('Gateway Service', () => { expect(response.status).toBe(500); expect(response.body).toEqual({ error: errorMessage }); }); - - // Test /adduser endpoint - it('deberia añadir usuario correctamente', async () => { - const response = await request(app) - .post('/adduser') - .send({ username: 'newuser', password: 'newpassword' }); - - // Verificamos que la respuesta tenga un código de estado 200 y un ID de usuario - expect(response.statusCode).toBe(200); - expect(response.body.userId).toBe('mockedUserId'); - }); // Probamos con una pregunta errónea it('debería devolver error con esa pregunta', async () => { From 3f8d9315359baf7c16fca45ac19760c3033b5e55 Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra Date: Sun, 28 Apr 2024 12:17:51 +0200 Subject: [PATCH 10/39] =?UTF-8?q?OpenAPI=20update=20y=20bot=C3=B3n=20final?= =?UTF-8?q?izar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatewayservice/gateway-service.js | 4 +- gatewayservice/openapi.yaml | 125 ++++++++------------------- webapp/src/components/Pages/Juego.js | 3 +- 3 files changed, 39 insertions(+), 93 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 918b9df..363400a 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -93,7 +93,7 @@ app.get('/getUserData', async (req, res) => { const { username } = req.query; try{ const getUserDataResponse = await axios.get(userServiceUrl+ `/getUserData?username=${username}`) - res.json(getUserDataResponse.data); + res.status(200).json(getUserDataResponse.data); }catch(error){ res.status(error.response.status).json({error: error.response.data.error}); } @@ -102,7 +102,7 @@ app.get('/getUserData', async (req, res) => { app.get('/getUsernames', async (req, res) => { try{ const getUserDataResponse = await axios.get(userServiceUrl+ `/getUsernames`) - res.json(getUserDataResponse.data); + res.status(200).json(getUserDataResponse.data); }catch(error){ res.status(error.response.status).json({error: error.response.data.error}); } diff --git a/gatewayservice/openapi.yaml b/gatewayservice/openapi.yaml index 31a02ff..aec74e7 100644 --- a/gatewayservice/openapi.yaml +++ b/gatewayservice/openapi.yaml @@ -183,21 +183,23 @@ paths: type: string description: Error information. example: Internal Server Error - /updateCorrectAnswers: + /updateStats: get: summary: Updates the data of the user, increasing his number of correct answers. - operationId: updateCorrectAnswers + operationId: updateStats parameters: in: path name: params required: true - description: Parameters for the update (username and numAnswers) + description: Parameters for the update (username, numRespuestsasCorrectas, numRespuestasIncorrectas) schema: type: object properties: username: type: string - numAnswers: + numRespuestsasCorrectas: + type: integer + numRespuestasIncorrectas: type: integer responses: '200': @@ -213,63 +215,16 @@ paths: message: type: string example: Respuestas correctas actualizada con éxito - '404': - description: The user is not found. - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - example: false - message: - type: string - example: Usuario no encontrado - '500': - description: Internal server error. - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - example: false - message: - type: string - description: Error information. - example: Error al actualizar las respuestas correctas - /updateIncorrectAnswers: - get: - summary: Updates the data of the user, increasing his number of incorrect answers. - operationId: updateIncorrectAnswers - parameters: - in: path - name: params - required: true - description: Parameters for the update (username and numAnswers) - schema: - type: object - properties: - username: - type: string - numAnswers: - type: integer - responses: - '200': - description: Updates the data correctly. + '401': + description: Params needed for the get action. content: application/json: schema: type: object properties: - success: - type: boolean - example: true - message: + error: type: string - example: Respuestas incorrectas actualizada con éxito + example: Faltan parámetros en la solicitud. '404': description: The user is not found. content: @@ -296,16 +251,16 @@ paths: message: type: string description: Error information. - example: Error al actualizar las respuestas incorrectas - /updateCompletedGames: + example: Error al actualizar las respuestas correctas + /getUserData: get: - summary: Update the number of completed games by the user. - operationId: updateCompletedGames + summary: Gets the data of an user. + operationId: getUserData parameters: in: path name: username required: true - description: Username for the update of data + description: Username for the search of data schema: type: string responses: @@ -316,12 +271,22 @@ paths: schema: type: user properties: - success: - type: boolean - example: true - message: + username: type: string - example: Juegos completados actualizado con éxito + example: Pablo + password: + type: integer + example: pass + createdAt: + type: date + correctAnswers: + type: integer + incorrectAnswers: + type: integer + completedGames: + type: integer + averageTime: + type: integer '404': description: The user is not found. content: @@ -348,21 +313,14 @@ paths: message: type: string description: Error information. - example: Error al actualizar Juegos completados - /getUserData: + example: Error al obtener los datos de usuario + /getUsernames: get: - summary: Gets the data of an user. - operationId: getUserData - parameters: - in: path - name: username - required: true - description: Username for the search of data - schema: - type: string + summary: Gets all the usernames. + operationId: getUsernames responses: '200': - description: Finds the data of the user correctly. + description: Finds the data of the user correctly (or no users). content: application/json: schema: @@ -384,19 +342,6 @@ paths: type: integer averageTime: type: integer - '404': - description: The user is not found. - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - example: false - message: - type: string - example: Usuario no encontrado '500': description: Internal server error. content: diff --git a/webapp/src/components/Pages/Juego.js b/webapp/src/components/Pages/Juego.js index 025cfaf..a8c2818 100644 --- a/webapp/src/components/Pages/Juego.js +++ b/webapp/src/components/Pages/Juego.js @@ -224,7 +224,8 @@ const Juego = ({isLogged, username, numPreguntas}) => { {finishGame ? <>

PARTIDA FINALIZADA

ACERTADAS: {numRespuestasCorrectas} FALLADAS: {numRespuestasIncorrectas}

- + { !disableFinish ? + : <> } : <>} { disableFinish ? (

Comience nueva partida o visite sus estadísticas!!

) From 130b2ac293e42bf4c9842cb3f74278dd25c0c5c1 Mon Sep 17 00:00:00 2001 From: Fernando Jose Gonzalez Sierra Date: Sun, 28 Apr 2024 12:21:55 +0200 Subject: [PATCH 11/39] Update Juego.test.js --- webapp/src/components/tests/Juego.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/tests/Juego.test.js b/webapp/src/components/tests/Juego.test.js index 2ddf3a2..b446439 100644 --- a/webapp/src/components/tests/Juego.test.js +++ b/webapp/src/components/tests/Juego.test.js @@ -95,9 +95,9 @@ describe('Juego component', () => { const { container, getByText } = render(); await waitFor(() => getByText(mockData.question)); fireEvent.click(getByText('SIGUIENTE')); - fireEvent.click(getByText('FINALIZAR PARTIDA')); - expect(getByText('FINALIZAR PARTIDA')).toBeDisabled(); - console.log(container.numRespuestasCorrectas) + fireEvent.click(getByText('GUARDAR ESTADÍSTICAS')); + //expect(getByText('GUARDAR ESTADÍSTICAS')).toBeDisabled(); + expect(getByText('Comience nueva partida o visite sus estadísticas!!')).toBeInTheDocument() //expect(axios.get).toHaveBeenCalledWith('http://localhost:8000/updateStats?username=test&numRespuestasCorrectas=0&numRespuestasIncorrectas=0'); }); From 5bd50ae689c232328142543e3074136bea78e005 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 13:10:15 +0200 Subject: [PATCH 12/39] descomentando e2e --- .github/workflows/release.yml | 40 +++++++------- webapp/e2e/steps/01-register-form.steps.js | 52 ------------------- .../steps/{03-home.steps.js => home.steps.js} | 0 .../{02-login.steps.js => login.steps.js} | 0 4 files changed, 20 insertions(+), 72 deletions(-) delete mode 100644 webapp/e2e/steps/01-register-form.steps.js rename webapp/e2e/steps/{03-home.steps.js => home.steps.js} (100%) rename webapp/e2e/steps/{02-login.steps.js => login.steps.js} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 628c986..9e4a6a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,28 +27,28 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -# e2e-tests: -# needs: [unit-tests] -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: actions/setup-node@v4 -# with: -# node-version: 20 -# - run: npm --prefix userservice/authservice install -# - run: npm --prefix userservice/userservice install -# - run: npm --prefix gatewayservice install -# - run: npm --prefix questionservice install -# - run: npm --prefix webapp install -# - run: npm --prefix webapp run build -# - run: npm --prefix webapp run test:e2e + e2e-tests: + needs: [unit-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm --prefix userservice/authservice install + - run: npm --prefix userservice/userservice install + - run: npm --prefix gatewayservice install + - run: npm --prefix questionservice install + - run: npm --prefix webapp install + - run: npm --prefix webapp run build + - run: npm --prefix webapp run test:e2e docker-push-webapp: name: Push webapp Docker Image to GitHub Packages runs-on: ubuntu-latest permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -68,7 +68,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -85,7 +85,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -102,7 +102,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Update OpenAPI configuration @@ -123,7 +123,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry diff --git a/webapp/e2e/steps/01-register-form.steps.js b/webapp/e2e/steps/01-register-form.steps.js deleted file mode 100644 index e54df87..0000000 --- a/webapp/e2e/steps/01-register-form.steps.js +++ /dev/null @@ -1,52 +0,0 @@ -const puppeteer = require('puppeteer'); -const { defineFeature, loadFeature }=require('jest-cucumber'); -const setDefaultOptions = require('expect-puppeteer').setDefaultOptions -const feature = loadFeature('./features/register-form.feature'); - -let page; -let browser; - -defineFeature(feature, test => { - - beforeAll(async () => { - browser = process.env.GITHUB_ACTIONS - ? await puppeteer.launch() - : await puppeteer.launch({ headless: false, slowMo: 100 }); - page = await browser.newPage(); - //Way of setting up the timeout - setDefaultOptions({ timeout: 10000 }) - - await page - .goto("http://localhost:3000", { - waitUntil: "networkidle0", - }) - .catch(() => {}); - }); - - test('The user is not registered in the site', ({given,when,then}) => { - - let username; - let password; - - given('An unregistered user', async () => { - username = "pablo@gmail.com" - password = "pabloasw1" - await expect(page).toClick("button", { text: "REGÍSTRATE" }); - }); - - when('I fill the data in the form and press submit', async () => { - await expect(page).toFill('input[name="username"]', username); - await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Crear' }) - }); - - then('A confirmation message should be shown in the screen', async () => { - await expect(page).toMatchElement("div", { text: "Usuario creado correctamente" }); - }); - }) - - afterAll(async ()=>{ - browser.close() - }) - -}); \ No newline at end of file diff --git a/webapp/e2e/steps/03-home.steps.js b/webapp/e2e/steps/home.steps.js similarity index 100% rename from webapp/e2e/steps/03-home.steps.js rename to webapp/e2e/steps/home.steps.js diff --git a/webapp/e2e/steps/02-login.steps.js b/webapp/e2e/steps/login.steps.js similarity index 100% rename from webapp/e2e/steps/02-login.steps.js rename to webapp/e2e/steps/login.steps.js From d691733f18b98a453627a1b8dbaac7fa4fe943f6 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 13:56:01 +0200 Subject: [PATCH 13/39] quitando tiempo de estadisticas --- webapp/e2e/steps/home.steps.js | 2 +- webapp/src/components/Pages/Estadisticas.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/webapp/e2e/steps/home.steps.js b/webapp/e2e/steps/home.steps.js index 35cd730..6f83e6b 100644 --- a/webapp/e2e/steps/home.steps.js +++ b/webapp/e2e/steps/home.steps.js @@ -47,7 +47,7 @@ defineFeature(feature, test => { then('I should be able to interact with the app', async () => { await expect(page).toMatchElement("button", { text: "JUGAR" }); await expect(page).toMatchElement("button", { text: "ESTADÍSTICAS" }); - }); + }); }) afterAll(async ()=>{ diff --git a/webapp/src/components/Pages/Estadisticas.js b/webapp/src/components/Pages/Estadisticas.js index dcaa63f..99d6902 100644 --- a/webapp/src/components/Pages/Estadisticas.js +++ b/webapp/src/components/Pages/Estadisticas.js @@ -12,7 +12,7 @@ const Estadisticas = ({isLogged, username}) => { const [correctAnswers, setCorrectAnswers] = useState(0); const [incorrectAnswers, setIncorrectAnswers] = useState(0); const [completedGames, setCompletedGames] = useState(0); - const [averageTime, setAverageTime] = useState(0); + //const [averageTime, setAverageTime] = useState(0); const [firstRender, setFirstRender] = useState(false); useEffect(() => { @@ -30,7 +30,7 @@ const Estadisticas = ({isLogged, username}) => { setCorrectAnswers(datos.user.correctAnswers); setIncorrectAnswers(datos.user.incorrectAnswers); setCompletedGames(datos.user.completedGames); - setAverageTime(datos.user.averageTime); + //setAverageTime(datos.user.averageTime); } catch (error) { setError('Error al cargar la información'); } @@ -54,10 +54,6 @@ const Estadisticas = ({isLogged, username}) => { Nº Juegos completados: {completedGames} - - Tiempo medio por juego: - {averageTime} - From c01fb6bbca3a30f8c5bf18c48a6a09c0f8060b2b Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 14:00:10 +0200 Subject: [PATCH 14/39] linea cambio --- webapp/src/components/tests/Estadisticas.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/src/components/tests/Estadisticas.test.js b/webapp/src/components/tests/Estadisticas.test.js index bfd3def..8c8828d 100644 --- a/webapp/src/components/tests/Estadisticas.test.js +++ b/webapp/src/components/tests/Estadisticas.test.js @@ -36,8 +36,8 @@ describe('Estadisticas Component', () => { expect(getByText('Nº Juegos completados:')).toBeInTheDocument(); expect(getByText('20')).toBeInTheDocument(); // Verifica que el número de juegos completados sea 20 - expect(getByText('Tiempo medio por juego:')).toBeInTheDocument(); - expect(getByText('30')).toBeInTheDocument(); // Verifica que el tiempo medio por juego sea 30 + //expect(getByText('Tiempo medio por juego:')).toBeInTheDocument(); + //expect(getByText('30')).toBeInTheDocument(); // Verifica que el tiempo medio por juego sea 30 }); }); From 5b1fa3841a805fcc8a8cd83303d743100a243c41 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 14:25:50 +0200 Subject: [PATCH 15/39] Mas pruebas para userservice --- userservice/userservice/user-service.test.js | 58 +++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/userservice/userservice/user-service.test.js b/userservice/userservice/user-service.test.js index 8dd8ea1..04c536f 100644 --- a/userservice/userservice/user-service.test.js +++ b/userservice/userservice/user-service.test.js @@ -16,6 +16,7 @@ afterAll(async () => { await mongoServer.stop(); }); + describe('User Service', () => { it('should add a new user on POST /adduser', async () => { const newUser = { @@ -27,4 +28,59 @@ describe('User Service', () => { expect(response.status).toBe(200); expect(response.body).toHaveProperty('username', 'testuser'); }); -}); + + it('Debería devolver una lista de nombres de usuario cuando hay usuarios en la base de datos', async () => { + const response = await request(app).get('/getUsernames'); + expect(response.status).toBe(200); + expect(response.body.usernames).toBeDefined(); + expect(response.body.usernames.length).toBeGreaterThan(0); + }); + + it('Debería actualizar las estadísticas del usuario correctamente', async () => { + const username = 'testuser'; + const numRespuestasCorrectas = 5; + const numRespuestasIncorrectas = 3; + + const response = await request(app) + .get('/updateStats') + .query({ username, numRespuestasCorrectas, numRespuestasIncorrectas }); + + expect(response.status).toBe(200); + expect(response.body.success).toBe(true); + expect(response.body.message).toBe('Estadísticas actualizadas con éxito'); + + }); + + it('Debería devolver un mensaje de error cuando el usuario no se encuentra en la base de datos al actualizar estadisticas', async () => { + const username = 'usuario_inexistente'; + const numRespuestasCorrectas = 5; + const numRespuestasIncorrectas = 3; + + const response = await request(app) + .get('/updateStats') + .query({ username, numRespuestasCorrectas, numRespuestasIncorrectas }); + + expect(response.status).toBe(404); + expect(response.body.success).toBe(false); + expect(response.body.message).toBe('Usuario no encontrado'); + }); + + it('Debería devolver un mensaje de error cuando el usuario no se encuentra en la base de datos al obtener sus datos', async () => { + const username = 'usuario_inexistente'; + + const response = await request(app) + .get('/getUserData') + .query({ username }); + + expect(response.status).toBe(404); + expect(response.body.success).toBe(false); + expect(response.body.message).toBe('Usuario no encontrado'); + }); + + + +} + +); + + From aedfdeeece87bed0af291c77e42ec838c79d793e Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 14:48:23 +0200 Subject: [PATCH 16/39] =?UTF-8?q?A=C3=B1adido=20test=20que=20faltaba=20de?= =?UTF-8?q?=20gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatewayservice/gateway-service.test.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/gatewayservice/gateway-service.test.js b/gatewayservice/gateway-service.test.js index c3e55c5..b76f343 100644 --- a/gatewayservice/gateway-service.test.js +++ b/gatewayservice/gateway-service.test.js @@ -194,23 +194,7 @@ describe('Gateway Service', () => { expect(response.status).toBe(401); // Esperamos un error de solicitud incorrecta }); - /* - it('debería manejar correctamente la carga excesiva', async () => { - // Realizar múltiples solicitudes simultáneas a endpoints diferentes - const promises = []; - for (let i = 0; i < 100; i++) { - promises.push(request(app).post('/login').send({ username: `user${i}`, password: 'password' })); - } - - // Esperar a que se completen todas las solicitudes - const responses = await Promise.all(promises); - - // Verificar que todas las respuestas tengan el código de estado esperado (200) - responses.forEach(response => { - expect(response.status).toBe(200); - }); - }); - */ + it('debería devolver un estado de salud "OK"', async () => { const response = await request(app).get('/health'); @@ -219,4 +203,10 @@ describe('Gateway Service', () => { expect(response.status).toBe(200); expect(response.body).toEqual({ status: 'OK' }); }); + + it('Debería devolver una lista de nombres de usuario cuando hay usuarios en la base de datos', async () => { + const response = await request(app).get('/getUsernames'); + expect(response.status).toBe(200); + }); + }); \ No newline at end of file From 07d8fa7f47369379c876b7461ebb500250f96d83 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 16:02:32 +0200 Subject: [PATCH 17/39] =?UTF-8?q?Coverafe=20para=20metodos=20de=20validar?= =?UTF-8?q?=20de=20a=C3=B1adir=20usuarios=20comentados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/src/components/tests/AddUser.test.js | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/webapp/src/components/tests/AddUser.test.js b/webapp/src/components/tests/AddUser.test.js index 8af0338..49cf88b 100644 --- a/webapp/src/components/tests/AddUser.test.js +++ b/webapp/src/components/tests/AddUser.test.js @@ -56,4 +56,45 @@ describe('AddUser component', () => { expect(screen.getByText(/Error: Internal Server Error/i)).toBeInTheDocument(); }); }); + + + + + + // it('should display error message for short password', async () => { + // render(); + + // const usernameInput = screen.getByLabelText(/Usuario/i); + // const passwordInput = screen.getByLabelText(/Contraseña/i); + // const createUserButton = screen.getByRole('button', { name: /Crear/i }); + + // fireEvent.change(usernameInput, { target: { value: 'newusername' } }); + // fireEvent.change(passwordInput, { target: { value: 'err' } }); + + // fireEvent.click(createUserButton); + + // expect(await screen.findByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument(); + // }); + + + // it('should display error message for repeated username', async () => { + // const mockAxios = new MockAdapter(axios); + // const mockedUsernames = ['existingUser']; + // mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); + + // render(); + + // const usernameInput = screen.getByLabelText(/Usuario/i); + // const passwordInput = screen.getByLabelText(/Contraseña/i); + // const createUserButton = screen.getByRole('button', { name: /Crear/i }); + + // fireEvent.change(usernameInput, { target: { value: 'existingUser' } }); + // fireEvent.change(passwordInput, { target: { value: 'short123456' } }); + + // fireEvent.click(createUserButton); + + // expect(await screen.findByText(/Usuario creado correctamente/i)).toBeInTheDocument(); + // }); + }); + From 81137f6d633f5266887aa15bc7262a16c8fcd4b7 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 16:25:35 +0200 Subject: [PATCH 18/39] Cambio de codigo comentado pero sigue sin funcionar correctamente --- webapp/src/components/tests/AddUser.test.js | 52 ++++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/webapp/src/components/tests/AddUser.test.js b/webapp/src/components/tests/AddUser.test.js index 49cf88b..2994019 100644 --- a/webapp/src/components/tests/AddUser.test.js +++ b/webapp/src/components/tests/AddUser.test.js @@ -57,44 +57,60 @@ describe('AddUser component', () => { }); }); - - - - - // it('should display error message for short password', async () => { + // it('should show error of password too short', async () => { // render(); + // const mockAxios = new MockAdapter(axios); + // const mockedUsernames = ['existingUser']; + // mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); + // const usernameInput = screen.getByLabelText(/Usuario/i); // const passwordInput = screen.getByLabelText(/Contraseña/i); - // const createUserButton = screen.getByRole('button', { name: /Crear/i }); + // const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // fireEvent.change(usernameInput, { target: { value: 'newusername' } }); - // fireEvent.change(passwordInput, { target: { value: 'err' } }); + // // Mock the axios.post request to simulate a successful response + // mockAxios.onPost('http://localhost:8000/adduser').reply(200); - // fireEvent.click(createUserButton); + // // Simulate user input + // fireEvent.change(usernameInput, { target: { value: 'testUser' } }); + // fireEvent.change(passwordInput, { target: { value: 'sh' } }); - // expect(await screen.findByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument(); + // // Trigger the add user button click + // fireEvent.click(addUserButton); + + // // Wait for the Snackbar to be open + // await waitFor(() => { + // expect(screen.getByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument(); + // }); // }); + // it('should show error of repeated user', async () => { + // render(); - // it('should display error message for repeated username', async () => { // const mockAxios = new MockAdapter(axios); // const mockedUsernames = ['existingUser']; // mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); - // render(); - // const usernameInput = screen.getByLabelText(/Usuario/i); // const passwordInput = screen.getByLabelText(/Contraseña/i); - // const createUserButton = screen.getByRole('button', { name: /Crear/i }); + // const addUserButton = screen.getByRole('button', { name: /Crear/i }); + // // Mock the axios.post request to simulate a successful response + // mockAxios.onPost('http://localhost:8000/adduser').reply(200); + + // // Simulate user input // fireEvent.change(usernameInput, { target: { value: 'existingUser' } }); - // fireEvent.change(passwordInput, { target: { value: 'short123456' } }); + // fireEvent.change(passwordInput, { target: { value: 'passwordCorrect' } }); - // fireEvent.click(createUserButton); + // // Trigger the add user button click + // fireEvent.click(addUserButton); - // expect(await screen.findByText(/Usuario creado correctamente/i)).toBeInTheDocument(); + // // Wait for the Snackbar to be open + // await waitFor(() => { + // expect(screen.getByText(/Error: Credenciales incorrectas. El nombre de usuario esta en uso/i)).toBeInTheDocument(); + // }); // }); - + + }); From 41772848c4646d80f63ea4b62d5f02b84c8ccb66 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 16:38:57 +0200 Subject: [PATCH 19/39] Coverage de test de validacion de usuarios --- webapp/src/components/AddUser.js | 2 + webapp/src/components/tests/AddUser.test.js | 80 ++++++++++----------- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/webapp/src/components/AddUser.js b/webapp/src/components/AddUser.js index f6eedb8..689d884 100644 --- a/webapp/src/components/AddUser.js +++ b/webapp/src/components/AddUser.js @@ -30,10 +30,12 @@ const AddUser = () => { const usernames = response.data.usernames; if (usernames.includes(username)){ setMensajeError('Credenciales incorrectas. El nombre de usuario esta en uso') + setError('Credenciales incorrectas. El nombre de usuario esta en uso') return false; } if (password.length < 8) { setMensajeError('Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres') + setError('Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres') return false; } return true; diff --git a/webapp/src/components/tests/AddUser.test.js b/webapp/src/components/tests/AddUser.test.js index 2994019..a08f0e2 100644 --- a/webapp/src/components/tests/AddUser.test.js +++ b/webapp/src/components/tests/AddUser.test.js @@ -57,59 +57,59 @@ describe('AddUser component', () => { }); }); - // it('should show error of password too short', async () => { - // render(); + it('should show error of password too short', async () => { + render(); - // const mockAxios = new MockAdapter(axios); - // const mockedUsernames = ['existingUser']; - // mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); + const mockAxios = new MockAdapter(axios); + const mockedUsernames = ['existingUser']; + mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); - // const usernameInput = screen.getByLabelText(/Usuario/i); - // const passwordInput = screen.getByLabelText(/Contraseña/i); - // const addUserButton = screen.getByRole('button', { name: /Crear/i }); + const usernameInput = screen.getByLabelText(/Usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // // Mock the axios.post request to simulate a successful response - // mockAxios.onPost('http://localhost:8000/adduser').reply(200); + // Mock the axios.post request to simulate a successful response + mockAxios.onPost('http://localhost:8000/adduser').reply(200); - // // Simulate user input - // fireEvent.change(usernameInput, { target: { value: 'testUser' } }); - // fireEvent.change(passwordInput, { target: { value: 'sh' } }); + // Simulate user input + fireEvent.change(usernameInput, { target: { value: 'testUser' } }); + fireEvent.change(passwordInput, { target: { value: 'sh' } }); - // // Trigger the add user button click - // fireEvent.click(addUserButton); + // Trigger the add user button click + fireEvent.click(addUserButton); - // // Wait for the Snackbar to be open - // await waitFor(() => { - // expect(screen.getByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument(); - // }); - // }); + // Wait for the Snackbar to be open + await waitFor(() => { + expect(screen.getByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument(); + }); + }); - // it('should show error of repeated user', async () => { - // render(); + it('should show error of repeated user', async () => { + render(); - // const mockAxios = new MockAdapter(axios); - // const mockedUsernames = ['existingUser']; - // mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); + const mockAxios = new MockAdapter(axios); + const mockedUsernames = ['existingUser']; + mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); - // const usernameInput = screen.getByLabelText(/Usuario/i); - // const passwordInput = screen.getByLabelText(/Contraseña/i); - // const addUserButton = screen.getByRole('button', { name: /Crear/i }); + const usernameInput = screen.getByLabelText(/Usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // // Mock the axios.post request to simulate a successful response - // mockAxios.onPost('http://localhost:8000/adduser').reply(200); + // Mock the axios.post request to simulate a successful response + mockAxios.onPost('http://localhost:8000/adduser').reply(200); - // // Simulate user input - // fireEvent.change(usernameInput, { target: { value: 'existingUser' } }); - // fireEvent.change(passwordInput, { target: { value: 'passwordCorrect' } }); + // Simulate user input + fireEvent.change(usernameInput, { target: { value: 'existingUser' } }); + fireEvent.change(passwordInput, { target: { value: 'passwordCorrect' } }); - // // Trigger the add user button click - // fireEvent.click(addUserButton); + // Trigger the add user button click + fireEvent.click(addUserButton); - // // Wait for the Snackbar to be open - // await waitFor(() => { - // expect(screen.getByText(/Error: Credenciales incorrectas. El nombre de usuario esta en uso/i)).toBeInTheDocument(); - // }); - // }); + // Wait for the Snackbar to be open + await waitFor(() => { + expect(screen.getByText(/Error: Credenciales incorrectas. El nombre de usuario esta en uso/i)).toBeInTheDocument(); + }); + }); }); From 8899ce10f73e638cdc96aaff59e7693563ed5150 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 16:47:16 +0200 Subject: [PATCH 20/39] Quitando codigo repetido --- webapp/src/components/tests/AddUser.test.js | 36 ++++----------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/webapp/src/components/tests/AddUser.test.js b/webapp/src/components/tests/AddUser.test.js index a08f0e2..2613dd5 100644 --- a/webapp/src/components/tests/AddUser.test.js +++ b/webapp/src/components/tests/AddUser.test.js @@ -4,7 +4,13 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import AddUser from '../AddUser'; -const mockAxios = new MockAdapter(axios); + const mockAxios = new MockAdapter(axios); + const mockedUsernames = ['existingUser']; + mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); + + const usernameInput = screen.getByLabelText(/Usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Crear/i }); describe('AddUser component', () => { beforeEach(() => { @@ -13,11 +19,6 @@ describe('AddUser component', () => { it('should add user successfully', async () => { render(); - - const usernameInput = screen.getByLabelText(/Usuario/i); - const passwordInput = screen.getByLabelText(/Contraseña/i); - const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // Mock the axios.post request to simulate a successful response mockAxios.onPost('http://localhost:8000/adduser').reply(200); @@ -36,11 +37,6 @@ describe('AddUser component', () => { it('should handle error when adding user', async () => { render(); - - const usernameInput = screen.getByLabelText(/Usuario/i); - const passwordInput = screen.getByLabelText(/Contraseña/i); - const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // Mock the axios.post request to simulate an error response mockAxios.onPost('http://localhost:8000/adduser').reply(500, { error: 'Internal Server Error' }); @@ -59,15 +55,6 @@ describe('AddUser component', () => { it('should show error of password too short', async () => { render(); - - const mockAxios = new MockAdapter(axios); - const mockedUsernames = ['existingUser']; - mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); - - const usernameInput = screen.getByLabelText(/Usuario/i); - const passwordInput = screen.getByLabelText(/Contraseña/i); - const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // Mock the axios.post request to simulate a successful response mockAxios.onPost('http://localhost:8000/adduser').reply(200); @@ -86,15 +73,6 @@ describe('AddUser component', () => { it('should show error of repeated user', async () => { render(); - - const mockAxios = new MockAdapter(axios); - const mockedUsernames = ['existingUser']; - mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); - - const usernameInput = screen.getByLabelText(/Usuario/i); - const passwordInput = screen.getByLabelText(/Contraseña/i); - const addUserButton = screen.getByRole('button', { name: /Crear/i }); - // Mock the axios.post request to simulate a successful response mockAxios.onPost('http://localhost:8000/adduser').reply(200); From 0bceae4469814b119e734e32ac2333a4f06d2f84 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 16:53:25 +0200 Subject: [PATCH 21/39] Quitando codigo repetido --- webapp/src/components/tests/AddUser.test.js | 100 +++++++++----------- 1 file changed, 44 insertions(+), 56 deletions(-) diff --git a/webapp/src/components/tests/AddUser.test.js b/webapp/src/components/tests/AddUser.test.js index 2613dd5..fe76461 100644 --- a/webapp/src/components/tests/AddUser.test.js +++ b/webapp/src/components/tests/AddUser.test.js @@ -4,91 +4,79 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import AddUser from '../AddUser'; - const mockAxios = new MockAdapter(axios); - const mockedUsernames = ['existingUser']; - mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames }); - - const usernameInput = screen.getByLabelText(/Usuario/i); - const passwordInput = screen.getByLabelText(/Contraseña/i); - const addUserButton = screen.getByRole('button', { name: /Crear/i }); +const mockAxios = new MockAdapter(axios); describe('AddUser component', () => { beforeEach(() => { mockAxios.reset(); }); - it('should add user successfully', async () => { - render(); - // Mock the axios.post request to simulate a successful response + const renderComponent = () => render(); + + const setupMockedUsernames = (usernames) => { + mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames }); + }; + + const setupSuccessfulResponse = () => { mockAxios.onPost('http://localhost:8000/adduser').reply(200); + }; - // Simulate user input - fireEvent.change(usernameInput, { target: { value: 'testUser' } }); - fireEvent.change(passwordInput, { target: { value: 'testPassword' } }); + const setupErrorResponse = (statusCode, errorMessage) => { + mockAxios.onPost('http://localhost:8000/adduser').reply(statusCode, { error: errorMessage }); + }; - // Trigger the add user button click - fireEvent.click(addUserButton); + const typeUsernameAndPassword = (username, password) => { + const usernameInput = screen.getByLabelText(/Usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + fireEvent.change(usernameInput, { target: { value: username } }); + fireEvent.change(passwordInput, { target: { value: password } }); + }; + + const clickCreateUserButton = () => { + const createUserButton = screen.getByRole('button', { name: /Crear/i }); + fireEvent.click(createUserButton); + }; - // Wait for the Snackbar to be open + it('should add user successfully', async () => { + renderComponent(); + setupSuccessfulResponse(); + typeUsernameAndPassword('testUser', 'testPassword'); + clickCreateUserButton(); await waitFor(() => { expect(screen.getByText(/Usuario creado correctamente/i)).toBeInTheDocument(); }); }); it('should handle error when adding user', async () => { - render(); - // Mock the axios.post request to simulate an error response - mockAxios.onPost('http://localhost:8000/adduser').reply(500, { error: 'Internal Server Error' }); - - // Simulate user input - fireEvent.change(usernameInput, { target: { value: 'testUser' } }); - fireEvent.change(passwordInput, { target: { value: 'testPassword' } }); - - // Trigger the add user button click - fireEvent.click(addUserButton); - - // Wait for the error Snackbar to be open + renderComponent(); + setupErrorResponse(500, 'Internal Server Error'); + typeUsernameAndPassword('testUser', 'testPassword'); + clickCreateUserButton(); await waitFor(() => { expect(screen.getByText(/Error: Internal Server Error/i)).toBeInTheDocument(); }); }); - it('should show error of password too short', async () => { - render(); - // Mock the axios.post request to simulate a successful response - mockAxios.onPost('http://localhost:8000/adduser').reply(200); - - // Simulate user input - fireEvent.change(usernameInput, { target: { value: 'testUser' } }); - fireEvent.change(passwordInput, { target: { value: 'sh' } }); - - // Trigger the add user button click - fireEvent.click(addUserButton); - - // Wait for the Snackbar to be open + it('should show error message for short password', async () => { + renderComponent(); + setupMockedUsernames([]); + setupSuccessfulResponse(); + typeUsernameAndPassword('testUser', 'sh'); + clickCreateUserButton(); await waitFor(() => { expect(screen.getByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument(); }); }); - it('should show error of repeated user', async () => { - render(); - // Mock the axios.post request to simulate a successful response - mockAxios.onPost('http://localhost:8000/adduser').reply(200); - - // Simulate user input - fireEvent.change(usernameInput, { target: { value: 'existingUser' } }); - fireEvent.change(passwordInput, { target: { value: 'passwordCorrect' } }); - - // Trigger the add user button click - fireEvent.click(addUserButton); - - // Wait for the Snackbar to be open + it('should show error message for repeated username', async () => { + renderComponent(); + setupMockedUsernames(['existingUser']); + setupSuccessfulResponse(); + typeUsernameAndPassword('existingUser', 'passwordCorrect'); + clickCreateUserButton(); await waitFor(() => { expect(screen.getByText(/Error: Credenciales incorrectas. El nombre de usuario esta en uso/i)).toBeInTheDocument(); }); }); - }); - From add7c77a5191e31e77ae3f1fffb6c2b5a632f7d3 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 17:10:28 +0200 Subject: [PATCH 22/39] Fixing issues de Sonar --- gatewayservice/gateway-service.js | 2 +- webapp/src/components/AddUser.js | 2 +- webapp/src/components/Pages/Estadisticas.js | 2 -- webapp/src/components/tests/Estadisticas.test.js | 2 -- webapp/src/components/tests/Juego.test.js | 2 -- 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 363400a..899b55b 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -39,7 +39,7 @@ app.post('/login', async (req, res) => { app.post('/adduser', async (req, res) => { try { - const { username, password, valido, mensajeError } = req.body; + const { valido, mensajeError } = req.body; if (!valido) { // Si las credenciales son inválidas, devuelve un error 401 diff --git a/webapp/src/components/AddUser.js b/webapp/src/components/AddUser.js index 689d884..0f99681 100644 --- a/webapp/src/components/AddUser.js +++ b/webapp/src/components/AddUser.js @@ -14,7 +14,7 @@ const AddUser = () => { const addUser = async () => { try { - var valido = await validateCredentials(username, password); + let valido = await validateCredentials(username, password); await axios.post(`${apiEndpoint}/adduser`, { username, password, valido, mensajeError }); setOpenSnackbar(true); } catch (error) { diff --git a/webapp/src/components/Pages/Estadisticas.js b/webapp/src/components/Pages/Estadisticas.js index 99d6902..cf46249 100644 --- a/webapp/src/components/Pages/Estadisticas.js +++ b/webapp/src/components/Pages/Estadisticas.js @@ -12,7 +12,6 @@ const Estadisticas = ({isLogged, username}) => { const [correctAnswers, setCorrectAnswers] = useState(0); const [incorrectAnswers, setIncorrectAnswers] = useState(0); const [completedGames, setCompletedGames] = useState(0); - //const [averageTime, setAverageTime] = useState(0); const [firstRender, setFirstRender] = useState(false); useEffect(() => { @@ -30,7 +29,6 @@ const Estadisticas = ({isLogged, username}) => { setCorrectAnswers(datos.user.correctAnswers); setIncorrectAnswers(datos.user.incorrectAnswers); setCompletedGames(datos.user.completedGames); - //setAverageTime(datos.user.averageTime); } catch (error) { setError('Error al cargar la información'); } diff --git a/webapp/src/components/tests/Estadisticas.test.js b/webapp/src/components/tests/Estadisticas.test.js index 8c8828d..60526ad 100644 --- a/webapp/src/components/tests/Estadisticas.test.js +++ b/webapp/src/components/tests/Estadisticas.test.js @@ -36,8 +36,6 @@ describe('Estadisticas Component', () => { expect(getByText('Nº Juegos completados:')).toBeInTheDocument(); expect(getByText('20')).toBeInTheDocument(); // Verifica que el número de juegos completados sea 20 - //expect(getByText('Tiempo medio por juego:')).toBeInTheDocument(); - //expect(getByText('30')).toBeInTheDocument(); // Verifica que el tiempo medio por juego sea 30 }); }); diff --git a/webapp/src/components/tests/Juego.test.js b/webapp/src/components/tests/Juego.test.js index b446439..1a981bc 100644 --- a/webapp/src/components/tests/Juego.test.js +++ b/webapp/src/components/tests/Juego.test.js @@ -96,9 +96,7 @@ describe('Juego component', () => { await waitFor(() => getByText(mockData.question)); fireEvent.click(getByText('SIGUIENTE')); fireEvent.click(getByText('GUARDAR ESTADÍSTICAS')); - //expect(getByText('GUARDAR ESTADÍSTICAS')).toBeDisabled(); expect(getByText('Comience nueva partida o visite sus estadísticas!!')).toBeInTheDocument() - //expect(axios.get).toHaveBeenCalledWith('http://localhost:8000/updateStats?username=test&numRespuestasCorrectas=0&numRespuestasIncorrectas=0'); }); it('el temporizador llega a 0 y se desvelan las respuestas ademas de bloquearse los botones', async () => { From 34453cfcb12707bea7bc577015f8bbaadcca9674 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 17:17:03 +0200 Subject: [PATCH 23/39] Otra issue --- webapp/src/components/tests/Juego.test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/src/components/tests/Juego.test.js b/webapp/src/components/tests/Juego.test.js index 1a981bc..26422aa 100644 --- a/webapp/src/components/tests/Juego.test.js +++ b/webapp/src/components/tests/Juego.test.js @@ -34,7 +34,7 @@ describe('Juego component', () => { }); it('obtiene las preguntas y respuestas', async () => { - const { container, getByText } = render(); + const { getByText } = render(); await waitFor(() => getByText('CARGANDO...')); @@ -49,7 +49,7 @@ describe('Juego component', () => { }); it('responde la pregunta correctamente', async () => { - const { container, getByText } = render(); + const { getByText } = render(); await waitFor(() => getByText(mockData.question)); @@ -63,7 +63,7 @@ describe('Juego component', () => { }); it('responde la pregunta incorrectamente y despinta al hacer click en Siguiente', async () => { - const { container, getByText } = render(); + const { getByText } = render(); await waitFor(() => getByText(mockData.question)); @@ -92,7 +92,7 @@ describe('Juego component', () => { }); it('finalizar Juego', async () => { - const { container, getByText } = render(); + const { getByText } = render(); await waitFor(() => getByText(mockData.question)); fireEvent.click(getByText('SIGUIENTE')); fireEvent.click(getByText('GUARDAR ESTADÍSTICAS')); @@ -100,7 +100,7 @@ describe('Juego component', () => { }); it('el temporizador llega a 0 y se desvelan las respuestas ademas de bloquearse los botones', async () => { - const { container, getByText } = render(); + const { getByText } = render(); await waitFor(() => getByText(mockData.question)); act(() => { From e5e6e704cec418e954391617107f73fd41d01944 Mon Sep 17 00:00:00 2001 From: uo289324 Date: Mon, 29 Apr 2024 12:45:45 +0200 Subject: [PATCH 24/39] dockerfile grafana --- monitoring/grafana/Dockerfile | 6 + monitoring/grafana/grafana.ini | 1654 +++++++++++++++++ .../dashboards/example-service-dashboard.json | 375 ++++ .../provisioning/datasources/datasource.yml | 10 + 4 files changed, 2045 insertions(+) create mode 100644 monitoring/grafana/Dockerfile create mode 100644 monitoring/grafana/grafana.ini create mode 100644 monitoring/grafana/provisioning/dashboards/example-service-dashboard.json create mode 100644 monitoring/grafana/provisioning/datasources/datasource.yml diff --git a/monitoring/grafana/Dockerfile b/monitoring/grafana/Dockerfile new file mode 100644 index 0000000..30133be --- /dev/null +++ b/monitoring/grafana/Dockerfile @@ -0,0 +1,6 @@ +FROM grafana/grafana + +COPY provisioning/ /etc/grafana/provisioning/ +COPY grafana.ini /etc/grafana/grafana.ini + +CMD ["./bin/grafana"] \ No newline at end of file diff --git a/monitoring/grafana/grafana.ini b/monitoring/grafana/grafana.ini new file mode 100644 index 0000000..6c8ee47 --- /dev/null +++ b/monitoring/grafana/grafana.ini @@ -0,0 +1,1654 @@ +##################### Grafana Configuration Example ##################### +# +# Everything has defaults so you only need to uncomment things you want to +# change + +# possible values : production, development +;app_mode = production + +# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty +;instance_name = ${HOSTNAME} + +# force migration will run migrations that might cause dataloss +# Deprecated, use clean_upgrade option in [unified_alerting.upgrade] instead. +;force_migration = false + +#################################### Paths #################################### +[paths] +# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) +;data = /var/lib/grafana + +# Temporary files in `data` directory older than given duration will be removed +;temp_data_lifetime = 24h + +# Directory where grafana can store logs +;logs = /var/log/grafana + +# Directory where grafana will automatically scan and look for plugins +;plugins = /var/lib/grafana/plugins + +# folder that contains provisioning config files that grafana will apply on startup and while running. +;provisioning = conf/provisioning + +#################################### Server #################################### +[server] +# Protocol (http, https, h2, socket) +;protocol = http + +# This is the minimum TLS version allowed. By default, this value is empty. Accepted values are: TLS1.2, TLS1.3. If nothing is set TLS1.2 would be taken +;min_tls_version = "" + +# The ip address to bind to, empty will bind to all interfaces +;http_addr = + +# The http port to use +;http_port = 3000 + +# The public facing domain name used to access grafana from a browser +;domain = localhost + +# Redirect to correct domain if host header does not match domain +# Prevents DNS rebinding attacks +;enforce_domain = false + +# The full public facing url you use in browser, used for redirects and emails +# If you use reverse proxy and sub path specify full url (with sub path) +root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana + +# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. +serve_from_sub_path = true +# Log web requests +;router_logging = false + +# the path relative working path +;static_root_path = public + +# enable gzip +;enable_gzip = false + +# https certs & key file +;cert_file = +;cert_key = + +# Unix socket gid +# Changing the gid of a file without privileges requires that the target group is in the group of the process and that the process is the file owner +# It is recommended to set the gid as http server user gid +# Not set when the value is -1 +;socket_gid = + +# Unix socket mode +;socket_mode = + +# Unix socket path +;socket = + +# CDN Url +;cdn_url = + +# Sets the maximum time using a duration format (5s/5m/5ms) before timing out read of an incoming request and closing idle connections. +# `0` means there is no timeout for reading the request. +;read_timeout = 0 + +# This setting enables you to specify additional headers that the server adds to HTTP(S) responses. +[server.custom_response_headers] +#exampleHeader1 = exampleValue1 +#exampleHeader2 = exampleValue2 + +#################################### GRPC Server ######################### +;[grpc_server] +;network = "tcp" +;address = "127.0.0.1:10000" +;use_tls = false +;cert_file = +;key_file = + +#################################### Database #################################### +[database] +# You can configure the database connection by specifying type, host, name, user and password +# as separate properties or as on string using the url properties. + +# Either "mysql", "postgres" or "sqlite3", it's your choice +;type = sqlite3 +;host = 127.0.0.1:3306 +;name = grafana +;user = root +# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" +;password = + +# Use either URL or the previous fields to configure the database +# Example: mysql://user:secret@host:port/database +;url = + +# For "postgres", use either "disable", "require" or "verify-full" +# For "mysql", use either "true", "false", or "skip-verify". +;ssl_mode = disable + +# For "postregs", use either "1" to enable or "0" to disable SNI +;ssl_sni = + +# Database drivers may support different transaction isolation levels. +# Currently, only "mysql" driver supports isolation levels. +# If the value is empty - driver's default isolation level is applied. +# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE". +;isolation_level = + +;ca_cert_path = +;client_key_path = +;client_cert_path = +;server_cert_name = + +# For "sqlite3" only, path relative to data_path setting +;path = grafana.db + +# Max idle conn setting default is 2 +;max_idle_conn = 2 + +# Max conn setting default is 0 (mean not set) +;max_open_conn = + +# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) +;conn_max_lifetime = 14400 + +# Set to true to log the sql calls and execution times. +;log_queries = + +# For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared) +;cache_mode = private + +# For "sqlite3" only. Enable/disable Write-Ahead Logging, https://sqlite.org/wal.html. Default is false. +;wal = false + +# For "mysql" only if migrationLocking feature toggle is set. How many seconds to wait before failing to lock the database for the migrations, default is 0. +;locking_attempt_timeout_sec = 0 + +# For "sqlite" only. How many times to retry query in case of database is locked failures. Default is 0 (disabled). +;query_retries = 0 + +# For "sqlite" only. How many times to retry transaction in case of database is locked failures. Default is 5. +;transaction_retries = 5 + +# Set to true to add metrics and tracing for database queries. +;instrument_queries = false + +################################### Data sources ######################### +[datasources] +# Upper limit of data sources that Grafana will return. This limit is a temporary configuration and it will be deprecated when pagination will be introduced on the list data sources API. +;datasource_limit = 5000 + +#################################### Cache server ############################# +[remote_cache] +# Either "redis", "memcached" or "database" default is "database" +;type = database + +# cache connectionstring options +# database: will use Grafana primary database. +# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. +# memcache: 127.0.0.1:11211 +;connstr = + +# prefix prepended to all the keys in the remote cache +; prefix = + +# This enables encryption of values stored in the remote cache +;encryption = + +#################################### Data proxy ########################### +[dataproxy] + +# This enables data proxy logging, default is false +;logging = false + +# How long the data proxy waits to read the headers of the response before timing out, default is 30 seconds. +# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set. +;timeout = 30 + +# How long the data proxy waits to establish a TCP connection before timing out, default is 10 seconds. +;dialTimeout = 10 + +# How many seconds the data proxy waits before sending a keepalive probe request. +;keep_alive_seconds = 30 + +# How many seconds the data proxy waits for a successful TLS Handshake before timing out. +;tls_handshake_timeout_seconds = 10 + +# How many seconds the data proxy will wait for a server's first response headers after +# fully writing the request headers if the request has an "Expect: 100-continue" +# header. A value of 0 will result in the body being sent immediately, without +# waiting for the server to approve. +;expect_continue_timeout_seconds = 1 + +# Optionally limits the total number of connections per host, including connections in the dialing, +# active, and idle states. On limit violation, dials will block. +# A value of zero (0) means no limit. +;max_conns_per_host = 0 + +# The maximum number of idle connections that Grafana will keep alive. +;max_idle_connections = 100 + +# How many seconds the data proxy keeps an idle connection open before timing out. +;idle_conn_timeout_seconds = 90 + +# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. +;send_user_header = false + +# Limit the amount of bytes that will be read/accepted from responses of outgoing HTTP requests. +;response_limit = 0 + +# Limits the number of rows that Grafana will process from SQL data sources. +;row_limit = 1000000 + +# Sets a custom value for the `User-Agent` header for outgoing data proxy requests. If empty, the default value is `Grafana/` (for example `Grafana/9.0.0`). +;user_agent = + +#################################### Analytics #################################### +[analytics] +# Server reporting, sends usage counters to stats.grafana.org every 24 hours. +# No ip addresses are being tracked, only simple counters to track +# running instances, dashboard and error counts. It is very helpful to us. +# Change this option to false to disable reporting. +;reporting_enabled = true + +# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs +;reporting_distributor = grafana-labs + +# Set to false to disable all checks to https://grafana.com +# for new versions of grafana. The check is used +# in some UI views to notify that a grafana update exists. +# This option does not cause any auto updates, nor send any information +# only a GET request to https://grafana.com/api/grafana/versions/stable to get the latest version. +;check_for_updates = true + +# Set to false to disable all checks to https://grafana.com +# for new versions of plugins. The check is used +# in some UI views to notify that a plugin update exists. +# This option does not cause any auto updates, nor send any information +# only a GET request to https://grafana.com to get the latest versions. +;check_for_plugin_updates = true + +# Google Analytics universal tracking code, only enabled if you specify an id here +;google_analytics_ua_id = + +# Google Analytics 4 tracking code, only enabled if you specify an id here +;google_analytics_4_id = + +# When Google Analytics 4 Enhanced event measurement is enabled, we will try to avoid sending duplicate events and let Google Analytics 4 detect navigation changes, etc. +;google_analytics_4_send_manual_page_views = false + +# Google Tag Manager ID, only enabled if you specify an id here +;google_tag_manager_id = + +# Rudderstack write key, enabled only if rudderstack_data_plane_url is also set +;rudderstack_write_key = + +# Rudderstack data plane url, enabled only if rudderstack_write_key is also set +;rudderstack_data_plane_url = + +# Rudderstack SDK url, optional, only valid if rudderstack_write_key and rudderstack_data_plane_url is also set +;rudderstack_sdk_url = + +# Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config +;rudderstack_config_url = + +# Rudderstack Integrations URL, optional. Only valid if you pass the SDK version 1.1 or higher +;rudderstack_integrations_url = + +# Intercom secret, optional, used to hash user_id before passing to Intercom via Rudderstack +;intercom_secret = + +# Controls if the UI contains any links to user feedback forms +;feedback_links_enabled = true + +#################################### Security #################################### +[security] +# disable creation of admin user on first start of grafana +;disable_initial_admin_creation = false + +# default admin user, created on startup +;admin_user = admin + +# default admin password, can be changed before first start of grafana, or in profile settings +;admin_password = admin + +# default admin email, created on startup +;admin_email = admin@localhost + +# used for signing +;secret_key = SW2YcwTIb9zpOOhoPsMm + +# current key provider used for envelope encryption, default to static value specified by secret_key +;encryption_provider = secretKey.v1 + +# list of configured key providers, space separated (Enterprise only): e.g., awskms.v1 azurekv.v1 +;available_encryption_providers = + +# disable gravatar profile images +;disable_gravatar = false + +# data source proxy whitelist (ip_or_domain:port separated by spaces) +;data_source_proxy_whitelist = + +# disable protection against brute force login attempts +;disable_brute_force_login_protection = false + +# set to true if you host Grafana behind HTTPS. default is false. +;cookie_secure = false + +# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" +;cookie_samesite = lax + +# set to true if you want to allow browsers to render Grafana in a ,