generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-beforeMerge22'
- Loading branch information
Showing
15 changed files
with
781 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ services: | |
networks: | ||
- mynetwork | ||
environment: | ||
MONGODB_URI: mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ | ||
MONGODB_URI: ${MONGODB_URI} | ||
|
||
userservice: | ||
container_name: userservice-${teamname:-defaultASW} | ||
|
@@ -37,7 +37,7 @@ services: | |
networks: | ||
- mynetwork | ||
environment: | ||
MONGODB_URI: mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ | ||
MONGODB_URI: ${MONGODB_URI} | ||
|
||
questionsgenerator: | ||
container_name: questionsgenerator-${teamname:-defaultASW} | ||
|
@@ -51,7 +51,7 @@ services: | |
networks: | ||
- mynetwork | ||
environment: | ||
MONGODB_URI: mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ | ||
MONGODB_URI: ${MONGODB_URI} | ||
|
||
record: | ||
container_name: record-${teamname:-defaultASW} | ||
|
@@ -66,7 +66,7 @@ services: | |
networks: | ||
- mynetwork | ||
environment: | ||
MONGODB_URI: mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ | ||
MONGODB_URI: ${MONGODB_URI} | ||
|
||
gatewayservice: | ||
container_name: gatewayservice-${teamname:-defaultASW} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | ||
const QuestionGenerator = require('./questionGenerator.js'); | ||
const Question = require('./question-model') | ||
const mongoURI = process.env.MONGODB_URI || 'mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ'; | ||
const mongoURI = process.env.MONGODB_URI; | ||
//|| 'mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ'; | ||
|
||
const app = express(); | ||
app.disable('x-powered-by'); | ||
|
@@ -51,6 +52,7 @@ app.post('/generateQuestions', async (req, res) => { | |
const generator = new QuestionGenerator(); | ||
await generator.loadTemplates(); | ||
await generator.generate10Questions(); | ||
res.status(200).json({ msg: "Questions generated successfully" }); | ||
}) | ||
|
||
async function getRandomQuestionByCategory(category) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | ||
const User = require('./auth-model'); | ||
const Game = require('./historial-model'); | ||
const mongoURI = process.env.MONGODB_URI || 'mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ'; | ||
const mongoURI = process.env.MONGODB_URI; | ||
|
||
const app = express(); | ||
app.disable('x-powered-by'); | ||
|
@@ -35,7 +35,7 @@ app.post('/saveQuestion', async (req, res) => { | |
isCorrect | ||
}); | ||
|
||
res.json({ msg: "Question saved successfully" }); | ||
res.status(200).json({ msg: "Question saved successfully" }); | ||
} catch (error) { | ||
res.status(500).json({ error: 'Internal Server Error' }); | ||
} | ||
|
@@ -60,7 +60,7 @@ app.post('/saveGameRecord', async (req, res) => { | |
|
||
delete gameQuestions[username]; | ||
|
||
res.json("Game record saved succesfully"); | ||
res.status(200).json("Game record saved succesfully"); | ||
} catch (error) { | ||
res.status(500).json({ error: "Internal Server Error" }); | ||
} | ||
|
@@ -76,7 +76,7 @@ app.post('/getGameRecord', async (req, res) => { | |
const games = await Game.find({ user: user._id }); | ||
|
||
|
||
res.json({ games: games }); | ||
res.status(200).json({ games: games }); | ||
} catch (error) { | ||
res.status(500).json({ error: "Internal Server Error" }); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const port = 8002; | |
app.use(express.json()); | ||
|
||
// Connect to MongoDB | ||
const mongoURI = process.env.MONGODB_URI || 'mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ'; | ||
const mongoURI = process.env.MONGODB_URI; | ||
|
||
mongoose.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true}); | ||
//const userCollection = mongoose.connection.useDb("WIQ").collection("users"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,9 @@ const port = 8001; | |
app.use(bodyParser.json()); | ||
|
||
// Connect to MongoDB | ||
const mongoURI = process.env.MONGODB_URI || 'mongodb+srv://wiq_es01b_admin:[email protected]/wiq?retryWrites=true&w=majority&appName=WIQ'; | ||
const mongoURI = process.env.MONGODB_URI; | ||
|
||
mongoose.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true}); | ||
//const userCollection = mongoose.connection.useDb("WIQ").collection("users"); | ||
|
||
// Function to validate required fields in the request body | ||
function validateRequiredFields(req, requiredFields) { | ||
|
Oops, something went wrong.