feat : 분석api 개발
This commit is contained in:
parent
84ef442775
commit
e61e98ed7d
@ -445,7 +445,7 @@ public class AnalyticsService implements AnalyticsUseCase {
|
||||
|
||||
try {
|
||||
// 1. AI 피드백 조회
|
||||
var aiFeedback = analyticsPort.findAIFeedbackByStoreId(feedbackId); // 실제로는 feedbackId로 조회하는 메서드 필요
|
||||
var aiFeedback = analyticsPort.findAIFeedbackById(feedbackId);
|
||||
|
||||
if (aiFeedback.isEmpty()) {
|
||||
throw new RuntimeException("AI 피드백을 찾을 수 없습니다: " + feedbackId);
|
||||
|
||||
@ -25,7 +25,13 @@ public interface AnalyticsPort {
|
||||
* 매장 ID로 AI 피드백 조회
|
||||
*/
|
||||
Optional<AiFeedback> findAIFeedbackByStoreId(Long storeId);
|
||||
|
||||
|
||||
/**
|
||||
* AI 피드백 ID로 조회 (추가된 메서드)
|
||||
*/
|
||||
Optional<AiFeedback> findAIFeedbackById(Long feedbackId);
|
||||
|
||||
|
||||
/**
|
||||
* AI 피드백 저장
|
||||
*/
|
||||
|
||||
@ -55,6 +55,12 @@ public class AnalyticsRepositoryAdapter implements AnalyticsPort {
|
||||
AiFeedbackEntity saved = aiFeedbackJpaRepository.save(entity);
|
||||
return toAiFeedbackDomain(saved);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<AiFeedback> findAIFeedbackById(Long feedbackId) {
|
||||
return aiFeedbackJpaRepository.findById(feedbackId)
|
||||
.map(this::toAiFeedbackDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Analytics Entity를 Domain으로 변환
|
||||
|
||||
@ -21,13 +21,13 @@ public interface AiFeedbackJpaRepository extends JpaRepository<AiFeedbackEntity,
|
||||
* 매장 ID로 AI 피드백 조회 (최신순)
|
||||
*/
|
||||
Optional<AiFeedbackEntity> findByStoreId(Long storeId);
|
||||
|
||||
|
||||
/**
|
||||
* 매장 ID로 최신 AI 피드백 조회
|
||||
*/
|
||||
@Query("SELECT af FROM AiFeedbackEntity af WHERE af.storeId = :storeId ORDER BY af.generatedAt DESC")
|
||||
@Query("SELECT af FROM AiFeedbackEntity af WHERE af.storeId = :storeId ORDER BY af.createdAt DESC LIMIT 1")
|
||||
Optional<AiFeedbackEntity> findLatestByStoreId(@Param("storeId") Long storeId);
|
||||
|
||||
|
||||
/**
|
||||
* 특정 기간 이후 생성된 AI 피드백 조회
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user