diff --git a/docker-compose.yml b/docker-compose.yml
index d8af9638..04eca969 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -23,7 +23,7 @@ services:
networks:
- mynetwork
environment:
- MONGODB_URI: mongodb://mongodb:27017/userdb
+ MONGODB_URI: mongodb://mongodb:27017/questiondb
retrieveservice:
container_name: retrieveservice-${teamname:-defaultASW}
@@ -37,7 +37,7 @@ services:
networks:
- mynetwork
environment:
- MONGODB_URI: mongodb://mongodb:27017/userdb
+ MONGODB_URI: mongodb://mongodb:27017/questiondb
authservice:
container_name: authservice-${teamname:-defaultASW}
diff --git a/questions/creationservice/creation-model.js b/questions/creationservice/creation-model.js
index bc9e641e..378bf26d 100644
--- a/questions/creationservice/creation-model.js
+++ b/questions/creationservice/creation-model.js
@@ -2,11 +2,26 @@ const mongoose = require('mongoose');
// Crea la base de datos con las columnas especificadas
const questionSchema = new mongoose.Schema({
- question: String,
- correctAnswer: String,
- incorrectAnswer1: String,
- incorrectAnswer2: String,
- incorrectAnswer3: String
+ question: {
+ type: String,
+ required: true,
+ },
+ correctAnswer: {
+ type: String,
+ required: true,
+ },
+ incorrectAnswer1: {
+ type: String,
+ required: true,
+ },
+ incorrectAnswer2: {
+ type: String,
+ required: true,
+ },
+ incorrectAnswer3: {
+ type: String,
+ required: true,
+ },
});
const Question = mongoose.model('Question', questionSchema);
diff --git a/questions/retrieveservice/retrieve-service.js b/questions/retrieveservice/retrieve-service.js
index 7d761233..3ece0bc3 100644
--- a/questions/retrieveservice/retrieve-service.js
+++ b/questions/retrieveservice/retrieve-service.js
@@ -1,6 +1,6 @@
const express = require('express');
const mongoose = require('mongoose');
-const fetch = require('node-fetch');
+const Question = require('./questionshistory-model')
const app = express();
const port = 8004;
@@ -11,10 +11,15 @@ const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/questiond
mongoose.connect(mongoUri);
-
app.post('/getquestionshistory', async (req, res) => {
+ const questions = await Question.find({});
- res.status(200).json('todo bien');
+ var solution = [];
+ questions.forEach(row => {
+ solution.push([row.question,row.correctAnswer,row.incorrectAnswer1,row.incorrectAnswer2,row.incorrectAnswer3]);
+ });
+
+ res.status(200).json(solution);
});
const server = app.listen(port, () => {
diff --git a/webapp/src/components/Game.js b/webapp/src/components/Game.js
index 99951e66..ccbda51e 100644
--- a/webapp/src/components/Game.js
+++ b/webapp/src/components/Game.js
@@ -109,7 +109,7 @@ const Game = () => {
Saber y Ganar Juego
Pregunta | +Opción correcta | +Opción incorrecta 1 | +Opción incorrecta 2 | +Opción incorrecta 3 | +
---|---|---|---|---|
{cell} | + ))} +