Skip to content

Conversation

@jucheolkang
Copy link
Collaborator

ROLE_TEST 이라는 테스트 권한을 추가했습니다
테스트 계정은 한번만 추가하면 된다고 생각해서 서버에서 직접 권한을 ROLE_USER 에서 ROLE_TEST 로 바꾸려고 합니다

// UserRepository
@Query("SELECT u FROM User u WHERE :role MEMBER OF u.roles")
    List<User> findTestAccounts(@Param("role") Roles role);

user repository에 권한 조회 쿼리를 추가해서 ROLE_TEST 을 찾을 수 있도록 했습니다

user 패키지에 TestAccountResetService 클래스를 만들어서 ROLE_TEST을 조회해 스케줄러가 동작한는 코드를 추가했습니다

@Transactional
    public void resetTestAccounts() {
        List<User> testUsers = userRepository.findTestAccounts(Roles.ROLE_TEST);

        for (User user : testUsers) {
            /*이메일 발송횟수, 구독항목 주기 삭제*/
        }
    }

Copy link
Member

@o-tao o-tao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

@jucheolkang jucheolkang merged commit 0ddfdbb into main May 25, 2025
3 checks passed
@jucheolkang jucheolkang deleted the GUTTOK-116 branch May 25, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants