Skip to content

Commit 27904ab

Browse files
committed
backend change
1 parent 04a722f commit 27904ab

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

backend/collaboration/src/routes/collaborationRoutes.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,33 @@ router.post(
181181
}
182182
);
183183

184+
// Update a session language by ID
185+
router.post(
186+
"/:id/updateLanguage",
187+
async (req: Request, res: Response) => {
188+
const { id } = req.params;
189+
190+
const updateSession: Partial<TSession> = {};
191+
192+
updateSession.language = req.body.language;
193+
194+
try {
195+
const session = await Session.findOne({ collabid: id }).exec();
196+
if (!session) {
197+
return res.status(404).json({ message: "Session not found" });
198+
}
199+
200+
const updatedSession = await Session.findOneAndUpdate(
201+
{ collabid: id },
202+
{ $set: updateSession }
203+
);
204+
res.status(200).json(updatedSession);
205+
} catch (error) {
206+
return res.status(500).send("Internal server error");
207+
}
208+
}
209+
);
210+
184211
// Delete a session by ID
185212
router.delete(
186213
"/:id",

0 commit comments

Comments
 (0)