File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
backend/collaboration/src/routes Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,33 @@ router.post(
181
181
}
182
182
) ;
183
183
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
+
184
211
// Delete a session by ID
185
212
router . delete (
186
213
"/:id" ,
You can’t perform that action at this time.
0 commit comments