Skip to content

Commit

Permalink
[feat #184] 외부 환경(시간)을 파라미터로 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dudxo committed Jan 12, 2025
1 parent a7bbb30 commit 6041cf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.dnd.gongmuin.question_post.scheduler;

import java.time.LocalDateTime;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -17,6 +19,6 @@ public class QuestionPostScheduler {
@Transactional
@Scheduled(cron = "0 0 0 * * *", zone = "Asia/Seoul")
public void closeQuestionPost() {
questionPostService.changeQuestionPostStatusAnswerClosed();
questionPostService.changeQuestionPostStatusAnswerClosed(LocalDateTime.now());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ private int getCountByType(Long questionPostId, InteractionType type) {
}

@Transactional
public void changeQuestionPostStatusAnswerClosed() {
public void changeQuestionPostStatusAnswerClosed(LocalDateTime now) {
refundClosedQuestionPosts();
questionPostRepository.updateQuestionPostStatusAnswerClosed(LocalDateTime.now());
questionPostRepository.updateQuestionPostStatusAnswerClosed(now);
}

private void refundDeletedQuestionPost(QuestionPost questionPost) {
Expand Down

0 comments on commit 6041cf0

Please sign in to comment.