Skip to content

Commit

Permalink
Merge pull request #78 from Arquisoft/LaraFMz
Browse files Browse the repository at this point in the history
Añadido botón de cerrar sesión
  • Loading branch information
UO277938 authored Mar 27, 2024
2 parents e199764 + f1b9442 commit 0fa12a8
Show file tree
Hide file tree
Showing 14 changed files with 663 additions and 100 deletions.
18 changes: 18 additions & 0 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ app.get('/pregunta', async (req, res) => {
}
});

app.get('/updateCorrectAnswers', async (req, res) => {
console.log("prueba")
const { username } = req.body;
try {
const user = await User.findOne({ username });
if (!user) {
return res.status(404).json({ success: false, message: 'Usuario no encontrado' });
}
// Incrementa las respuestas correctas del usuario
user.correctAnswers += 1;
await user.save();
return res.status(200).json({ success: true, message: 'Respuesta correcta actualizada con éxito' });
} catch (error) {
console.error('Error al actualizar la respuesta correcta:', error);
return res.status(500).json({ success: false, message: 'Error al actualizar la respuesta correcta' });
}
});

// Start the gateway service
const server = app.listen(port, () => {
console.log(`Gateway Service listening at http://localhost:${port}`);
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
},
"dependencies": {
"path-browserify": "^1.0.1"
}
}
2 changes: 1 addition & 1 deletion userservice/authservice/auth-service.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const request = require('supertest');
const { MongoMemoryServer } = require('mongodb-memory-server');
const bcrypt = require('bcrypt');
const User = require('./auth-model');
const User = require('../../webapp/src/model/auth-model');

let mongoServer;
let app;
Expand Down
2 changes: 1 addition & 1 deletion userservice/userservice/user-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const express = require('express');
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
const bodyParser = require('body-parser');
const User = require('./user-model')
const User = require('../../webapp/src/model/auth-model');

const app = express();
const port = 8001;
Expand Down
Loading

0 comments on commit 0fa12a8

Please sign in to comment.