Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #134

Merged
merged 182 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
2d6536c
Merge branch 'develop' into wikidata_queries
uo288574 Mar 29, 2024
7f0fb21
Merge branch 'develop' into wikidata_queries
uo288574 Apr 1, 2024
c80b73c
Added openapi file for the api
MarcosBarrilVillaverde Apr 5, 2024
5867f64
Minor fixes realeted to speeling and indexing
MarcosBarrilVillaverde Apr 5, 2024
73efd4c
new queries
uo288574 Apr 8, 2024
908969d
Added to the authentication and user registration services the openap…
MarcosBarrilVillaverde Apr 9, 2024
c00bc9d
borrada query innecesaria
uo288574 Apr 10, 2024
2014423
Added apis-gateway system
MarcosBarrilVillaverde Apr 11, 2024
0fdfc4f
Merge branch 'master' into game_historic_service
MarcosBarrilVillaverde Apr 12, 2024
b8c9b80
Modify user-service and user-stats-service to get extra information n…
MarcosBarrilVillaverde Apr 12, 2024
0dc405b
Modifies API's gateway so it correctly send user information
MarcosBarrilVillaverde Apr 12, 2024
d02d9dd
Merge branch 'master' into wikidata_queries
uo288574 Apr 12, 2024
4a35c17
consultation for country and monument
uo288574 Apr 12, 2024
894b774
Small fix on services
MarcosBarrilVillaverde Apr 13, 2024
498f064
Changes in the interface so know it can check information about the user
MarcosBarrilVillaverde Apr 13, 2024
ecd3c5a
Fixed missing fields in the structure of user-stats-model
MarcosBarrilVillaverde Apr 13, 2024
c2ee62c
F1 queries
uo288574 Apr 14, 2024
baf2cfd
configure topics
uo288574 Apr 15, 2024
aafeba0
configure number of questions
uo288574 Apr 15, 2024
626db8f
we dont need thaat file
uo288574 Apr 17, 2024
af61ad6
Minor fixes on user-stat-model
MarcosBarrilVillaverde Apr 17, 2024
f0a0444
Updated openapi file for user-stat-service
MarcosBarrilVillaverde Apr 17, 2024
75d3e62
sport queries
uo288574 Apr 18, 2024
ac99ae5
new query
uo288574 Apr 18, 2024
57f811e
configure number of errors
uo288574 Apr 18, 2024
ef8150d
deleted commented code not needed
uo288574 Apr 18, 2024
0f7025e
Fix on test as model related to games stored data is changed
MarcosBarrilVillaverde Apr 19, 2024
369dce0
Small fix
MarcosBarrilVillaverde Apr 19, 2024
74190f7
Small fixes to tests cases
MarcosBarrilVillaverde Apr 19, 2024
cb35bc8
New test case added
MarcosBarrilVillaverde Apr 19, 2024
658f320
Added new GET endpoint on the service
AbelMH1 Apr 19, 2024
4af160a
Merge branch 'develop' into service_question_generator
AbelMH1 Apr 19, 2024
f97fdef
Modified sonar properties
MarcosBarrilVillaverde Apr 19, 2024
0f0960a
Small security fix
MarcosBarrilVillaverde Apr 19, 2024
bd0443f
test to access to history
uo288574 Apr 22, 2024
b1a58a8
minor fix
uo288574 Apr 22, 2024
77369ef
another change
uo288574 Apr 22, 2024
23ce7a9
test to access to appQuestion on nav
uo288574 Apr 22, 2024
63e22fd
test to find text of Game Configuration
uo288574 Apr 22, 2024
e4f6614
dependency remove
uo288574 Apr 22, 2024
3dbe634
trying to solve errors
uo288574 Apr 22, 2024
c136963
added fields for requesting first and last name information from add …
uo288574 Apr 23, 2024
b92ea11
fixed test to add user correctly
uo288574 Apr 23, 2024
f6c3a79
changed the text from English to Spanish
uo288574 Apr 23, 2024
6c587f8
minor fix
uo288574 Apr 23, 2024
b9c5500
another minor fix
uo288574 Apr 23, 2024
3620129
fixed test to handle error when adding user
uo288574 Apr 23, 2024
6b4c954
unnecessary code
uo288574 Apr 23, 2024
c7ee24c
added a field to confirm the password
uo288574 Apr 23, 2024
b13b224
added "prod" to docker compose
uo288574 Apr 23, 2024
7404ac5
test to check different passwords
uo288574 Apr 23, 2024
9837b2e
test to check that is necessary to introduce name or surname
uo288574 Apr 23, 2024
96aaa35
change appbar to stay at the top of the page
uo288574 Apr 23, 2024
c51ad40
traduce login text
uo288574 Apr 23, 2024
498ba1f
Merge branch 'service_question_generator' into webapp_interface
alegarman2002 Apr 23, 2024
53a64cc
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 23, 2024
fa2a5e6
Adding the functionality to generate x number of questions with x opt…
alegarman2002 Apr 24, 2024
66f892d
translation
uo288574 Apr 24, 2024
deaa75f
test for the game configuration modified
uo288574 Apr 24, 2024
243e1c1
export problem solved
uo288574 Apr 24, 2024
3ba6f35
trying to solve export problems
uo288574 Apr 24, 2024
c78fa42
updated another things to make the game parametrizable
alegarman2002 Apr 24, 2024
47118a2
FIxed problem with the own branch
alegarman2002 Apr 24, 2024
1aee7dd
Fixed checkbox problem
marco-qg Apr 24, 2024
6db92b4
Fixed test
marco-qg Apr 24, 2024
c8f9f86
Fixed my fix
marco-qg Apr 24, 2024
4c61bfc
Nav and footer upgraded
marco-qg Apr 24, 2024
aa1c00a
Improved config style
marco-qg Apr 24, 2024
5bb6bfb
game configuration test
uo288574 Apr 24, 2024
be46417
new test
uo288574 Apr 24, 2024
d1e061e
test to check number of elements
uo288574 Apr 24, 2024
f36bcd3
minor fix
uo288574 Apr 24, 2024
01b03c6
trying to reduce code duplication
uo288574 Apr 24, 2024
e7693ea
trying to reduce code duplication
uo288574 Apr 24, 2024
45d2a41
reduce code
uo288574 Apr 24, 2024
2099fbb
modified Reliability Rating
uo288574 Apr 24, 2024
0db60ea
issues
uo288574 Apr 24, 2024
3850339
issues
uo288574 Apr 24, 2024
95227de
trying to inc coverage
uo288574 Apr 24, 2024
21063b7
minor fix
uo288574 Apr 24, 2024
ea4dc94
test
uo288574 Apr 24, 2024
64282b0
deleted the test
uo288574 Apr 24, 2024
240d0cb
Fixed all problems with game params and done it
alegarman2002 Apr 24, 2024
6eb0c15
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 24, 2024
7808ccd
Refactoriced WikidataExtractor in order to make it extensible and to …
AbelMH1 Apr 25, 2024
431dea8
Merge branch 'wikidata_queries' into service_question_generator
AbelMH1 Apr 25, 2024
3dcc27d
Añadido filtro a los datos obtenidos de wikidata para los campos no d…
AbelMH1 Apr 25, 2024
60af73c
Fixed bug that was producing the queries to be executed when starting…
AbelMH1 Apr 25, 2024
773a732
test for "/history/questions" (???)
uo288574 Apr 26, 2024
990f2ef
try to add test
uo288574 Apr 26, 2024
eb17e0c
minor fix
uo288574 Apr 26, 2024
0d747f5
remove test
uo288574 Apr 26, 2024
cf9f219
unnecesary code
uo288574 Apr 26, 2024
f341b57
unnecessary code
uo288574 Apr 26, 2024
9a4916d
unnecessary code
uo288574 Apr 26, 2024
f8e9e29
test for game config
uo288574 Apr 26, 2024
b877ddc
add test for number of questions and number for answers
uo288574 Apr 26, 2024
01b4625
minor fix
uo288574 Apr 26, 2024
0df2783
minor fix
uo288574 Apr 26, 2024
6a6f533
Added the chemical elements data extraction
AbelMH1 Apr 26, 2024
aebdfeb
last minor fix
uo288574 Apr 26, 2024
f25b65b
unnecesary code
uo288574 Apr 26, 2024
e322573
check that number of answars cant be < 2
uo288574 Apr 26, 2024
248a26b
reduce duplicate code
uo288574 Apr 26, 2024
f6bd222
test fix
uo288574 Apr 26, 2024
66241d4
Fixed last problems with the question generator
alegarman2002 Apr 26, 2024
69e4881
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 26, 2024
0a40591
review last test
uo288574 Apr 26, 2024
7792ec4
Añadido spinner
marco-qg Apr 26, 2024
416eaee
Update apisgatewayservice/monitoring/prometheus/prometheus.yml
AbelMH1 Apr 26, 2024
3356971
Merge pull request #123 from Arquisoft/game_historic_service
AbelMH1 Apr 26, 2024
3f4d54f
El test que falla es porque no esta mockeado
alegarman2002 Apr 26, 2024
17d1dfa
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 26, 2024
7b15a36
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
marco-qg Apr 26, 2024
d36c800
Added queries and templates for extracting data about different topics
AbelMH1 Apr 26, 2024
48723ac
at the moment we comment this
uo288574 Apr 27, 2024
4ec1cd9
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
uo288574 Apr 27, 2024
b5370e2
fixed
uo288574 Apr 27, 2024
4f3bf4f
issues
uo288574 Apr 27, 2024
84f3c50
first version of another game
uo288574 Apr 27, 2024
f601860
critical security issues fixed
uo288574 Apr 27, 2024
39d360c
Test for the calculator game. Review secureRandomNumber function of U…
uo288574 Apr 27, 2024
277f9c9
possible solution for secureRandomNumber but I think it'll create sec…
uo288574 Apr 27, 2024
87b4817
Game service test but we have to check the comented one
alegarman2002 Apr 27, 2024
9cdf077
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 27, 2024
cab0dc2
Merge branch 'develop' into webapp_interface
alegarman2002 Apr 27, 2024
c9d3a9f
Test 2 arreglado, falta el 3o
marco-qg Apr 27, 2024
8d0ea3d
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
marco-qg Apr 27, 2024
0dde584
Modified spinner
marco-qg Apr 27, 2024
7e4c972
Game service test finished
alegarman2002 Apr 27, 2024
f5e8815
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 27, 2024
7a9fc07
Creation of the container of apisgatewayservice
alegarman2002 Apr 27, 2024
351dd34
Added the extraction templates for new data topics and a new method t…
AbelMH1 Apr 28, 2024
295bb61
Fixed languaje on the query MonumentoYPais
AbelMH1 Apr 28, 2024
455170b
modified tests for handling spinners
uo288574 Apr 28, 2024
f3b51fb
added menu checks for the new game
uo288574 Apr 28, 2024
4b3ab9e
help test
uo288574 Apr 28, 2024
be4601c
spinner test
uo288574 Apr 28, 2024
b0e3e53
button test
uo288574 Apr 28, 2024
24d9aeb
utils test
uo288574 Apr 28, 2024
c2fc32e
fixed security hotspots and some issues
uo288574 Apr 28, 2024
e2c79d8
menu test
uo288574 Apr 28, 2024
149ff6a
Fixed some problems with the question management
alegarman2002 Apr 28, 2024
2dfba98
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 28, 2024
d66c6bb
test for the gateway service we have to revise it
alegarman2002 Apr 28, 2024
977843e
Added to sonar gameservice test
alegarman2002 Apr 28, 2024
850ae58
Moddified the information showed in the WikidataExtractor console logs
AbelMH1 Apr 28, 2024
1adf724
Modified the information showed in the QuestionGenerator console logs
AbelMH1 Apr 28, 2024
4560018
Commented Develop only endpoints
AbelMH1 Apr 28, 2024
4f29434
npm audit fix
AbelMH1 Apr 28, 2024
75489c4
Added containers to the sonar-cloud code checker
AbelMH1 Apr 28, 2024
12b75bd
Merge branch 'develop' into service_question_generator
AbelMH1 Apr 28, 2024
e0624cf
Trying to clean my code
AbelMH1 Apr 29, 2024
4beba06
Fixed all problems with the game and fixed the problem with the game …
alegarman2002 Apr 29, 2024
67d4454
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
uo288574 Apr 29, 2024
a48a21c
calculator game fixed. Test for this game commented because an error …
uo288574 Apr 29, 2024
a57bfab
app test
uo288574 Apr 29, 2024
9d75f78
Fixed first game
alegarman2002 Apr 29, 2024
1596792
Fixed calculator
alegarman2002 Apr 29, 2024
690cc42
Mejora del historial Arquisoft/wiq_es6c#131 done
marco-qg Apr 29, 2024
0c925cb
Nav fixed
marco-qg Apr 29, 2024
97fddc2
change color of bts
uo288574 Apr 29, 2024
a45658d
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
uo288574 Apr 29, 2024
dfbd7c8
extracted esperar
marco-qg Apr 29, 2024
5165225
Calculator improved
marco-qg Apr 29, 2024
06662e8
Checks to ensure that a user is not registered with blank fields and …
uo288574 Apr 29, 2024
bf06245
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
uo288574 Apr 29, 2024
fcf79dc
Ya se actualizan las preguntas, falta meter tiempo y almacenar la par…
marco-qg Apr 29, 2024
72c89a6
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
marco-qg Apr 29, 2024
9af5072
Avance calculadora
marco-qg Apr 29, 2024
d4c9065
Fixed problem with storage game
alegarman2002 Apr 29, 2024
b10c335
it doesn't work that two users cannot register with the same name
uo288574 Apr 29, 2024
43ce04f
Calculator works!!!
marco-qg Apr 29, 2024
4fe11ff
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
marco-qg Apr 29, 2024
9f7d507
Shuffled array
marco-qg Apr 29, 2024
f35edf3
Fixed problem with game number of questions if we switch view
alegarman2002 Apr 29, 2024
5bd48c4
Merge branch 'webapp_interface' of https://github.com/Arquisoft/wiq_e…
alegarman2002 Apr 29, 2024
6205aba
Merge pull request #124 from Arquisoft/webapp_interface
alegarman2002 Apr 29, 2024
a6f912c
Extracted the identical data models from the two services to a common…
AbelMH1 Apr 29, 2024
f3b4bfd
Corrected the data extraction interval time for production
AbelMH1 Apr 29, 2024
38288c2
Merge branch 'develop' into service_question_generator
AbelMH1 Apr 29, 2024
4d733eb
Merge pull request #132 from Arquisoft/service_question_generator
alegarman2002 Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- run: npm --prefix storeQuestionService ci
- run: npm --prefix userStatsService ci
- run: npm --prefix gameservice ci
- run: npm --prefix gameservice ci
- run: npm --prefix users/authservice test -- --coverage
- run: npm --prefix users/userservice test -- --coverage
- run: npm --prefix gatewayservice test -- --coverage
- run: npm --prefix webapp test -- --coverage
- run: npm --prefix storeQuestionService test -- --coverage
- run: npm --prefix userStatsService test -- --coverage
- run: npm --prefix gameservice test -- --coverage
# - run: npm --prefix gameservice test -- --coverage
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: npm --prefix webapp test -- --coverage
- run: npm --prefix storeQuestionService test -- --coverage
- run: npm --prefix userStatsService test -- --coverage
#- run: npm --prefix gameservice test -- --coverage
- run: npm --prefix gameservice test -- --coverage
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
Expand Down
2 changes: 2 additions & 0 deletions apisgatewayservice/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
17 changes: 17 additions & 0 deletions apisgatewayservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use an official Node.js runtime as a parent image
FROM node:20

# Set the working directory in the container
WORKDIR /usr/src/apisgatewayservice

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install app dependencies
RUN npm install

# Copy the app source code to the working directory
COPY . .

# Define the command to run your app
CMD ["node", "apis-gateway-service.js"]
57 changes: 57 additions & 0 deletions apisgatewayservice/apis-gateway-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const express = require('express');
const axios = require('axios');
const cors = require('cors');
const promBundle = require('express-prom-bundle');

const app = express();
const port = 8100;

const storeQuestionsServiceUrl = process.env.STORE_QUESTION_SERVICE_URL || 'http://localhost:8004'
const userStatsServiceUrl = process.env.USER_STATS_SERVICE_URL || 'http://localhost:8003';
const userServiceUrl = process.env.USER_SERVICE_URL || 'http://localhost:8001';

app.use(cors());
app.use(express.json());

//Prometheus configuration
const metricsMiddleware = promBundle({includeMethod: true});

function catchAction(error, res) {
if ('response' in error && 'status' in error.response && 'data' in error.response && 'error' in error.response.data)
res.status(error.response.status).json({ error: error.response.data.error });
else if('response' in error && 'status' in error.response){
res.status(error.response.status).json({ error: 'Unknown error' });
} else {
console.log("Unknown error: " + error);
}
// } else {
// res.status(500).json({ error: 'Internal server error' });
// }
}

app.use(metricsMiddleware);

app.get('/users', async (req, res) => {
try {
const response = await axios.get(userServiceUrl+`/users`);
res.json(response.data);
} catch (error) {
catchAction(error, res)
}
})

app.get('/history/questions', async (req, res) => {
try {
const response = await axios.get(storeQuestionsServiceUrl+'/history/questions');
res.json(response.data);
} catch (error) {
catchAction(error, res)
}
})

// Start the gateway service
const server = app.listen(port, () => {
console.log(`Gateway Service listening at http://localhost:${port}`);
});

module.exports = server
64 changes: 64 additions & 0 deletions apisgatewayservice/apis-gateway-service.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const request = require('supertest');
const axios = require('axios');
const app = require('./apis-gateway-service');

afterAll(async () => {
app.close();
});

jest.mock('axios');

describe('User Service', () => {
describe('/users', () => {
it('should return user information', async () => {
const mockUsers = [
{ username: 'user1', createdAt: new Date() },
{ username: 'user2', createdAt: new Date() }
];
User.find = jest.fn().mockResolvedValue(mockUsers);

const res = await request(app).get('/users');

expect(res.statusCode).toEqual(200);

expect(res.body).toEqual(mockUsers);
});

it('should handle errors', async () => {

User.find = jest.fn().mockRejectedValue(new Error('Database error'));

const res = await request(app).get('/users');

expect(res.statusCode).toEqual(500);

expect(res.body).toEqual({ error: 'Database error' });
});
});
});


describe('Gateway Service', () => {
describe('/history/questions', () => {
it('should return all questions', async () => {
const mockData = [{
pregunta: '¿Cuál es la capital de la comunidad autónoma de Castilla y León?',
respuesta_correcta: 'Ninguna',
respuestas_incorrectas: ['Segovia','León','Valladolid']
}];
axios.get.mockResolvedValue({ data: mockData });

const res = await request(app).get('/history/questions');
expect(res.statusCode).toEqual(200);
expect(res.body).toEqual(mockData);
});

it('should handle errors', async () => {
axios.get.mockRejectedValue(new Error('Error'));

const res = await request(app).get('/history/questions');
expect(res.statusCode).toEqual(500);
expect(res.body).toEqual({ error: 'Error' });
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: 1

providers:
- name: 'Prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /etc/grafana/provisioning/dashboards
Loading