Skip to content

Commit

Permalink
Fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
nonaninona committed Feb 17, 2024
1 parent bfbf95b commit a4f2b49
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Java CI/CD with Gradle

on:
push:
branches: [ "develop" ]
branches: [ "develop", "CHAT-314-채팅-조회-역순-수정" ]
pull_request:
branches: [ ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
public interface ChatRepository extends JpaRepository<Chat, Long> {

List<Chat> findTop10ByMember_UserIdOrderByChatIdDesc(Long userId);
@Query("SELECT c FROM chat c WHERE c.member.userId = :userId AND c.chatId > :lastChatId ORDER BY c.chatId DESC")
List<Chat> findTop10ByUserIdAndChatIdGreaterThanOrderByChatIdDesc(@Param("userId") Long userId, @Param("lastChatId") Long lastChatId);
List<Chat> findTop10ByUserIdAndChatIdGreaterThanOrderByChatIdAsc(Long userId, Long ChatId);
List<Chat> findTopByMember_UserIdOrderByChatIdDesc(Long userId);
}
2 changes: 1 addition & 1 deletion src/main/java/com/kuit/chatdiary/service/ChatService.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public String extractGptResponse(String jsonResponse) throws JsonProcessingExcep
}

public List<ChatGetResponseDTO> getChats(Long userId, Long lastChatId) {
List<Chat> chats = chatRepository.findTop10ByUserIdAndChatIdGreaterThanOrderByChatIdDesc(userId, lastChatId);
List<Chat> chats = chatRepository.findTop10ByUserIdAndChatIdGreaterThanOrderByChatIdAsc(userId, lastChatId);
if (chats.isEmpty()) {
return null;
}
Expand Down

0 comments on commit a4f2b49

Please sign in to comment.