-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-for-session 🔨 Feature: 채팅 기록 관련 세션 작업
- Loading branch information
Showing
12 changed files
with
95 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/java/fouragrant/scentasy/biz/chat/dto/ChatResDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package fouragrant.scentasy.biz.chat.dto; | ||
|
||
public record ChatResDto( | ||
String response | ||
String response, | ||
String sessionId | ||
) { | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/fouragrant/scentasy/biz/chat/dto/ChatSessionListResDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package fouragrant.scentasy.biz.chat.dto; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ChatSessionListResDto( | ||
String sessionId | ||
) { | ||
} |
15 changes: 5 additions & 10 deletions
15
src/main/java/fouragrant/scentasy/biz/chat/repository/ChatRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
package fouragrant.scentasy.biz.chat.repository; | ||
|
||
import fouragrant.scentasy.biz.chat.domain.Chat; | ||
import fouragrant.scentasy.biz.chat.dto.ChatListResDto; | ||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ChatRepository extends JpaRepository<Chat, Long> { | ||
@Query("SELECT DISTINCT FUNCTION('DATE', c.createdAt) FROM chat c WHERE c.member.id = :memberId") | ||
List<java.sql.Date> findDistinctChatDatesByMemberId(@Param("memberId") Long memberId); | ||
List<Chat> findChatsBySessionIdAndMemberId(String sessionId, Long memberId); | ||
|
||
@Query("SELECT c FROM chat c WHERE c.member.id = :memberId AND c.createdAt BETWEEN :startOfDay AND :endOfDay") | ||
List<Chat> findChatsByMemberIdAndDate(@Param("memberId") Long memberId, | ||
@Param("startOfDay") LocalDateTime startOfDay, | ||
@Param("endOfDay") LocalDateTime endOfDay); | ||
@Query("SELECT DISTINCT c.sessionId FROM chat c WHERE c.member.id = :memberId") | ||
List<String> findDistinctSessionIdsByMemberId(Long memberId); | ||
|
||
long countByMemberId(Long memberId); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters