diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc3e6a08..da48ef08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,10 +140,6 @@ jobs: needs: [e2e-tests] steps: - uses: actions/checkout@v4 - - name: Update OpenAPI configuration - run: | - DEPLOY_HOST=${{ secrets.DEPLOY_HOST }} - sed -i "s/SOMEIP/${DEPLOY_HOST}/g" gatewayservice/openapi.yaml - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 with: @@ -167,6 +163,4 @@ jobs: wget https://raw.githubusercontent.com/arquisoft/wiq_es2b/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_es2b/master/.env -O .env docker compose --profile prod down - docker compose --profile prod up -d --pull always - - + docker compose --profile prod up -d --pull always \ No newline at end of file diff --git a/docs/src/06_runtime_view.adoc b/docs/src/06_runtime_view.adoc index e10f375b..c9e002f6 100644 --- a/docs/src/06_runtime_view.adoc +++ b/docs/src/06_runtime_view.adoc @@ -3,63 +3,27 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-runtime-view]] == Runtime View - -[role="arc42help"] -**** -.Contents -The runtime view describes concrete behavior and interactions of the system’s building blocks in form of scenarios from the following areas: - -* important use cases or features: how do building blocks execute them? -* interactions at critical external interfaces: how do building blocks cooperate with users and neighboring systems? -* operation and administration: launch, start-up, stop -* error and exception scenarios - -Remark: The main criterion for the choice of possible scenarios (sequences, workflows) is their *architectural relevance*. It is *not* important to describe a large number of scenarios. You should rather document a representative selection. - -.Motivation -You should understand how (instances of) building blocks of your system perform their job and communicate at runtime. -You will mainly capture scenarios in your documentation to communicate your architecture to stakeholders that are less willing or able to read and understand the static models (building block view, deployment view). - -.Form -There are many notations for describing scenarios, e.g. - -* numbered list of steps (in natural language) -* activity diagrams or flow charts -* sequence diagrams -* BPMN or EPCs (event process chains) -* state machines -* ... - - -.Further Information - -See https://docs.arc42.org/section-6/[Runtime View] in the arc42 documentation. - -**** - -=== - - -* __ -* __ - -It is possible to use a sequence diagram: - -[plantuml,"Sequence diagram",png] +=== User plays a game +When the game is started, the app will call the createquestion service that is in charge of provide generated questions from wikidata information. +[plantuml,"Start a game",png] ---- -actor Alice -actor Bob -database Pod as "Bob's Pod" -Alice -> Bob: Authentication Request -Bob --> Alice: Authentication Response -Alice --> Pod: Store route -Alice -> Bob: Another authentication Request -Alice <-- Bob: another authentication Response +actor a as "User" +participant q as "Game GUI" +participant w as "CreateQuestions service" +database d as "Database" + + +a -> q: Start the game +loop number of questions +q -> w: Ask for a question +w -->q: Returns the question +q -> d: Store the question +q -> a: Returns the question + +a -> q: Pick an answer +q -> a: Shows if the answer was valid or not +a -> q: Asks for next question +end +q -> a: Show the game stats +q -> d: Store the game with questions, answers and stats ---- - -=== - -=== ... - -=== diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 9399e3a8..82e9f886 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -69,10 +69,10 @@ app.get('/getgamehistory/:username', async (req, res) => { -app.post('/createquestion', async (req, res) => { +app.get('/createquestion', async (req, res) => { try { // Create a petition to the URL (le llegará a creation-service.js) with the option /createquestion and the req.body params - const questionResponse = await axios.post(creationServiceUrl+'/createquestion', req.body); + const questionResponse = await axios.get(creationServiceUrl+'/createquestion', req.body); // Return a json response with what we obtained on the petition res.json(questionResponse.data); } catch (error) { @@ -80,10 +80,10 @@ app.post('/createquestion', async (req, res) => { } }); -app.post('/getquestionshistory', async (req, res) => { +app.get('/getquestionshistory', async (req, res) => { try { // Create a petition to the URL (le llegará a retrieve-service.js) with the option /getgeneratedquestions and the req.body params - const questionResponse = await axios.post(retrieveServiceUrl+'/getquestionshistory', req.body); + const questionResponse = await axios.get(retrieveServiceUrl+'/getquestionshistory', req.body); // Return a json response with what we obtained on the petition res.json(questionResponse.data); } catch (error) { diff --git a/questions/creationservice/creation-service.js b/questions/creationservice/creation-service.js index 7fc89323..1243145c 100644 --- a/questions/creationservice/creation-service.js +++ b/questions/creationservice/creation-service.js @@ -34,10 +34,14 @@ function getQuestionInfo(info){ // Select 4 random rows of the data for (let i = 0; i { +app.get('/createquestion', async (req, res) => { selectRandomQuery(); const apiUrl = `https://query.wikidata.org/sparql?query=${encodeURIComponent(queries[randomQuerySelector])}&format=json`; diff --git a/questions/retrieveservice/retrieve-service.js b/questions/retrieveservice/retrieve-service.js index 3ece0bc3..0d65c42a 100644 --- a/questions/retrieveservice/retrieve-service.js +++ b/questions/retrieveservice/retrieve-service.js @@ -11,7 +11,7 @@ const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/questiond mongoose.connect(mongoUri); -app.post('/getquestionshistory', async (req, res) => { +app.get('/getquestionshistory', async (req, res) => { const questions = await Question.find({}); var solution = []; diff --git a/webapp/src/components/Game.js b/webapp/src/components/Game.js index dab497f2..d48854c7 100644 --- a/webapp/src/components/Game.js +++ b/webapp/src/components/Game.js @@ -113,7 +113,7 @@ const Game = () => { const handleShowQuestion = async () => { try{ // It makes a petition to the api and store the response - const response = await axios.post(`${apiEndpoint}/createquestion`, { }); + const response = await axios.get(`${apiEndpoint}/createquestion`, { }); // Extract all the info of the response and store it setQuestionObject(response.data.responseQuestionObject); setCorrectOption(response.data.responseCorrectOption); diff --git a/webapp/src/components/HistoricalData.js b/webapp/src/components/HistoricalData.js index 379f4b8b..58ea119e 100644 --- a/webapp/src/components/HistoricalData.js +++ b/webapp/src/components/HistoricalData.js @@ -13,7 +13,7 @@ const HistoricalData = () => { const handleShowHistory = async () => { try{ // It makes a petition to the api and store the response - const response = await axios.post(`${apiEndpoint}/getquestionshistory`, { }); + const response = await axios.get(`${apiEndpoint}/getquestionshistory`, { }); setQuestionsHistory(response.data); }catch (error){ console.error('Error:', error);