Skip to content

Commit

Permalink
refactor: 인증정보 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
smartandhandsome committed Jan 5, 2024
1 parent 72cb3b9 commit 82bcf49
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import coffeemeet.server.chatting.current.service.ChattingRoomService;
import coffeemeet.server.chatting.current.service.dto.ChattingListDto;
import coffeemeet.server.chatting.current.service.dto.ChattingRoomStatusDto;
import coffeemeet.server.common.annotation.Login;
import coffeemeet.server.common.domain.AuthInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -23,17 +25,23 @@ public class ChattingRoomController {

@GetMapping("/{roomId}")
public ResponseEntity<ChattingCustomSlice.Response> viewChattingRoomMessages(
@Login AuthInfo authInfo,
@PathVariable Long roomId,
@RequestParam(defaultValue = "0") Long firstMessageId,
@RequestParam Long firstMessageId,
@RequestParam(defaultValue = "50") int pageSize) {
ChattingListDto responses = chattingRoomService.searchMessages(roomId, firstMessageId,
ChattingListDto responses = chattingRoomService.searchMessages(authInfo.userId(), roomId,
firstMessageId,
pageSize);
return ResponseEntity.ok(ChattingCustomSlice.Response.from(responses));
}

@DeleteMapping("/{roomId}")
public ResponseEntity<Void> exitChattingRoom(@PathVariable Long roomId) {
chattingRoomService.deleteChattingRoom(roomId);
public ResponseEntity<Void> exitChattingRoom(
@Login AuthInfo authInfo,
@PathVariable Long roomId,
@RequestParam Long firstMessageId
) {
chattingRoomService.exitChattingRoom(authInfo.userId(), roomId, firstMessageId);
return ResponseEntity.ok().build();
}

Expand Down

0 comments on commit 82bcf49

Please sign in to comment.