@@ -216,9 +216,9 @@ public ResponseEntity<JSONObject> getAssistants(@PathVariable String roomName, H
216216 *
217217 * @return the position in the queue
218218 */
219- @ JsonView ( User . NameOnly . class )
219+ @ SuppressWarnings ( "unchecked" )
220220 @ PostMapping ("/room/{roomName}/raiseHand" )
221- public ResponseEntity <Integer > raiseHand (@ PathVariable String roomName , @ RequestBody String nickname , @ RequestBody String avatar , @ RequestBody String connectionId , HttpServletRequest request ) {
221+ public ResponseEntity <Integer > raiseHand (@ PathVariable String roomName , @ RequestBody JSONObject handRaisedUser , HttpServletRequest request ) {
222222 if (!request .isUserInRole ("USER" )) {
223223 return new ResponseEntity <>(HttpStatus .UNAUTHORIZED );
224224 }
@@ -229,7 +229,9 @@ public ResponseEntity<Integer> raiseHand(@PathVariable String roomName, @Request
229229 return new ResponseEntity <>(HttpStatus .NOT_FOUND );
230230 }
231231 if (room .isInRoom (user )) {
232- Integer position = room .addHandRaisedUser (nickname , avatar , connectionId );
232+ handRaisedUser .put ("username" , user .getName ());
233+ this .roomServ .checkConnectedHandRaisedUsers (room );
234+ Integer position = room .addHandRaisedUser (handRaisedUser );
233235 if (position .equals (-1 )) {
234236 return new ResponseEntity <>(HttpStatus .CONFLICT );
235237 }
@@ -245,9 +247,8 @@ public ResponseEntity<Integer> raiseHand(@PathVariable String roomName, @Request
245247 *
246248 * @return the httpStatus of the operation
247249 */
248- @ JsonView (User .NameOnly .class )
249250 @ DeleteMapping ("/room/{roomName}/raiseHand" )
250- public ResponseEntity <?> lowerHand (@ PathVariable String roomName , @ RequestBody String connectionId , HttpServletRequest request ) {
251+ public ResponseEntity <?> lowerHand (@ PathVariable String roomName , @ RequestBody JSONObject connectionId , HttpServletRequest request ) {
251252 if (!request .isUserInRole ("USER" )) {
252253 return new ResponseEntity <>(HttpStatus .UNAUTHORIZED );
253254 }
@@ -262,20 +263,18 @@ public ResponseEntity<?> lowerHand(@PathVariable String roomName, @RequestBody S
262263 this .roomServ .save (room );
263264 if (wasRemoved ) {
264265 return new ResponseEntity <>(HttpStatus .OK );
265- } else {
266- return new ResponseEntity <>(HttpStatus .CONFLICT );
267266 }
267+ return new ResponseEntity <>(HttpStatus .CONFLICT );
268268 } else {
269269 return new ResponseEntity <>(HttpStatus .UNAUTHORIZED );
270270 }
271271 }
272272
273273 /**
274- * Makes the user lower their hand
274+ * Gets the users who are raising their hand in that room
275275 *
276- * @return the httpStatus of the operation
276+ * @return the list of the users raising their hand
277277 */
278- @ JsonView (User .NameOnly .class )
279278 @ GetMapping ("/room/{roomName}/raiseHand" )
280279 public ResponseEntity <List <JSONObject >> getRaisedHands (@ PathVariable String roomName , HttpServletRequest request ) {
281280 if (!request .isUserInRole ("USER" )) {
0 commit comments