File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
src/main/java/com/example/be/web/controller Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -74,13 +74,6 @@ public ResponseEntity<String> receiveWebhook(@RequestHeader("Authorization") Str
7474 System .out .println ("Room created: " + roomName );
7575 }
7676 }
77- case "room_finished" -> {
78- Room room = roomRepository .findByTitle (roomName );
79- if (room != null ) {
80- roomRepository .delete (room );
81- System .out .println ("Room deleted: " + roomName );
82- }
83- }
8477 case "participant_joined" -> {
8578 Room room = roomRepository .findByTitle (roomName );
8679 if (room != null ) {
@@ -91,10 +84,17 @@ public ResponseEntity<String> receiveWebhook(@RequestHeader("Authorization") Str
9184 }
9285 case "participant_left" -> {
9386 Room room = roomRepository .findByTitle (roomName );
94- if (room != null && room . getParticipantCount () > 0 ) {
87+ if (room != null ) {
9588 room .setParticipantCount (room .getParticipantCount () - 1 );
9689 roomRepository .save (room );
90+ }
91+ if (room != null && room .getParticipantCount () > 0 ) {
92+ roomRepository .save (room );
9793 System .out .println ("Participant left. Current count: " + room .getParticipantCount ());
94+ }
95+ else if (room != null && room .getParticipantCount () == 0 ) {
96+ roomRepository .delete (room );
97+ System .out .println ("Room deleted: " + roomName );
9898 }
9999 }
100100 }
You can’t perform that action at this time.
0 commit comments