Skip to content

Commit 183820f

Browse files
author
Aishwarya Nair
committed
Merge branch 'merge-services' into test-updated-merge
2 parents 80887f3 + 5f2dd27 commit 183820f

File tree

6 files changed

+40
-3
lines changed

6 files changed

+40
-3
lines changed

CollaborationService/controllers/collaborationController.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const collaborationService = require('../services/collaborationService');
2+
const collaborationDB = require('../database/collaborativeInputDb');
23

34
async function getHistory(req, res, next) {
45
try {
@@ -28,6 +29,28 @@ async function getHistory(req, res, next) {
2829
}
2930
}
3031

32+
async function deleteHistory(req, res, next) {
33+
try {
34+
const sessionId = req.params.sessionId;
35+
36+
const response = await collaborationDB.deleteCollaborativeInput(sessionId);
37+
38+
if (!response) {
39+
40+
await res.status(500).json({ status: 'error', message: 'Collaboration data does not exist'});
41+
42+
} else {
43+
await res.status(200).json({ status: 'success', message: 'Collaboration data deleted'});
44+
}
45+
46+
} catch (error) {
47+
console.log(error);
48+
49+
await res.status(500).json({ status: 'error', message: error })
50+
}
51+
}
52+
3153
module.exports = {
3254
getHistory,
55+
deleteHistory,
3356
};

CollaborationService/routes/collaborationRoute.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ const express = require('express');
22
const router = express.Router();
33
const controller = require('../controllers/collaborationController');
44

5+
router.get('/', (req, res) => {
6+
res.status(200).send('<h1>Collaboration Service is up!</h1>');
7+
});
8+
59
router.get('/getCollaborationHistory/:sessionId', controller.getHistory);
610

11+
router.delete('/deleteSessionHistory/:sessionId', controller.deleteHistory);
12+
713
module.exports = router;

CommunicationService/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const io = new Server(server, {
1515
});
1616

1717
app.use(cors());
18-
app.use(express.static(__dirname + '/services')); // change after done to app.use(express.static(__dirname);
18+
app.use(express.static(__dirname));
1919
app.use(express.urlencoded({ extended: true })); // use express's built-in middleware
2020
app.use(express.json()); // This is the middleware to handle JSON payloads
2121

2222
app.get('/', (req, res) => {
23-
res.sendFile(join(__dirname, 'services', 'index.html'));
23+
res.status(200).send('<h1>Communication service is up!</h1>');
2424
});
2525

2626
io.on('connection', async(socket) => {

GptService/routes/gptRoute.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ const express = require('express');
22
const router = express.Router();
33
const controller = require('../controllers/gptController');
44

5+
router.get('/', (req, res) => {
6+
res.status(200).send('<h1>GPT Service is up!</h1>');
7+
});
8+
59
router.post('/generate', controller.getResponse);
610

711
router.delete('/exitGpt/:userId', controller.exitSession);

MatchingService/routes/matchingRoute.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ const express = require('express');
22
const router = express.Router();
33
const controller = require('../controllers/matchingController');
44

5+
router.get('/', (req, res) => {
6+
res.status(200).send('<h1>Matching Service is up!</h1>');
7+
});
8+
59
router.post('/home/:userId', controller.findMatch);
610

711
router.get('/getMatchSession/:userId', controller.getActiveSession);

QuestionService/controllers/questionController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const getMatchQuestion = async (req, res) => {
2626
if (language === "SQL") {
2727
actualLanguage = "SQL";
2828
} else {
29-
actualLanguage = "Other Languages";
29+
actualLanguage = language;
3030
}
3131
aggregationPipeline.push({ $match: { language: actualLanguage } });
3232
}

0 commit comments

Comments
 (0)