Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
algarfer committed Apr 30, 2024
2 parents aec9c13 + ea5b07f commit 59d0633
Show file tree
Hide file tree
Showing 63 changed files with 49,132 additions and 17,949 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ on:
branches:
- master
- develop
- coverage_fix
pull_request:
branches:
- master
- develop
- coverage_fix
types: [opened, synchronize, reopened]

jobs:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ jobs:
ELASTIC_PASSWORD: ${{ secrets.ELASTIC_PASSWORD }}
LOGSTASH_INTERNAL_PASSWORD: ${{ secrets.LOGSTASH_INTERNAL_PASSWORD }}
KIBANA_SYSTEM_PASSWORD: ${{ secrets.KIBANA_SYSTEM_PASSWORD }}
CUSTOM_USER: ${{ secrets.CUSTOM_USER }}
CUSTOM_USER_PASSWORD: ${{ secrets.CUSTOM_USER_PASSWORD }}

docker-push-elasticsearch:
name: Push elasticsearch service Docker Image to GitHub Packages
Expand Down Expand Up @@ -391,7 +389,6 @@ jobs:
GF_SECURITY_ADMIN_PASSWORD: ${{ secrets.GF_SECURITY_ADMIN_PASSWORD }}
GF_SERVER_SERVE_FROM_SUB_PATH: false
GF_SERVER_DOMAIN: cyt.is-cool.dev
GF_SERVER_HTTP_PORT: 443
GF_SERVER_PROTOCOL: https

docker-push-prometheus:
Expand Down
4 changes: 2 additions & 2 deletions cyt-utils/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cyt-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cyt-utils",
"version": "4.1.0",
"version": "6.0.0",
"description": "A variety of utilities for the project",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ services:
- "9090:9090"
depends_on:
- gatewayservice
restart:
always

grafana:
image: ghcr.io/arquisoft/wiq_es05b/grafana:latest
Expand All @@ -233,6 +235,7 @@ services:
- "9091:9091"
depends_on:
- prometheus
restart: always

volumes:
mongo_data:
Expand Down
3 changes: 3 additions & 0 deletions docs/src/11_technical_risks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ internal and external technical risks, as well as the technical debts that shoul

=== Technical risks

We consider a technical risk a potential event that can threaten the successful completion of the project, delay timelines, increase costs, or even lead to project failure if not properly managed.
The following subsections outline the internal and external technical risks that have been identified for the project.

==== Internal

[options="header",cols="1,3,3"]
Expand Down
10 changes: 2 additions & 8 deletions gatewayservice/routes/authRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ module.exports = (app, axios) => {
app.post("/login", async (req, res, next) => {
axios.post(`${authServiceUrl}/login`, req.body)
.then(response => res.json(response.data))
.catch(e => {
if(e.code) return next(e.code)
next({status: e.response.status, error: e.response.data})
});
.catch(e => next({status: e.response.status, ...e.response.data}));
});

app.get("/validate/:token", (req, res, next) => {
axios
.get(`${authServiceUrl}/validate/${req.params.token}`)
.then(({ data }) => res.json({valid: data.valid}))
.catch(e => {
if(e.code) return next(e.code)
next({status: e.response.status, error: e.response.data})
});
.catch(e => next({status: e.response.status, ...e.response.data}));
});
};
2 changes: 0 additions & 2 deletions gatewayservice/routes/historyRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ module.exports = (app, axios, authMiddleware) => {
axios.get(order ? url + `?order=${encodeURIComponent(order)}`: url)
.then(async response => {
response.data = await Promise.all(response.data.map(async record => {
try {
let response = await axios.get(`${userServiceUrl}/user/${record.userId}`)
delete record.userId
record.user = response.data.username
return record
} catch (error) { throw(error) }
}))
res.status(response.status).json(response.data)
})
Expand Down
15 changes: 5 additions & 10 deletions gatewayservice/routes/usersRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@ module.exports = (app, axios, authTokenMiddleware) => {
})
.catch((error) => {
let e = error.error || i18next.t("error_login_service_unable")
if (error.code && error.code.includes("ECONNREFUSED"))
if (error.code?.includes("ECONNREFUSED"))
e = { error: i18next.t("error_service_unavailable") }
res.json({ message: response.data.message, error: e })
})
})
.catch(() => next({ error: i18next.t("error_adding_user") }));
.catch(e => errorHandler(e, next));
});

app.get("/user/:userId", authTokenMiddleware, (req, res, next) => {
const { userId } = req.params
axios
.get(`${userServiceUrl}/user/${userId}`)
.then(({ data }) => res.json(data))
.catch(e => {
if(e.code && e.code === "ECONNREFUSED") return next(e.code)
next({status: e.response.status, ...e.response.data})
})
.catch(e => errorHandler(e, next));
});

