Skip to content

Commit

Permalink
Merge pull request #419 from Arquisoft/luis2
Browse files Browse the repository at this point in the history
Arreglos de seguridad
  • Loading branch information
uo283055 authored Apr 30, 2024
2 parents 1a506b1 + c1dd86f commit f03caa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,11 @@ app.get('/getAllGeneratedQuestions', async (req, res) => {

app.get('/getRecords/:userId', async (req, res) => {
try {

const userId = req.params.userId;

const userId = encodeURIComponent(req.params.userId);
const recordsResponse = await axios.get(`${recordServiceUrl}/getRecords/${userId}`);
res.json(recordsResponse.data);
} catch (error) {
res.status(500).json({ error: 'Error interno del servidor' });
res.status(500).json({ error: 'Error interno del servidor' });
}
});

Expand Down
3 changes: 2 additions & 1 deletion questions/generatedquestservice/generatedquest-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ mongoose.connect(mongoUri);
const doesQuestionExist = async (questionBody) => {
//devuelve true si la pregunta ya existe
try {
const safeQuestionBody = questionBody.toString();
const existingQuestion = await GeneratedQuestion.findOne({
generatedQuestionBody: { $eq: questionBody }
generatedQuestionBody: safeQuestionBody
});

return !!existingQuestion; // Convertir el resultado en un booleano
Expand Down

0 comments on commit f03caa7

Please sign in to comment.