Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/76 파일 위치 리팩토링 #77

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.remind.api.alarm.dto.request.AlarmCreateRequestDto;
import com.remind.api.alarm.dto.response.AlarmListResponseDto;
import com.remind.api.alarm.repository.AlarmListRepository;
import com.remind.core.domain.alarm.repository.AlarmListRepository;
import com.remind.core.domain.alarm.Alarm;
import com.remind.core.domain.alarm.AlarmDay;
import com.remind.core.domain.alarm.enums.AlarmDayOfWeek;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.remind.api.alarm.service;

import com.google.firebase.messaging.FirebaseMessagingException;
import com.remind.api.alarm.repository.AlarmListRepository;
import com.remind.core.domain.alarm.repository.AlarmListRepository;
import com.remind.api.alarm.util.fcm.FCMUtil;
import com.remind.core.domain.alarm.enums.AlarmDayOfWeek;
import java.time.LocalDate;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/remind/api/member/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import com.remind.api.member.dto.request.OnboardingRequestDto;
import com.remind.api.member.dto.response.*;
import com.remind.api.member.kakao.KakaoFeignClient;
import com.remind.api.mood.repository.MoodConsecutiveRepository;
import com.remind.core.domain.mood.repository.MoodConsecutiveRepository;
import com.remind.core.domain.common.enums.MemberErrorCode;
import com.remind.core.domain.common.exception.MemberException;
import com.remind.core.domain.common.repository.RedisRepository;
import com.remind.core.domain.member.repository.TokenRepository;
import com.remind.core.domain.connection.enums.ConnectionStatus;
import com.remind.core.domain.member.Center;
import com.remind.core.domain.member.Doctor;
Expand Down Expand Up @@ -52,7 +52,7 @@ public class MemberService {
private final PatientRepository patientRepository;
private final DoctorRepository doctorRepository;
private final CenterRepository centerRepository;
private final RedisRepository redisRepository;
private final TokenRepository tokenRepository;
private final JwtProvider jwtProvider;
private final FixActivityRepository fixActivityRepository;
private final ActivityRepository activityRepository;
Expand Down Expand Up @@ -104,7 +104,7 @@ public KakaoLoginResponse kakaoLogin(KakaoLoginRequest request) {
String newRefreshToken = jwtProvider.createRefreshToken(userDetail);

// redis 토큰 정보 저장
redisRepository.saveToken(userDetail.getMemberId(), newRefreshToken);
tokenRepository.saveToken(userDetail.getMemberId(), newRefreshToken);

return KakaoLoginResponse.builder()
.name(member.getName())
Expand Down Expand Up @@ -263,11 +263,11 @@ public TokenResponseDto refreshToken(String oldRefreshToken, Long memberId) {
.orElseThrow(() -> new MemberException(MEMBER_NOT_FOUND));

// redis 갱신된 refresh token 유효성 검증
if (!redisRepository.hasKey(member.getId())) {
if (!tokenRepository.hasKey(member.getId())) {
throw new MemberException(REFRESH_TOKEN_NOT_FOUND);
}
// redis에 저장된 토큰과 비교
if (!redisRepository.getRefreshToken(member.getId()).get(RedisRepository.REFRESH_TOKEN_KEY)
if (!tokenRepository.getRefreshToken(member.getId()).get(TokenRepository.REFRESH_TOKEN_KEY)
.equals(oldRefreshToken)) {
throw new MemberException(REFRESH_TOKEN_NOT_MATCH);
}
Expand All @@ -284,7 +284,7 @@ public TokenResponseDto refreshToken(String oldRefreshToken, Long memberId) {
.build();

// redis 토큰 정보 저장
redisRepository.saveToken(userDetail.getMemberId(), newRefreshToken);
tokenRepository.saveToken(userDetail.getMemberId(), newRefreshToken);

return tokenResponseDto;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.remind.api.mood.dto.ActivityListDto;
import com.remind.api.mood.dto.response.ActivityPercentResponseDto;
import com.remind.api.mood.dto.response.MoodPercentResponseDto;
import com.remind.api.mood.repository.MoodPercentRepository;
import com.remind.core.domain.mood.repository.MoodPercentRepository;
import com.remind.core.domain.mood.enums.FeelingType;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.remind.api.mood.dto.response.ActivityPercentResponseDto;
import com.remind.api.mood.dto.response.MoodChartPagingResponseDto;
import com.remind.api.mood.dto.response.MoodPercentResponseDto;
import com.remind.api.mood.repository.MoodChartPagingRepository;
import com.remind.api.mood.repository.MoodConsecutiveRepository;
import com.remind.core.domain.mood.repository.MoodChartPagingRepository;
import com.remind.core.domain.mood.repository.MoodConsecutiveRepository;
import com.remind.core.domain.mood.enums.FeelingType;
import com.remind.core.security.dto.UserDetailsImpl;
import java.time.LocalDate;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/remind/api/mood/service/MoodService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.remind.api.mood.dto.request.MoodSaveRequestDto;
import com.remind.api.mood.dto.response.ModelActivityResponseDto;
import com.remind.api.mood.dto.response.MoodResponseDto;
import com.remind.api.mood.repository.DateMoodActivityRepository;
import com.remind.core.domain.mood.repository.DateMoodActivityRepository;
import com.remind.core.domain.common.exception.ActivityException;
import com.remind.core.domain.common.exception.MemberException;
import com.remind.core.domain.common.exception.MoodException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.api.alarm.repository;
package com.remind.core.domain.alarm.repository;

import com.remind.api.alarm.dto.response.AlarmListDto;
import com.remind.core.domain.alarm.enums.AlarmDayOfWeek;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.domain.common.repository;
package com.remind.core.domain.member.repository;


import java.time.Duration;
Expand All @@ -11,7 +11,7 @@

@Repository
@RequiredArgsConstructor
public class RedisRepository {
public class TokenRepository {

@Value("${jwt.refresh-expiration-seconds}")
private int refreshExpirationSeconds;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.api.mood.repository;
package com.remind.core.domain.mood.repository;

import com.remind.api.mood.dto.response.ModelActivityResponseDto;
import com.remind.core.domain.mood.repository.MoodActivityRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.api.mood.repository;
package com.remind.core.domain.mood.repository;

import com.remind.api.mood.dto.MoodChartDto;
import com.remind.core.domain.mood.repository.MoodRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.api.mood.repository;
package com.remind.core.domain.mood.repository;

import com.remind.core.domain.mood.enums.FeelingType;
import com.remind.core.domain.mood.repository.MoodRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.api.mood.repository;
package com.remind.core.domain.mood.repository;

import com.remind.api.mood.dto.ActivityListDto;
import com.remind.core.domain.mood.enums.FeelingType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import java.util.concurrent.Executor;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import com.remind.RemindApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import com.fasterxml.jackson.core.JsonGenerator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import java.time.Duration;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.remind.core.infra.config;
package com.remind.infra.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/com/remind/api/member/TokenControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.remind.api.member.dto.request.RefreshTokenRequestDto;
import com.remind.core.domain.common.repository.RedisRepository;
import com.remind.core.domain.member.repository.TokenRepository;
import com.remind.core.domain.member.Member;
import com.remind.core.domain.member.repository.MemberRepository;
import com.remind.core.infra.TestContainerConfig;
Expand All @@ -34,7 +34,7 @@
public class TokenControllerTest extends TestContainerConfig {

@Autowired
private RedisRepository redisRepository;
private TokenRepository tokenRepository;
@Autowired
private JwtProvider jwtProvider;
@Autowired
Expand Down Expand Up @@ -64,11 +64,11 @@ public void refreshTokenUnitTest() {
.build();
String newRefreshToken = jwtProvider.createRefreshToken(userDetails);

redisRepository.saveToken(TEST_MEMBER_ID, newRefreshToken);
tokenRepository.saveToken(TEST_MEMBER_ID, newRefreshToken);

//when
String findToken = (String) redisRepository.getRefreshToken(TEST_MEMBER_ID)
.get(RedisRepository.REFRESH_TOKEN_KEY);
String findToken = (String) tokenRepository.getRefreshToken(TEST_MEMBER_ID)
.get(TokenRepository.REFRESH_TOKEN_KEY);

//then
Assertions.assertThat(findToken).isEqualTo(newRefreshToken);
Expand All @@ -88,7 +88,7 @@ public void refreshTokenIntegrationTest() throws Exception {
.build();
String newRefreshToken = jwtProvider.createRefreshToken(userDetails);

redisRepository.saveToken(TEST_MEMBER_ID, newRefreshToken);
tokenRepository.saveToken(TEST_MEMBER_ID, newRefreshToken);
String httpRequestBody = objectMapper.writeValueAsString(new RefreshTokenRequestDto(newRefreshToken));

//when,then
Expand Down
Loading