Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/169] 안읽은 채팅방 uuid 목록 조회 및 리팩토링 #170

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ public ApiResponse<Object> exitChatroom(
return ApiResponse.onSuccess("채팅방 나가기 성공");
}

@Operation(summary = "안읽은 채팅방 uuid 목록 조회 API", description = "안읽은 메시지가 속한 채팅방의 uuid 목록을 조회하는 API 입니다.")
@GetMapping("/chat/unread")
public ApiResponse<List<String>> getUnreadChatroomUuid() {
Long memberId = JWTUtil.getCurrentUserId();
List<String> chatroomUuids = chatQueryService.getUnreadChatroomUuids(memberId);
return ApiResponse.onSuccess(chatroomUuids);
}

@Operation(summary = "매칭을 통한 채팅방 시작 메소드 테스트용 API", description =
"매칭을 통한 채팅방 시작 메소드를 테스트하기 위한 API 입니다.\n\n" +
"대상 회원과의 채팅방이 이미 존재하는 경우, 해당 채팅방 uuid를 리턴합니다.\n\n" +
Expand All @@ -149,7 +157,6 @@ public ApiResponse<Object> exitChatroom(
@Parameter(name = "memberId1", description = "매칭 시켜줄 회원 id 입니다."),
@Parameter(name = "memberId2", description = "매칭 시켜줄 회원 id 입니다.")
})

@GetMapping("/chat/start/matching/{memberId1}/{memberId2}")
public ApiResponse<String> startChatroomByMatching(
@PathVariable(name = "memberId1") Long memberId1,
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/gamegoo/converter/ChatConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,4 @@ public static ChatResponse.SystemMessageDTO toSystemMessageDTO(Chat chat) {
.boardId(chat.getSourceBoard() != null ? chat.getSourceBoard().getId() : null)
.build();
}

}
22 changes: 19 additions & 3 deletions src/main/java/com/gamegoo/service/board/BoardService.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import com.gamegoo.service.manner.MannerService;
import com.gamegoo.service.member.FriendService;
import com.gamegoo.util.MemberUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -336,9 +339,11 @@ public BoardResponse.boardByIdResponseForMemberDTO getBoardByIdForMember(Long bo

Member poster = board.getMember();

List<MannerResponse.mannerKeywordDTO> mannerKeywordDTOs = mannerService.mannerKeyword(poster);
List<MannerResponse.mannerKeywordDTO> mannerKeywordDTOs = mannerService.mannerKeyword(
poster);

List<MannerResponse.mannerKeywordDTO> mannerKeywords = mannerService.sortMannerKeywordDTOs(mannerKeywordDTOs);
List<MannerResponse.mannerKeywordDTO> mannerKeywords = mannerService.sortMannerKeywordDTOs(
mannerKeywordDTOs);

return BoardResponse.boardByIdResponseForMemberDTO.builder()
.boardId(board.getId())
Expand Down Expand Up @@ -399,4 +404,15 @@ public List<BoardResponse.myBoardListResponseDTO> getMyBoardList(Long memberId,
.build();
}).collect(Collectors.toList());
}

/**
* boardId로 board 엔티티 조회
*
* @param boardId
* @return
*/
public Board findBoard(Long boardId) {
return boardRepository.findById(boardId)
.orElseThrow(() -> new BoardHandler(ErrorStatus.BOARD_NOT_FOUND));
}
}
Loading
Loading