Skip to content

Commit

Permalink
feat: 내가 가입한 채팅방 목록 조회 api 개방
Browse files Browse the repository at this point in the history
  • Loading branch information
psychology50 committed Oct 14, 2024
1 parent 9b961b8 commit 7c79138
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
Expand All @@ -22,6 +19,7 @@
public class ChatRoomController implements ChatRoomApi {
private static final String CHAT_ROOM_ID = "chatRoomId";
private static final String CHAT_ROOM = "chatRoom";
private static final String CHAT_ROOMS = "chatRooms";
private final ChatRoomUseCase chatRoomUseCase;

@Override
Expand All @@ -37,4 +35,11 @@ public ResponseEntity<?> postChatRoom(@RequestBody ChatRoomReq.Pend request, @Au
public ResponseEntity<?> createChatRoom(@RequestBody ChatRoomReq.Create request, @AuthenticationPrincipal SecurityUserDetails user) {
return ResponseEntity.ok(SuccessResponse.from(CHAT_ROOM, chatRoomUseCase.createChatRoom(request, user.getUserId())));
}

@Override
@GetMapping("")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<?> getChatRooms(@AuthenticationPrincipal SecurityUserDetails user) {
return ResponseEntity.ok(SuccessResponse.from(CHAT_ROOMS, chatRoomUseCase.getChatRooms(user.getUserId())));
}
}

0 comments on commit 7c79138

Please sign in to comment.