app.get("/users/search/:filter", async (req, res, next) => {
Expand All @@ -49,10 +46,8 @@ module.exports = (app, axios, authTokenMiddleware) => {
axios
.get(`${userServiceUrl}/users/search/${filter}`)
.then(({ data }) => res.json(data))
.catch(e => {
if(e.code && e.code === "ECONNREFUSED") return next(e.code)
next({status: e.response.status, ...e.response.data})
});
.catch(e => errorHandler(e, next));

});

app.post("/users/social/sendrequest", authTokenMiddleware, async (req, res, next) => {
Expand Down
14 changes: 14 additions & 0 deletions jordi/groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,19 @@
"geography",
"politics"
]
},
{
"groupId": "religion",
"questionItem": "Q6256",
"answer": "P140",
"statements": [
"The religion of <QuestionItem> is...",
"What is the religion of <QuestionItem>",
"Select the religion of <QuestionItem>"
],
"categories": [
"religion",
"geography"
]
}
]
2 changes: 1 addition & 1 deletion jordi/jordi-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe("[Jordi Service] - /categories", () => {
expect(response.status).toBe(200);
expect(response).toHaveProperty("text");

expect(response.text).toEqual("[\"area\",\"capitals\",\"continent\",\"currency\",\"economy\",\"gdp\",\"geography\",\"languages\",\"politics\",\"population\",\"president\"]");
expect(response.text).toEqual("[\"area\",\"capitals\",\"continent\",\"currency\",\"economy\",\"gdp\",\"geography\",\"languages\",\"politics\",\"population\",\"president\",\"religion\"]");

await request(app).get("/removeAllGroups");

Expand Down
8 changes: 5 additions & 3 deletions jordi/repositories/questionRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ module.exports = {
])
.toArray();

for (let i = 0; i < result.length; i++) {
const question = result[i];
for (const question of result) {
question.options = await this.getDistinctOptions(question);
}

Expand Down Expand Up @@ -100,7 +99,10 @@ module.exports = {

result.push(question.answer);

return result; } catch (error) { throw error.message; }
return result;
} catch (error) {
throw error.message;
}
},

findQuestionById: async function (id) {
Expand Down
4 changes: 4 additions & 0 deletions logging/setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ COPY start.sh .
COPY lib.sh .
COPY roles/* ./roles/

USER root
RUN chmod +x ./start.sh
USER 1000

ENTRYPOINT ["./start.sh"]
1 change: 1 addition & 0 deletions webapp/e2e/test-environment-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async function startServer() {
userhistory = await require("../../userhistory/history-service");

await testUtils.insertSampleUser(axios);
await testUtils.insertGroups(axios);

}
startServer().then(e=>{});
134 changes: 133 additions & 1 deletion webapp/e2e/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,137 @@ module.exports = {
}catch(error){
console.error("Error inserting sample user for e2e tests: " + error)
}
},
insertGroups: async (axios) => {
try{
console.log("Inserting groups for e2e tests...")
await axios.post(`http://localhost:8003/addGroups`, groups)
await axios.get(`http://localhost:8003/gen`)
}catch(error){
console.error("Error inserting groups for e2e tests: " + error)
}
}
}

const groups = [
{
"groupId": "capitals",
"questionItem": "Q6256",
"answer": "P36",
"statements": [
"The capital of <QuestionItem> is...",
"What is the capital of <QuestionItem>?",
"Select the capital of <QuestionItem>"
],
"categories": [
"capitals",
"geography"
]
},
{
"groupId": "continent",
"questionItem": "Q6256",
"answer": "P30",
"statements": [
"The continent of <QuestionItem> is...",
"What is the continent of <QuestionItem>?",
"Select the continent of <QuestionItem>"
],
"categories": [
"continent",
"geography"
]
},
{
"groupId": "languages",
"questionItem": "Q6256",
"answer": "P37",
"statements": [
"The language spoken in <QuestionItem> is...",
"What is the language spoken in <QuestionItem>?",
"Select the language spoken in <QuestionItem>"
],
"categories": [
"languages",
"geography"
]
},
{
"groupId": "population",
"questionItem": "Q6256",
"answer": "P1082",
"statements": [
"The population of <QuestionItem> is...",
"What is the population of <QuestionItem>",
"Select the population of <QuestionItem>"
],
"categories": [
"population",
"geography"
],
"plainText": true,
"filter": "FILTER(LANG(?question) = 'en')"
},
{
"groupId": "area",
"questionItem": "Q6256",
"answer": "P2046",
"statements": [
"The area of <QuestionItem> is...",
"What is the area of <QuestionItem>",
"Select the area of <QuestionItem>"
],
"categories": [
"area",
"geography"
],
"plainText": true,
"filter": "FILTER(LANG(?question) = 'en')"
},
{
"groupId": "gdp",
"questionItem": "Q6256",
"answer": "P2131",
"statements": [
"The GDP of <QuestionItem> is...",
"What is the GDP of <QuestionItem>",
"Select the GDP of <QuestionItem>"
],
"categories": [
"gdp",
"geography"
],
"plainText": true,
"filter": "FILTER(LANG(?question) = 'en')"
},
{
"groupId": "currency",
"questionItem": "Q6256",
"answer": "P38",
"statements": [
"The currency of <QuestionItem> is...",
"What is the currency of <QuestionItem>",
"Select the currency of <QuestionItem>"
],
"categories": [
"currency",
"geography",
"economy"
]
},
{
"groupId": "president",
"questionItem": "Q6256",
"answer": "P35",
"statements": [
"The president of <QuestionItem> is...",
"Who is the president of <QuestionItem>",
"Select the president of <QuestionItem>"
],
"categories": [
"president",
"geography",
"politics"
]
}
}
]
Loading

0 comments on commit 59d0633

Please sign in to comment.