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

Actualizaciones #425

Merged
merged 18 commits into from
Apr 30, 2024
Merged
Changes from 6 commits
Commits
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
6 changes: 2 additions & 4 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
@@ -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' });
}
});

3 changes: 2 additions & 1 deletion questions/generatedquestservice/generatedquest-service.js
Original file line number Diff line number Diff line change
@@ -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