Skip to content

Commit a7cf5f3

Browse files
committed
feat(be): AI챗 레포지토리 구현
1 parent 249bba9 commit a7cf5f3

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.back.koreaTravelGuide.domain.ai.aiChat.repository
2+
3+
import com.back.koreaTravelGuide.domain.ai.aiChat.entity.AiChatMessage
4+
import org.springframework.data.jpa.repository.JpaRepository
5+
6+
interface AiChatMessageRepository : JpaRepository<AiChatMessage, Long> {
7+
fun findByAiChatSessionIdOrderByCreatedAtAsc(sessionId: Long): List<AiChatMessage>
8+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.back.koreaTravelGuide.domain.ai.aiChat.repository
2+
3+
import com.back.koreaTravelGuide.domain.ai.aiChat.entity.AiChatSession
4+
import org.springframework.data.jpa.repository.JpaRepository
5+
6+
interface AiChatSessionRepository : JpaRepository<AiChatSession, Long> {
7+
// 사용자별 세션 조회 (최신순)
8+
fun findByUserIdOrderByCreatedAtDesc(userId: Long): List<AiChatSession>
9+
10+
// 세션 아이디와 사용자 아이디로 세션 조회 (삭제 권한 체크)
11+
fun findByIdAndUserId(
12+
sessionId: Long,
13+
userId: Long,
14+
): AiChatSession?
15+
}

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/aiChat/repository/ChatRepository.kt

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)