-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/QFEED-50-Daily-Question (#7)
* [QFEED-50] Feat: Question 엔티티 클래스 추가 * [QFEED-50] Chore: Spring Open AI 의존성 추가 * [QFEED-50] Chore: openai 설정정보 추가 * [QFEED-50] Rename: Question 엔티티 디렉토리 이동 * [QFEED-50] Feat: OpenAI 연동 및 질문 생성 기능 구현 - AIQuestionResponse 형식으로 각 카테고리의 질문을 받아옴 - Json 형식으로 질문을 받아오도록 설정함 - 추후 LLM 모델 변경시 유지보수의 용이성을 위해 질문 생성 책임을 가지는 클래스에는 특정 LLM 모델 관련 클래스 의존하지 않도록 설계 - temperature를 1.2로 높혀 질문이 다양하게 출력되게 끔 하였음. * [QFEED-50] Chore: 질문 생성 모델 temperature 0.9로 변경 - 질문에 이상한 텍스트가 포함되는 현상 해결 * [QFEED-50] Feat: Category 엔티티 추가 * [QFEED-50] Feat: Question에 Category 연관관계 추가 * [QFEED-50] Refactor: Question 엔티티 수정 - 키 생성 전략 추가 - id 컬럼명 지정 * [QFEED-50] Rename: 오타 수정 * [QFEED-50] Rename: common 모듈 패키지명 오타 수정 * [QFEED-50] Rename: api 모듈 패키지명 오타 수정 * [QFEED-50] Rename: Category 엔티티 디렉토리 이동 * [QFEED-50] Refactor: Question 엔티티에 isToday -> QuestionStatus로 수정 및 질문활성화 비즈니스 로직 추가 * [QFEED-50] Refactor: QuestionRepository 추가 - Domain 계층에 인터페이스 추가 - Infra 계층에 Jpa에 의존하는 인터페이스 추가 * [QFEED-50] Rename: external-api 계층 yml 파일명 application-external-api.yml로 변경 * [QFEED-50] Rename: QuestionJpaRepository 디렉토리 구조 변경 * [QFEED-50] Chore: Test를 위한 설정 추가 * [QFEED-50] Feat: Question 엔티티 정적 팩토리 메서드 추가 * [QFEED-50] Feat: 질문 상태 업데이트 스케줄링 로직 추가 * [QFEED-50] Refactor: cron 시간 주기 설정 변경 * [QFEED-50] Fix: Exception 디렉토리 문제 해결 * [QFEED-50] Rename: SchedulingConfig Common 모듈로 이동 * [QFEED-50] Refactor: Category 별도의 에그리거트로 분리 및 Question <-> Category 연관관계 해제 - Category는 User에서도 의존하는 엔티티라 분리하는게 좋다고 판단 - 다른 에그리거트와의 연관관계는 기본키로만 연관
- Loading branch information
Showing
58 changed files
with
351 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,4 @@ replay_pid* | |
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
build-test.gradle |
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
6 changes: 3 additions & 3 deletions
6
module-api/src/main/java/com/wsws/moduleapi/global/exception/GlobalControllerAdvice.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
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
6 changes: 3 additions & 3 deletions
6
...ication/src/main/java/com/wsws/moduleapplication/auth/exception/AuthServiceErrorCode.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
3 changes: 2 additions & 1 deletion
3
...ation/src/main/java/com/wsws/moduleapplication/auth/exception/EmailNotFoundException.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
3 changes: 2 additions & 1 deletion
3
...src/main/java/com/wsws/moduleapplication/auth/exception/InvalidRefreshTokenException.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
3 changes: 2 additions & 1 deletion
3
...on/src/main/java/com/wsws/moduleapplication/auth/exception/PasswordMismatchException.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
2 changes: 1 addition & 1 deletion
2
...src/main/java/com/wsws/moduleapplication/auth/exception/RefreshTokenExpiredException.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
37 changes: 37 additions & 0 deletions
37
...ava/com/wsws/moduleapplication/feed/service/scheduler/ScheduledQuestionUpdateService.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,37 @@ | ||
package com.wsws.moduleapplication.feed.service.scheduler; | ||
|
||
import com.wsws.moduledomain.feed.question.Question; | ||
import com.wsws.moduledomain.feed.question.repo.QuestionRepository; | ||
import com.wsws.moduledomain.feed.question.vo.QuestionStatus; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
@Slf4j | ||
public class ScheduledQuestionUpdateService { | ||
private final QuestionRepository questionRepository; | ||
|
||
/** | ||
* 매일 자정에 Question 테이블의 Question Status 컬럼 변경 | ||
* 어제 질문들은 isToday: ACTIVATED -> INACTICATED | ||
* 오늘 질문들은 isToday: CREATED -> ACTIVATED | ||
*/ | ||
@Scheduled(cron = "0 0 0 * * ?") // 매일 00시 00분에 실행되도록 설정 | ||
public void updateQuestions() { | ||
// 어제 질문들 비활성화 | ||
questionRepository.findByQuestionStatus(QuestionStatus.ACTIVATED) | ||
.forEach(Question::inactivateQuestion); | ||
|
||
// 오늘 질문들 활성화 | ||
questionRepository.findByQuestionStatus(QuestionStatus.CREATED) | ||
.forEach(Question::activateQuestion); | ||
|
||
log.info("스케줄링 작업 완료"); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/src/main/java/com/wsws/moduleapplication/follow/exception/AlreadyFollowedException.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
2 changes: 1 addition & 1 deletion
2
...on/src/main/java/com/wsws/moduleapplication/follow/exception/FollowNotFoundException.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
7 changes: 3 additions & 4 deletions
7
...ion/src/main/java/com/wsws/moduleapplication/follow/exception/FollowServiceErrorCode.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
5 changes: 2 additions & 3 deletions
5
...tion/src/main/java/com/wsws/moduleapplication/user/exception/DuplicateEmailException.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
4 changes: 1 addition & 3 deletions
4
...n/src/main/java/com/wsws/moduleapplication/user/exception/DuplicateNicknameException.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
5 changes: 2 additions & 3 deletions
5
.../main/java/com/wsws/moduleapplication/user/exception/ProfileImageProcessingException.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
5 changes: 2 additions & 3 deletions
5
...rc/main/java/com/wsws/moduleapplication/user/exception/ProfileImageRequiredException.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
5 changes: 2 additions & 3 deletions
5
...rc/main/java/com/wsws/moduleapplication/user/exception/ProfileImageTooLargeException.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
4 changes: 1 addition & 3 deletions
4
.../main/java/com/wsws/moduleapplication/user/exception/UnsupportedImageFormatException.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
5 changes: 2 additions & 3 deletions
5
...cation/src/main/java/com/wsws/moduleapplication/user/exception/UserNotFoundException.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
7 changes: 4 additions & 3 deletions
7
...ication/src/main/java/com/wsws/moduleapplication/user/exception/UserServiceErrorCode.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
9 changes: 9 additions & 0 deletions
9
module-common/src/main/java/com/wsws/modulecommon/config/SchedulingConfig.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 com.wsws.modulecommon.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
||
@Configuration | ||
@EnableScheduling | ||
public class SchedulingConfig { | ||
} |
2 changes: 1 addition & 1 deletion
2
...duleapi/constants/ErrorCodeConstants.java → ...ecommon/constants/ErrorCodeConstants.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
2 changes: 1 addition & 1 deletion
2
...sws/moduleapi/exception/ApiException.java → .../modulecommon/exception/ApiException.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
2 changes: 1 addition & 1 deletion
2
...leapi/exception/ApplicationException.java → ...ommon/exception/ApplicationException.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
2 changes: 1 addition & 1 deletion
2
...ws/moduleapi/exception/BaseErrorCode.java → ...modulecommon/exception/BaseErrorCode.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
2 changes: 1 addition & 1 deletion
2
.../moduleapi/exception/CustomException.java → ...dulecommon/exception/CustomException.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
2 changes: 1 addition & 1 deletion
2
.../moduleapi/exception/DomainException.java → ...dulecommon/exception/DomainException.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
2 changes: 1 addition & 1 deletion
2
...m/wsws/moduleapi/exception/ErrorInfo.java → ...sws/modulecommon/exception/ErrorInfo.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
2 changes: 1 addition & 1 deletion
2
...leapi/exception/ExternalApiException.java → ...ommon/exception/ExternalApiException.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
4 changes: 2 additions & 2 deletions
4
.../moduleapi/exception/GlobalErrorCode.java → ...dulecommon/exception/GlobalErrorCode.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
2 changes: 1 addition & 1 deletion
2
...s/moduleapi/exception/InfraException.java → ...odulecommon/exception/InfraException.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
5 changes: 4 additions & 1 deletion
5
...oduleapi/exception/SecurityException.java → ...lecommon/exception/SecurityException.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
7 changes: 4 additions & 3 deletions
7
module-domain/src/main/java/com/wsws/moduledomain/auth/exception/AuthErrorCode.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
4 changes: 2 additions & 2 deletions
4
...main/src/main/java/com/wsws/moduledomain/auth/exception/ExpiredRefreshTokenException.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
3 changes: 2 additions & 1 deletion
3
...main/src/main/java/com/wsws/moduledomain/auth/exception/InvalidRefreshTokenException.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
4 changes: 1 addition & 3 deletions
4
...-domain/src/main/java/com/wsws/moduledomain/auth/exception/PasswordMismatchException.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
Oops, something went wrong.