diff --git a/build.gradle b/build.gradle index 6b9568b0..fc79a530 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ configurations { repositories { mavenCentral() + maven { url 'https://jitpack.io' } } dependencies { @@ -36,7 +37,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' // swagger - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0' // TODO // jwt implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2' @@ -54,12 +55,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo.spring30x:4.7.0' - // kafka - implementation 'org.springframework.kafka:spring-kafka:3.0.11' - - // kinesis KPL - implementation 'software.amazon.kinesis:amazon-kinesis-client:2.5.2' - // aop implementation 'org.springframework.boot:spring-boot-starter-aop' @@ -80,6 +75,9 @@ dependencies { implementation 'net.javacrumbs.shedlock:shedlock-spring:4.14.0' implementation 'net.javacrumbs.shedlock:shedlock-provider-jdbc-template:4.14.0' + // api versioning + implementation 'com.github.GIVEN53:api-versioning-library:0.2.0' + } tasks.named('test') { diff --git a/src/lombok.config b/src/lombok.config index 2c6905d7..546cbb9f 100644 --- a/src/lombok.config +++ b/src/lombok.config @@ -1 +1,2 @@ lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Value +lombok.addLombokGeneratedAnnotation = true diff --git a/src/main/java/com/coniverse/dangjang/DangjangApplication.java b/src/main/java/com/coniverse/dangjang/DangjangApplication.java index 4aa49da7..7f1c1b91 100644 --- a/src/main/java/com/coniverse/dangjang/DangjangApplication.java +++ b/src/main/java/com/coniverse/dangjang/DangjangApplication.java @@ -3,12 +3,11 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; -@EnableScheduling +import given.apiversion.autoconfigure.EnableApiVersion; + +@EnableApiVersion @EnableJpaAuditing -@EnableAsync @SpringBootApplication public class DangjangApplication { public static void main(String[] args) { diff --git a/src/main/java/com/coniverse/dangjang/domain/auth/controller/LoginController.java b/src/main/java/com/coniverse/dangjang/domain/auth/controller/LoginController.java index 57b4ea4e..9080ff36 100644 --- a/src/main/java/com/coniverse/dangjang/domain/auth/controller/LoginController.java +++ b/src/main/java/com/coniverse/dangjang/domain/auth/controller/LoginController.java @@ -14,6 +14,7 @@ import com.coniverse.dangjang.domain.auth.service.OauthLoginService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -26,25 +27,42 @@ */ @RestController @RequiredArgsConstructor -@RequestMapping("/api/auth") +@RequestMapping("/auth") public class LoginController { + private static final String ACCESS_TOKEN = "AccessToken"; + private static final String AUTHORIZATION = "Authorization"; private final OauthLoginService oauthLoginService; - private static String headerKeyFcmToken = "FcmToken"; - private static String headerKeyAccessToken = "AccessToken"; - - private static String headerKeyAuthorization = "Authorization"; /** * @param params 카카오 accessToken * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping("/kakao") public ResponseEntity> loginKakao(@Valid @RequestBody KakaoLoginRequest params) { LoginResponse loginResponse = oauthLoginService.login(params); String accessToken = oauthLoginService.getAuthToken(loginResponse.nickname()); return ResponseEntity.ok() - .header(headerKeyAccessToken.toString(), accessToken) + .header(ACCESS_TOKEN.toString(), accessToken) + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), loginResponse)); + } + + /** + * 카카오 로그인 + * + * @param params 카카오 access token + * @return jwt token, 로그인 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping("/kakao") + public ResponseEntity> loginKakaoV1(@Valid @RequestBody KakaoLoginRequest params) { + LoginResponse loginResponse = oauthLoginService.login(params); + String accessToken = oauthLoginService.getAuthToken(loginResponse.nickname()); + return ResponseEntity.ok() + .header(ACCESS_TOKEN.toString(), accessToken) .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), loginResponse)); } @@ -52,13 +70,32 @@ public ResponseEntity> loginKakao(@Valid @R * @param params 네이버 accessToken * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping("/naver") public ResponseEntity> loginNaver(@Valid @RequestBody NaverLoginRequest params) { LoginResponse loginResponse = oauthLoginService.login(params); String accessToken = oauthLoginService.getAuthToken(loginResponse.nickname()); return ResponseEntity.ok() - .header(headerKeyAccessToken, accessToken) + .header(ACCESS_TOKEN, accessToken) + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), loginResponse)); + } + + /** + * 네이버 로그인 + * + * @param params 네이버 access token + * @return jwt token, 로그인 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping("/naver") + public ResponseEntity> loginNaverV1(@Valid @RequestBody NaverLoginRequest params) { + LoginResponse loginResponse = oauthLoginService.login(params); + String accessToken = oauthLoginService.getAuthToken(loginResponse.nickname()); + return ResponseEntity.ok() + .header(ACCESS_TOKEN, accessToken) .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), loginResponse)); } @@ -68,12 +105,30 @@ public ResponseEntity> loginNaver(@Valid @R * @param request 재발급 요청 , header에 accessToken이 필요 * @return AuthToken * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping("/reissue") public ResponseEntity> reissue(HttpServletRequest request) { - String newAccessToken = oauthLoginService.reissueToken(request.getHeader(headerKeyAuthorization)); + String newAccessToken = oauthLoginService.reissueToken(request.getHeader(AUTHORIZATION)); + return ResponseEntity.ok() + .header(ACCESS_TOKEN, newAccessToken) + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } + + /** + * refresh token으로 access token 재발급 + * + * @param request 재발급 요청, header에 access token 필요 + * @return AuthToken + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping("/reissue") + public ResponseEntity> reissueV1(HttpServletRequest request) { + String newAccessToken = oauthLoginService.reissueToken(request.getHeader(AUTHORIZATION)); return ResponseEntity.ok() - .header(headerKeyAccessToken, newAccessToken) + .header(ACCESS_TOKEN, newAccessToken) .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } @@ -83,10 +138,27 @@ public ResponseEntity> reissue(HttpServletRequest reque * @param request HttpServletRequest oauthId * @param logoutFcmTokenRequest fcmToken * @since 1.1.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping("/logout") public ResponseEntity logout(HttpServletRequest request, @RequestBody LogoutFcmTokenRequest logoutFcmTokenRequest) { - oauthLoginService.logout(request.getHeader(headerKeyAuthorization), logoutFcmTokenRequest.fcmToken()); + oauthLoginService.logout(request.getHeader(AUTHORIZATION), logoutFcmTokenRequest.fcmToken()); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } + + /** + * 로그아웃 + * + * @param request HttpServletRequest + * @param logoutFcmTokenRequest fcm token 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping("/logout") + public ResponseEntity> logoutV1(HttpServletRequest request, @RequestBody LogoutFcmTokenRequest logoutFcmTokenRequest) { + oauthLoginService.logout(request.getHeader(AUTHORIZATION), logoutFcmTokenRequest.fcmToken()); return ResponseEntity.ok() .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } diff --git a/src/main/java/com/coniverse/dangjang/domain/guide/bloodsugar/controller/BloodSugarGuideController.java b/src/main/java/com/coniverse/dangjang/domain/guide/bloodsugar/controller/BloodSugarGuideController.java index b2fd78a7..8c9b42bb 100644 --- a/src/main/java/com/coniverse/dangjang/domain/guide/bloodsugar/controller/BloodSugarGuideController.java +++ b/src/main/java/com/coniverse/dangjang/domain/guide/bloodsugar/controller/BloodSugarGuideController.java @@ -15,6 +15,7 @@ import com.coniverse.dangjang.global.dto.SuccessSingleResponse; import com.coniverse.dangjang.global.validator.ValidLocalDate; +import given.apiversion.core.annotation.ApiVersion; import lombok.RequiredArgsConstructor; /** @@ -24,9 +25,9 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/guide/blood-sugar") @RequiredArgsConstructor @Validated +@RequestMapping("/guide/blood-sugar") public class BloodSugarGuideController { private final BloodSugarGuideSearchService bloodSugarGuideSearchService; @@ -37,11 +38,30 @@ public class BloodSugarGuideController { * @param principal 사용자 정보 * @return 혈당 가이드 응답 dto * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { BloodSugarGuideResponse response = bloodSugarGuideSearchService.findGuide(principal.getUsername(), date); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + + /** + * 혈당 가이드를 조회한다. + * + * @param date 조회할 일자 + * @param principal 사용자 정보 + * @return 혈당 가이드 응답 dto + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getBloodSugarGuideV1(@ValidLocalDate @RequestParam String date, + @AuthenticationPrincipal User principal) { + BloodSugarGuideResponse response = bloodSugarGuideSearchService.findGuide(principal.getUsername(), date); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/guide/common/controller/GuideController.java b/src/main/java/com/coniverse/dangjang/domain/guide/common/controller/GuideController.java index 60a7c528..850992ec 100644 --- a/src/main/java/com/coniverse/dangjang/domain/guide/common/controller/GuideController.java +++ b/src/main/java/com/coniverse/dangjang/domain/guide/common/controller/GuideController.java @@ -15,6 +15,7 @@ import com.coniverse.dangjang.global.dto.SuccessSingleResponse; import com.coniverse.dangjang.global.validator.ValidLocalDate; +import given.apiversion.core.annotation.ApiVersion; import lombok.RequiredArgsConstructor; /** @@ -23,10 +24,10 @@ * @author EVE * @since 1.0.0 */ -@RequestMapping("/api/guide") @RestController @RequiredArgsConstructor @Validated +@RequestMapping("/guide") public class GuideController { private final DayGuideService dayGuideService; @@ -36,11 +37,29 @@ public class GuideController { * @param date 조회날짜 * @author EVE * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> getDayGuide(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { DayGuideResponse dayGuideResponse = dayGuideService.getDayGuide(principal.getUsername(), date); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), dayGuideResponse)); } + + /** + * 하루 요약 가이드를 조회하여 전달한다 + * + * @param date 조회날짜 + * @author EVE + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getDayGuideV1(@ValidLocalDate @RequestParam String date, + @AuthenticationPrincipal User principal) { + DayGuideResponse dayGuideResponse = dayGuideService.getDayGuide(principal.getUsername(), date); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), dayGuideResponse)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/guide/exercise/controller/ExerciseGuideController.java b/src/main/java/com/coniverse/dangjang/domain/guide/exercise/controller/ExerciseGuideController.java index 8f0f1213..8bab930f 100644 --- a/src/main/java/com/coniverse/dangjang/domain/guide/exercise/controller/ExerciseGuideController.java +++ b/src/main/java/com/coniverse/dangjang/domain/guide/exercise/controller/ExerciseGuideController.java @@ -15,6 +15,7 @@ import com.coniverse.dangjang.global.dto.SuccessSingleResponse; import com.coniverse.dangjang.global.validator.ValidLocalDate; +import given.apiversion.core.annotation.ApiVersion; import lombok.RequiredArgsConstructor; /** @@ -27,7 +28,7 @@ @RestController @RequiredArgsConstructor @Validated -@RequestMapping("/api/guide/exercise") +@RequestMapping("/guide/exercise") public class ExerciseGuideController { private final ExerciseGuideSearchService exerciseGuideSearchService; @@ -38,13 +39,31 @@ public class ExerciseGuideController { * @param principal 유저 정보 * @return 운동 가이드 응답 * @since 1.0.0 + * @deprecated 1.6.0 */ - + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { ExerciseGuideResponse response = exerciseGuideSearchService.findGuide(principal.getUsername(), date); - return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * 운동 조회 + * + * @param date 조회하는 날짜 + * @param principal 유저 정보 + * @return 운동 가이드 응답 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getExerciseGuideV1(@ValidLocalDate @RequestParam String date, + @AuthenticationPrincipal User principal) { + ExerciseGuideResponse response = exerciseGuideSearchService.findGuide(principal.getUsername(), date); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/guide/weight/controller/WeightGuideController.java b/src/main/java/com/coniverse/dangjang/domain/guide/weight/controller/WeightGuideController.java index 8409d619..817d64b9 100644 --- a/src/main/java/com/coniverse/dangjang/domain/guide/weight/controller/WeightGuideController.java +++ b/src/main/java/com/coniverse/dangjang/domain/guide/weight/controller/WeightGuideController.java @@ -15,6 +15,7 @@ import com.coniverse.dangjang.global.dto.SuccessSingleResponse; import com.coniverse.dangjang.global.validator.ValidLocalDate; +import given.apiversion.core.annotation.ApiVersion; import lombok.RequiredArgsConstructor; /** @@ -24,10 +25,10 @@ * @since 1.0.0 */ -@RequestMapping("/api/guide/weight") -@RequiredArgsConstructor @RestController +@RequiredArgsConstructor @Validated +@RequestMapping("/guide/weight") public class WeightGuideController { private final WeightGuideSearchService weightGuideSearchService; @@ -38,11 +39,32 @@ public class WeightGuideController { * @param principal 유저 정보 * @author EVE * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { WeightGuideResponse response = weightGuideSearchService.findGuide(principal.getUsername(), date); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + + /** + * 날짜별 체중 가이드 조회 + * + * @param date 조회하는 날짜 + * @param principal 유저 정보 + * @author EVE + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getWeightGuideV1(@ValidLocalDate @RequestParam String date, + @AuthenticationPrincipal User principal) { + WeightGuideResponse response = weightGuideSearchService.findGuide(principal.getUsername(), date); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } } + + diff --git a/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthConnectController.java b/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthConnectController.java index 10169276..567c2df5 100644 --- a/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthConnectController.java +++ b/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthConnectController.java @@ -15,6 +15,7 @@ import com.coniverse.dangjang.domain.healthmetric.service.HealthConnectService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -25,8 +26,8 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/health-connect") @RequiredArgsConstructor +@RequestMapping("/health-connect") public class HealthConnectController { private final HealthConnectService healthConnectService; @@ -36,7 +37,9 @@ public class HealthConnectController { * @param requests 건강 지표 request post dto n개 * @param principal 유저 정보 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> postHealthConnect(@Valid @RequestBody HealthConnectPostRequest requests, @AuthenticationPrincipal User principal) { @@ -45,14 +48,32 @@ public ResponseEntity> postHealthConnect(@Valid @Reques return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } + /** + * health connect로 받은 건강 지표 데이터를 등록한다. + * + * @param requests 건강 지표 request post dto n개 + * @param principal 유저 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping + public ResponseEntity> postHealthConnectV1(@Valid @RequestBody HealthConnectPostRequest requests, + @AuthenticationPrincipal User principal) { + String oauthId = principal.getUsername(); + healthConnectService.registerHealthConnectData(requests, oauthId); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } + /** * health connect 연동 여부를 확인한다. * * @param requests health connect 연동 여부 데이터 * @param principal 유저 정보 * @since 1.0.0 + * @deprecated 1.6.0 */ - + @Deprecated(since = "1.6.0") @PatchMapping("/interlock") public ResponseEntity> interlockHealthConnect(@Valid @RequestBody HealthConnectRegisterRequest requests, @AuthenticationPrincipal User principal) { @@ -60,4 +81,21 @@ public ResponseEntity> interlockHealthConnect(@Valid @R healthConnectService.interlockHealthConnect(requests, oauthId); return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } + + /** + * health connect 연동 여부를 확인한다. + * + * @param requests health connect 연동 여부 데이터 + * @param principal 유저 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PatchMapping("/interlock") + public ResponseEntity> interlockHealthConnectV1(@Valid @RequestBody HealthConnectRegisterRequest requests, + @AuthenticationPrincipal User principal) { + String oauthId = principal.getUsername(); + healthConnectService.interlockHealthConnect(requests, oauthId); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthMetricController.java b/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthMetricController.java index 94cda464..1a409e49 100644 --- a/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthMetricController.java +++ b/src/main/java/com/coniverse/dangjang/domain/healthmetric/controller/HealthMetricController.java @@ -28,6 +28,7 @@ import com.coniverse.dangjang.global.dto.SuccessSingleResponse; import com.coniverse.dangjang.global.validator.ValidLocalDate; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; @@ -39,9 +40,9 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/health-metric") @RequiredArgsConstructor @Validated +@RequestMapping("/health-metric") public class HealthMetricController { private final HealthMetricRegisterService healthMetricRegisterService; private final HealthMetricChartSearchService healthMetricChartSearchService; @@ -51,7 +52,9 @@ public class HealthMetricController { * HTTP POST METHOD * * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> post(@Valid @RequestBody HealthMetricPostRequest postRequest, @AuthenticationPrincipal User principal) { @@ -59,11 +62,27 @@ public ResponseEntity> post(@Valid @ return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * HTTP POST METHOD // TODO 작성 + * + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping + public ResponseEntity> postHealthMetricV1(@Valid @RequestBody HealthMetricPostRequest postRequest, + @AuthenticationPrincipal User principal) { + HealthMetricResponse response = healthMetricRegisterService.register(postRequest, principal.getUsername()); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + /* * HTTP PATCH METHOD * * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PatchMapping public ResponseEntity> patch(@Valid @RequestBody HealthMetricPatchRequest patchRequest, @AuthenticationPrincipal User principal) { @@ -74,6 +93,23 @@ public ResponseEntity> patch(@Valid return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /* + * HTTP PATCH METHOD // TODO 작성 + * + * @since 1.6.0 + */ + @ApiVersion("1") + @PatchMapping + public ResponseEntity> patchHealthMetricV1(@Valid @RequestBody HealthMetricPatchRequest patchRequest, + @AuthenticationPrincipal User principal) { + if (patchRequest.isSameType()) { + throw new SameTypeException(); // TODO 이동 + } + HealthMetricResponse response = healthMetricRegisterService.update(patchRequest, principal.getUsername()); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + /** * 건강지표 차트 데이터를 조회한다. * @@ -82,7 +118,9 @@ public ResponseEntity> patch(@Valid * @param principal 유저 정보 * @return 건강지표 차트 데이터 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> getHealthMetrics(@ValidLocalDate @RequestParam String startDate, @ValidLocalDate @RequestParam String endDate, @AuthenticationPrincipal User principal) { @@ -91,13 +129,34 @@ public ResponseEntity> getHealt return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * 건강지표 차트 데이터를 조회한다. + * + * @param startDate 조회 시작 날짜 + * @param endDate 조회 종료 날짜 + * @param principal 유저 정보 + * @return 건강지표 차트 데이터 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getHealthMetricsBetweenDatesV1(@ValidLocalDate @RequestParam String startDate, + @ValidLocalDate @RequestParam String endDate, @AuthenticationPrincipal User principal) { + HealthMetricChartResponse response = healthMetricChartSearchService.findHealthMetricChart(principal.getUsername(), LocalDate.parse(startDate), + LocalDate.parse(endDate)); // TODO LocalDate.parse 이동 + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + /** * 마지막 건강지표 생성일을 조회한다 * * @param principal 유저 정보 * @return 유저의 마지막 건강지표 생성일 * @since 1.1.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping("/last-date") public ResponseEntity> getHealthMetricLastDate(@AuthenticationPrincipal User principal) { String oauthId = principal.getUsername(); @@ -105,6 +164,22 @@ public ResponseEntity> getHe return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * 마지막 건강지표 생성일을 조회한다 + * + * @param principal 유저 정보 + * @return 유저의 마지막 건강지표 생성일 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping("/last-date") + public ResponseEntity> getLastHealthMetricCreationDateV1(@AuthenticationPrincipal User principal) { + String oauthId = principal.getUsername(); + HealthMetricLastDateResponse response = healthMetricSearchService.findHealthMetricLastDate(oauthId); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + /** * 건강지표를 DELETE 요청한다. * @@ -113,11 +188,30 @@ public ResponseEntity> getHe * @param principal 유저 정보 * @return 성공 메시지 * @since 1.3.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @DeleteMapping public ResponseEntity> deleteHealthMetric(@ValidLocalDate @RequestParam String date, @NotBlank @RequestParam String type, @AuthenticationPrincipal User principal) { healthMetricRegisterService.remove(date, type, principal.getUsername()); return ResponseEntity.noContent().build(); } + + /** + * 건강지표를 DELETE 요청한다. + * + * @param date 건강지표 생성일 + * @param type 건강지표 타입 + * @param principal 유저 정보 + * @return 성공 메시지 + * @since 1.6.0 + */ + @ApiVersion("1") + @DeleteMapping + public ResponseEntity> deleteHealthMetricV1(@ValidLocalDate @RequestParam String date, @NotBlank @RequestParam String type, + @AuthenticationPrincipal User principal) { + healthMetricRegisterService.remove(date, type, principal.getUsername()); + return ResponseEntity.noContent().build(); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/LogProducer.java b/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/LogProducer.java deleted file mode 100644 index f699a9ad..00000000 --- a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/LogProducer.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.coniverse.dangjang.domain.infrastructure.datastream; - -import com.coniverse.dangjang.domain.log.dto.app.AppLog; -import com.coniverse.dangjang.domain.log.dto.server.ServerLog; - -/** - * log producer interface - * - * @author TEO - * @since 1.0.0 - * @deprecated fluentbit으로 대체 - */ -@Deprecated(since = "1.0.0") -public interface LogProducer { - void sendMessage(AppLog message); - - void sendMessage(ServerLog message); -} diff --git a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/enums/Topic.java b/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/enums/Topic.java deleted file mode 100644 index 1e8128b1..00000000 --- a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/enums/Topic.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.coniverse.dangjang.domain.infrastructure.datastream.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -@Deprecated(since = "1.0.0") -public enum Topic { - CLIENT_LOG("-client-log"), - SERVER_LOG("-server-log"); - - private final String name; -} diff --git a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kafka/KafkaProducer.java b/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kafka/KafkaProducer.java deleted file mode 100644 index be2cde32..00000000 --- a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kafka/KafkaProducer.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.coniverse.dangjang.domain.infrastructure.datastream.kafka; - -import org.springframework.context.annotation.Profile; -import org.springframework.kafka.core.KafkaTemplate; - -import com.coniverse.dangjang.domain.infrastructure.datastream.LogProducer; -import com.coniverse.dangjang.domain.infrastructure.datastream.enums.Topic; -import com.coniverse.dangjang.domain.log.dto.app.AppLog; -import com.coniverse.dangjang.domain.log.dto.server.ServerLog; - -import lombok.RequiredArgsConstructor; - -/** - * kafka producer - * - * @author TEO - * @since 1.0.0 - * @deprecated fluentbit으로 대체 - */ -// @Service -@RequiredArgsConstructor -@Profile({"local"}) -@Deprecated(since = "1.0.0") -public class KafkaProducer implements LogProducer { - private final KafkaTemplate kafkaClientLogTemplate; - private final KafkaTemplate kafkaServerLogTemplate; - - @Override - public void sendMessage(AppLog message) { - kafkaClientLogTemplate.send("local" + Topic.CLIENT_LOG.getName(), message); - } - - @Override - public void sendMessage(ServerLog message) { - kafkaServerLogTemplate.send("local" + Topic.SERVER_LOG.getName(), message); - } -} diff --git a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kinesis/KinesisProducer.java b/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kinesis/KinesisProducer.java deleted file mode 100644 index 59f061b4..00000000 --- a/src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kinesis/KinesisProducer.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.coniverse.dangjang.domain.infrastructure.datastream.kinesis; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Profile; - -import com.coniverse.dangjang.domain.infrastructure.datastream.LogProducer; -import com.coniverse.dangjang.domain.infrastructure.datastream.enums.Topic; -import com.coniverse.dangjang.domain.log.dto.app.AppLog; -import com.coniverse.dangjang.domain.log.dto.server.ServerLog; - -import lombok.RequiredArgsConstructor; -import software.amazon.awssdk.core.SdkBytes; -import software.amazon.awssdk.services.kinesis.KinesisAsyncClient; -import software.amazon.awssdk.services.kinesis.model.PutRecordRequest; - -/** - * kinesis producer - * - * @author TEO - * @since 1.0.0 - * @deprecated fluentbit으로 대체 - */ -// @Service -@RequiredArgsConstructor -@Profile({"dev", "prod"}) -@Deprecated(since = "1.0.0") -public class KinesisProducer implements LogProducer { - private final KinesisAsyncClient kinesisAsyncClient; - @Value("${spring.profiles.active}") - private String env; - - @Override - public void sendMessage(AppLog message) { - PutRecordRequest request = PutRecordRequest.builder() - .partitionKey("partition key") - .streamName(env + Topic.CLIENT_LOG.getName()) - .data(SdkBytes.fromByteArray(message.toString().getBytes())) - .build(); - - kinesisAsyncClient.putRecord(request); - } - - @Override - public void sendMessage(ServerLog message) { - PutRecordRequest request = PutRecordRequest.builder() - .partitionKey("partition key") - .streamName(env + Topic.SERVER_LOG.getName()) - .data(SdkBytes.fromByteArray(message.toString().getBytes())) - .build(); - - kinesisAsyncClient.putRecord(request); - } -} diff --git a/src/main/java/com/coniverse/dangjang/domain/log/controller/AppLogController.java b/src/main/java/com/coniverse/dangjang/domain/log/controller/AppLogController.java index ab7f1082..b44be230 100644 --- a/src/main/java/com/coniverse/dangjang/domain/log/controller/AppLogController.java +++ b/src/main/java/com/coniverse/dangjang/domain/log/controller/AppLogController.java @@ -11,6 +11,7 @@ import com.coniverse.dangjang.domain.log.service.LogService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -21,8 +22,8 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/log") @RequiredArgsConstructor +@RequestMapping("/log") public class AppLogController { private final LogService logService; @@ -30,10 +31,25 @@ public class AppLogController { * 앱 로그를 post 요청한다. * * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> post(@Valid @RequestBody LogRequest request) { logService.sendLog(request); return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } + + /** + * 앱 로그를 post 요청한다. + * + * @param request 로그 요청 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping + public ResponseEntity> postLogV1(@Valid @RequestBody LogRequest request) { + logService.sendLog(request); + return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/notification/controller/NotificationController.java b/src/main/java/com/coniverse/dangjang/domain/notification/controller/NotificationController.java index 63d9421f..94627388 100644 --- a/src/main/java/com/coniverse/dangjang/domain/notification/controller/NotificationController.java +++ b/src/main/java/com/coniverse/dangjang/domain/notification/controller/NotificationController.java @@ -15,6 +15,7 @@ import com.coniverse.dangjang.domain.notification.service.NotificationService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -25,8 +26,8 @@ * @since 1.1.0 */ @RestController -@RequestMapping("/api/notification") @RequiredArgsConstructor +@RequestMapping("/notification") public class NotificationController { private final NotificationService notificationService; @@ -36,13 +37,30 @@ public class NotificationController { * @param user 사용자 * @return notificationList 확인 안된 알림 목록 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@AuthenticationPrincipal User user) { NotificationListResponse response = new NotificationListResponse(notificationService.getNotificationList(user.getUsername())); return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * 미확인 알림 목록 조회 + * + * @param user 사용자 정보 + * @return notificationList 확인하지 않은 알림 목록 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getUnreadNotificationsV1(@AuthenticationPrincipal User user) { + NotificationListResponse response = new NotificationListResponse(notificationService.getNotificationList(user.getUsername())); // TODO 객체 생성 이동 + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + /** * 확인된 알림 변경 요청 *

@@ -51,12 +69,28 @@ public ResponseEntity> get(@Auth * * @param notificationIdList 알림Id 목록 * @since 1.0.0 + * @deprecated 1.6.0 */ - + @Deprecated(since = "1.6.0") @PatchMapping public ResponseEntity> patch(@Valid @RequestBody CheckNotificationIdRequest notificationIdList) { notificationService.updateNotificationIsRead(notificationIdList); return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } + /** + * 확인된 푸쉬 알림 변경 + *

+ * 클라이언트에서 사용자가 확인한 알림 id 목록을 서버로 전달하고 서버에서 알림 확인 여부를 변경한다. + * + * @param notificationIds 푸쉬 알림 id 목록 + * @since 1.6.0 + */ + @ApiVersion("1") + @PatchMapping + public ResponseEntity> patchNotificationsAsReadV1(@Valid @RequestBody CheckNotificationIdRequest notificationIds) { + notificationService.updateNotificationIsRead(notificationIds); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/notification/dto/fluentd/FcmMessage.java b/src/main/java/com/coniverse/dangjang/domain/notification/dto/message/FcmMessage.java similarity index 78% rename from src/main/java/com/coniverse/dangjang/domain/notification/dto/fluentd/FcmMessage.java rename to src/main/java/com/coniverse/dangjang/domain/notification/dto/message/FcmMessage.java index 81425281..fece99f4 100644 --- a/src/main/java/com/coniverse/dangjang/domain/notification/dto/fluentd/FcmMessage.java +++ b/src/main/java/com/coniverse/dangjang/domain/notification/dto/message/FcmMessage.java @@ -1,4 +1,4 @@ -package com.coniverse.dangjang.domain.notification.dto.fluentd; +package com.coniverse.dangjang.domain.notification.dto.message; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationSendService.java b/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationSendService.java index 10d42f88..4a2842ac 100644 --- a/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationSendService.java +++ b/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationSendService.java @@ -5,7 +5,7 @@ import org.springframework.web.client.ResourceAccessException; import org.springframework.web.client.RestTemplate; -import com.coniverse.dangjang.domain.notification.dto.fluentd.FcmMessage; +import com.coniverse.dangjang.domain.notification.dto.message.FcmMessage; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationService.java b/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationService.java index 408d2a8e..ed753acd 100644 --- a/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationService.java +++ b/src/main/java/com/coniverse/dangjang/domain/notification/service/NotificationService.java @@ -7,7 +7,7 @@ import org.springframework.stereotype.Service; -import com.coniverse.dangjang.domain.notification.dto.fluentd.FcmMessage; +import com.coniverse.dangjang.domain.notification.dto.message.FcmMessage; import com.coniverse.dangjang.domain.notification.dto.request.CheckNotificationIdRequest; import com.coniverse.dangjang.domain.notification.dto.response.NotificationResponse; import com.coniverse.dangjang.domain.notification.entity.Notification; @@ -147,8 +147,8 @@ public List makeAccessFcmMessage() { List fcmTokens = userFcmTokens.stream() .map(userFcmToken -> userFcmToken.getFcmToken()) .collect(Collectors.toList()); - String title = "오늘의 접속"; - String content = "오늘 접속하지 않았어요! 접속하고 포인트를 받아가세요!"; + String title = "오늘의 건강 상태는?"; //TODO : title, content Enum으로 관리 + String content = "꾸준히 기록하고, 건강 상태를 비교해 봐요!"; NotificationType notificationType = notificationSearchService.findNotificationType("접속"); List notifications = userFcmTokens.stream() diff --git a/src/main/java/com/coniverse/dangjang/domain/point/controller/PointController.java b/src/main/java/com/coniverse/dangjang/domain/point/controller/PointController.java index 977d8269..d9498824 100644 --- a/src/main/java/com/coniverse/dangjang/domain/point/controller/PointController.java +++ b/src/main/java/com/coniverse/dangjang/domain/point/controller/PointController.java @@ -17,6 +17,7 @@ import com.coniverse.dangjang.domain.point.service.PointService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -27,9 +28,9 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/point") @RequiredArgsConstructor @Validated +@RequestMapping("/point") public class PointController { private final PointService pointService; @@ -39,7 +40,9 @@ public class PointController { * @param request 포인트 구매하고자 하는 내역 정보 * @return response 사용자 구매 완료 내역 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> purchaseProduct(@Valid @RequestBody UsePointRequest request, @AuthenticationPrincipal User user) { @@ -47,16 +50,49 @@ public ResponseEntity> purchaseProduct(@ return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * 포인트 상품 구매 + * + * @param request 포인트 구매하고자 하는 내역 정보 + * @param user 사용자 정보 + * @return response 사용자 구매 완료 내역 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping + public ResponseEntity> purchaseProductV1(@Valid @RequestBody UsePointRequest request, + @AuthenticationPrincipal User user) { + UsePointResponse response = pointService.purchaseProduct(user.getUsername(), request); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + /** * 구매 가능 포인트 상품 목록 조회 * * @return response 사용자 포인트 잔액, 구매 가능한 상품 내역 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> getProductList(@AuthenticationPrincipal User user) { ProductListResponse response = pointService.getProducts(user.getUsername()); return ResponseEntity.ok(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * 구매 가능 포인트 상품 목록 조회 + * + * @param user 사용자 정보 + * @return response 사용자 포인트 잔액, 구매 가능한 상품 내역 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping + public ResponseEntity> getPurchasableProducts(@AuthenticationPrincipal User user) { + ProductListResponse response = pointService.getProducts(user.getUsername()); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/scheduler/service/SchedulerService.java b/src/main/java/com/coniverse/dangjang/domain/scheduler/service/SchedulerService.java index 17bda0b3..4310fc2f 100644 --- a/src/main/java/com/coniverse/dangjang/domain/scheduler/service/SchedulerService.java +++ b/src/main/java/com/coniverse/dangjang/domain/scheduler/service/SchedulerService.java @@ -10,7 +10,7 @@ import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock; -import com.coniverse.dangjang.domain.notification.dto.fluentd.FcmMessage; +import com.coniverse.dangjang.domain.notification.dto.message.FcmMessage; import com.coniverse.dangjang.domain.notification.service.NotificationSendService; import com.coniverse.dangjang.domain.notification.service.NotificationService; diff --git a/src/main/java/com/coniverse/dangjang/domain/user/controller/SignupController.java b/src/main/java/com/coniverse/dangjang/domain/user/controller/SignupController.java index 15285fd0..9e613d12 100644 --- a/src/main/java/com/coniverse/dangjang/domain/user/controller/SignupController.java +++ b/src/main/java/com/coniverse/dangjang/domain/user/controller/SignupController.java @@ -13,6 +13,7 @@ import com.coniverse.dangjang.domain.user.service.UserSignupService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -22,23 +23,42 @@ */ @RestController @RequiredArgsConstructor -@RequestMapping("/api/signup") +@RequestMapping("/signup") public class SignupController { + private static final String ACCESS_TOKEN = "AccessToken"; private final UserSignupService userSignupService; private final OauthLoginService oauthLoginService; - private static String headerKeyAccessToken = "AccessToken"; /** * @param params 회원가입에 필요한 정보를 담아온다. * @return 회원가입 후 로그인을 시도 , ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, authID)를 전달한다. * @since 1.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> signUp(@Valid @RequestBody SignUpRequest params) { LoginResponse loginResponse = userSignupService.signUp(params); String accessToken = oauthLoginService.getAuthToken(loginResponse.nickname()); return ResponseEntity.ok() - .header(headerKeyAccessToken, accessToken) + .header(ACCESS_TOKEN, accessToken) + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), loginResponse)); + } + + /** + * 회원가입을 진행한다. + * + * @param params 회원가입에 필요한 정보 + * @return jwt token, 로그인 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping + public ResponseEntity> signUpV1(@Valid @RequestBody SignUpRequest params) { + LoginResponse loginResponse = userSignupService.signUp(params); + String accessToken = oauthLoginService.getAuthToken(loginResponse.nickname()); + return ResponseEntity.ok() + .header(ACCESS_TOKEN, accessToken) .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), loginResponse)); } } diff --git a/src/main/java/com/coniverse/dangjang/domain/user/controller/UserController.java b/src/main/java/com/coniverse/dangjang/domain/user/controller/UserController.java index 34d26cc9..d7916463 100644 --- a/src/main/java/com/coniverse/dangjang/domain/user/controller/UserController.java +++ b/src/main/java/com/coniverse/dangjang/domain/user/controller/UserController.java @@ -22,6 +22,7 @@ import com.coniverse.dangjang.domain.user.service.UserWithdrawalService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Pattern; @@ -33,9 +34,10 @@ */ @RestController @RequiredArgsConstructor -@RequestMapping("/api/user") @Validated -public class UserController { // TODO 전체 수정 (위치: signup, 이름: duplicated-nickname, 바디없어도됨) +@RequestMapping("/user") +public class UserController { + private static final String NICKNAME_PATTERN = "^[가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9]{1,8}$"; private final UserSignupService userSignupService; private final MypageService mypageService; private final UserWithdrawalService userWithdrawalService; @@ -45,7 +47,9 @@ public class UserController { // TODO 전체 수정 (위치: signup, 이름: dup * @param nickname 확인이 필요한 닉네임을 담아온다. * @return 닉네임이 중복되지 않았으면 true, 중복된 닉네임이면 false를 담은 DuplicateNicknameResponse 객체를 반환한다. * @since 1.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping("/duplicateNickname") public ResponseEntity> checkDuplicateNickname( @RequestParam @Pattern(regexp = "^[가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9]{1,8}$", message = "닉네임은 영어,한글,숫자 1~8글자 이내로 이루어져있어야 합니다.") @NotBlank(message = "닉네임은 1~8글자 이내여야 합니다.") String nickname) { @@ -53,24 +57,80 @@ public ResponseEntity> checkDup return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), duplicateNicknameResponse)); } + /** + * 닉네임 중복 여부 확인 + * + * @param nickname 확인이 필요한 닉네임 + * @return 닉네임이 중복되지 않았으면 true, 중복된 닉네임이면 false를 담은 DuplicateNicknameResponse 객체를 반환한다. + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping("/duplicateNickname") // TODO 위치: signup, 이름: duplicated-nickname, 바디없어도됨 + public ResponseEntity> verifyDuplicatedNicknameV1( + @RequestParam @Pattern(regexp = NICKNAME_PATTERN, message = "닉네임은 영어, 한글, 숫자 1 ~ 8글자 이내로 이루어져있어야 합니다.") @NotBlank(message = "닉네임은 1~8글자 이내여야 합니다.") String nickname) { + DuplicateNicknameResponse duplicateNicknameResponse = userSignupService.checkDuplicatedNickname(nickname); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), duplicateNicknameResponse)); + } + /** * Mypage에 필요한 정보를 조회한다. * * @return MypageResponse 사용자 닉네임과 포인트 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping("/mypage") public ResponseEntity> getMyPage(@AuthenticationPrincipal User user) { MypageResponse response = mypageService.getMypage(user.getUsername()); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); } + /** + * Mypage에 필요한 사용자 정보 조회 + * + * @param user 사용자 정보 + * @return 닉네임, 보유 포인트 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping("/mypage") + public ResponseEntity> getMyPageV1(@AuthenticationPrincipal User user) { + MypageResponse response = mypageService.getMypage(user.getUsername()); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), response)); + } + + /** + * 회원 탈퇴 + * + * @param user 사용자 정보 + * @return ResponseEntity + * @since 1.0.0 + * @deprecated 1.6.0 + */ + @Deprecated(since = "1.6.0") @DeleteMapping("/withdrawal") public ResponseEntity withdraw(@AuthenticationPrincipal User user) { userWithdrawalService.withdraw(user.getUsername()); return ResponseEntity.noContent().build(); } + /** + * 회원 탈퇴 + * + * @param user 사용자 정보 + * @return ResponseEntity + * @since 1.6.0 + */ + @ApiVersion("1") + @DeleteMapping("/withdrawal") + public ResponseEntity withdrawV1(@AuthenticationPrincipal User user) { + userWithdrawalService.withdraw(user.getUsername()); + return ResponseEntity.noContent().build(); + } + /** * fcmToken 저장 및 업데이트 * @@ -78,10 +138,27 @@ public ResponseEntity withdraw(@AuthenticationPrincipal User user) { * @param request fcmToken * @return MyPageResponse 사용자 닉네임과 포인트 * @since 1.0.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping("/fcmToken") public ResponseEntity> postFcmToken(@AuthenticationPrincipal User user, @Valid @RequestBody PostFcmTokenRequest request) { notificationService.saveOrUpdateFcmToken(request, user.getUsername()); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } + + /** + * fcm token 등록 + * + * @param user 사용자 정보 + * @param request fcm token 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping("/fcmToken") + public ResponseEntity> postFcmTokenV1(@AuthenticationPrincipal User user, @Valid @RequestBody PostFcmTokenRequest request) { + notificationService.saveOrUpdateFcmToken(request, user.getUsername()); + return ResponseEntity.ok() + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } } diff --git a/src/main/java/com/coniverse/dangjang/domain/version/controller/VersionController.java b/src/main/java/com/coniverse/dangjang/domain/version/controller/VersionController.java index fb54a77f..4aa7b597 100644 --- a/src/main/java/com/coniverse/dangjang/domain/version/controller/VersionController.java +++ b/src/main/java/com/coniverse/dangjang/domain/version/controller/VersionController.java @@ -13,6 +13,7 @@ import com.coniverse.dangjang.domain.version.service.VersionService; import com.coniverse.dangjang.global.dto.SuccessSingleResponse; +import given.apiversion.core.annotation.ApiVersion; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -23,8 +24,8 @@ * @since 1.3.0 */ @RestController -@RequestMapping("/api/version") @RequiredArgsConstructor +@RequestMapping("/version") public class VersionController { private final VersionService versionService; @@ -32,21 +33,52 @@ public class VersionController { * 버전 정보를 GET 요청한다. * * @since 1.3.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @GetMapping("/intro") public ResponseEntity>> getIntro() { VersionResponse versionResponse = versionService.getVersionResponse(); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), versionResponse)); } + /** + * 버전 정보를 조회한다. + * + * @return 버전 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @GetMapping("/intro") + public ResponseEntity>> getIntroV1() { + VersionResponse versionResponse = versionService.getVersionResponse(); + return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), versionResponse)); + } + /** * 버전 정보를 POST 요청한다. * * @since 1.3.0 + * @deprecated 1.6.0 */ + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity>> postVersion(@Valid @RequestBody VersionRequest request) { VersionResponse versionResponse = versionService.saveVersion(request); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), versionResponse)); } + + /** + * 버전 정보를 등록한다. + * + * @param request 버전 정보 + * @return 등록된 버전 정보 + * @since 1.6.0 + */ + @ApiVersion("1") + @PostMapping + public ResponseEntity>> postVersionV1(@Valid @RequestBody VersionRequest request) { + VersionResponse versionResponse = versionService.saveVersion(request); + return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), versionResponse)); + } } diff --git a/src/main/java/com/coniverse/dangjang/global/config/AsyncConfig.java b/src/main/java/com/coniverse/dangjang/global/config/AsyncConfig.java new file mode 100644 index 00000000..e9191a02 --- /dev/null +++ b/src/main/java/com/coniverse/dangjang/global/config/AsyncConfig.java @@ -0,0 +1,9 @@ +package com.coniverse.dangjang.global.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; + +@EnableAsync +@Configuration +public class AsyncConfig { // TODO executor 설정 +} diff --git a/src/main/java/com/coniverse/dangjang/global/config/KafkaConfig.java b/src/main/java/com/coniverse/dangjang/global/config/KafkaConfig.java deleted file mode 100644 index 391ed271..00000000 --- a/src/main/java/com/coniverse/dangjang/global/config/KafkaConfig.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.coniverse.dangjang.global.config; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.kafka.clients.admin.AdminClientConfig; -import org.apache.kafka.clients.admin.NewTopic; -import org.apache.kafka.clients.producer.ProducerConfig; -import org.apache.kafka.common.serialization.IntegerSerializer; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Profile; -import org.springframework.kafka.config.TopicBuilder; -import org.springframework.kafka.core.DefaultKafkaProducerFactory; -import org.springframework.kafka.core.KafkaAdmin; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.kafka.core.ProducerFactory; -import org.springframework.kafka.support.serializer.JsonSerializer; - -import com.coniverse.dangjang.domain.infrastructure.datastream.enums.Topic; -import com.coniverse.dangjang.domain.log.dto.app.AppLog; -import com.coniverse.dangjang.domain.log.dto.server.ServerLog; - -/** - * Kafka Configuration - * - * @author TEO - * @since 1.0.0 - * @deprecated fluentbit으로 대체 - */ -// @Configuration -@Profile({"local"}) -@Deprecated(since = "1.0.0") -public class KafkaConfig { - @Value("${spring.kafka.bootstrap-servers}") - private String bootstrapAddress; - - /** - * client log producer factory - * - * @since 1.0.0 - */ - @Bean - public ProducerFactory producerFactoryClientLog() { - Map configProps = new HashMap<>(); - configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); - configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); - configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); - return new DefaultKafkaProducerFactory<>(configProps); - } - - /** - * kafka template for client log - * - * @since 1.0.0 - */ - @Bean - public KafkaTemplate kafkaTemplateClientLog() { - return new KafkaTemplate<>(producerFactoryClientLog()); - } - - /** - * server log producer factory - * - * @since 1.0.0 - */ - @Bean - public ProducerFactory producerFactoryServerLog() { - Map configProps = new HashMap<>(); - configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); - configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); - configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); - return new DefaultKafkaProducerFactory<>(configProps); - } - - /** - * kafka template for server log - * - * @since 1.0.0 - */ - @Bean - public KafkaTemplate kafkaTemplateServerLog() { - return new KafkaTemplate<>(producerFactoryServerLog()); - } - - /** - * kafka admin - * - * @since 1.0.0 - */ - @Bean - public KafkaAdmin admin() { - Map configs = new HashMap<>(); - configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); - return new KafkaAdmin(configs); - } - - /** - * client log topic - * - * @since 1.0.0 - */ - @Bean - public NewTopic topicClientLog() { - return TopicBuilder - .name("local" + Topic.CLIENT_LOG.getName()) - .partitions(3) - .replicas(3) - .build(); - } - - /** - * server log topic - * - * @since 1.0.0 - */ - @Bean - public NewTopic topicServerLog() { - return TopicBuilder - .name("local" + Topic.SERVER_LOG.getName()) - .partitions(3) - .replicas(3) - .build(); - } -} diff --git a/src/main/java/com/coniverse/dangjang/global/config/KinesisConfig.java b/src/main/java/com/coniverse/dangjang/global/config/KinesisConfig.java deleted file mode 100644 index 1d5c86b0..00000000 --- a/src/main/java/com/coniverse/dangjang/global/config/KinesisConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.coniverse.dangjang.global.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Profile; - -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.kinesis.KinesisAsyncClient; - -/** - * Kinesis Configuration - * - * @author TEO - * @since 1.0.0 - * @deprecated fluentbit으로 대체 - */ -// @Configuration -@Profile({"dev", "prod"}) -@Deprecated(since = "1.0.0") -public class KinesisConfig { - @Value("${aws.credentials.access-key}") - private String accessKey; - @Value("${aws.credentials.secret-key}") - private String secretKey; - - /** - * kinesis client - * - * @since 1.0.0 - */ - @Bean - public KinesisAsyncClient kinesisAsyncClient() { - AwsBasicCredentials awsCredentials = AwsBasicCredentials.create(accessKey, secretKey); - StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(awsCredentials); - - return KinesisAsyncClient.builder() - .credentialsProvider(credentialsProvider) - .region(Region.AP_NORTHEAST_2) - .build(); - } -} diff --git a/src/main/java/com/coniverse/dangjang/global/config/SchedulerConfiguration.java b/src/main/java/com/coniverse/dangjang/global/config/SchedulerConfig.java similarity index 82% rename from src/main/java/com/coniverse/dangjang/global/config/SchedulerConfiguration.java rename to src/main/java/com/coniverse/dangjang/global/config/SchedulerConfig.java index 88e65b71..19da5bdd 100644 --- a/src/main/java/com/coniverse/dangjang/global/config/SchedulerConfiguration.java +++ b/src/main/java/com/coniverse/dangjang/global/config/SchedulerConfig.java @@ -4,6 +4,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; import net.javacrumbs.shedlock.core.LockProvider; import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider; @@ -15,11 +16,11 @@ * @since 1.1.0 */ +@EnableScheduling @Configuration -public class SchedulerConfiguration { +public class SchedulerConfig { @Bean public LockProvider lockProvider(DataSource dataSource) { return new JdbcTemplateLockProvider((dataSource)); } - } diff --git a/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java b/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java index cca9d962..054d7931 100644 --- a/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java +++ b/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java @@ -36,8 +36,10 @@ public class SecurityConfig { private final JwtValidationFilter jwtValidationFilter; private final JwtAccessDeniedHandler jwtAccessDeniedHandler; private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; + @Value("${api.version.uri-prefix}") + private final String uriPrefix; @Value("${cors.allowed-origins}") - private String allowedOrigins; + private final String allowedOrigins; /** * SecurityFilterChain 설정 @@ -58,40 +60,69 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .headers(httpSecurityHeadersConfigurer -> httpSecurityHeadersConfigurer.frameOptions( HeadersConfigurer.FrameOptionsConfig::sameOrigin)) .csrf(AbstractHttpConfigurer::disable) - .cors( - corsConfigurer -> corsConfigurer.configurationSource(configurationSource()) - ) + .cors(corsConfigurer -> corsConfigurer.configurationSource(configurationSource())) .formLogin(AbstractHttpConfigurer::disable) .httpBasic(AbstractHttpConfigurer::disable) - .sessionManagement( - sessionManagementConfigurer -> sessionManagementConfigurer.sessionCreationPolicy(SessionCreationPolicy.STATELESS) - ) + .sessionManagement(sessionManagementConfigurer -> sessionManagementConfigurer.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .addFilterAt(jwtValidationFilter, UsernamePasswordAuthenticationFilter.class) .authorizeHttpRequests(authorize -> authorize - .requestMatchers(HttpMethod.GET, "/api/intro/**").permitAll() - .requestMatchers(HttpMethod.POST, "/api/auth/**").permitAll() // TODO 수정 로그아웃은 인증 필요 - .requestMatchers(HttpMethod.POST, "/api/signup/**").permitAll() - .requestMatchers(HttpMethod.GET, "/api/user/duplicateNickname").permitAll() - .requestMatchers(HttpMethod.GET, "/api/user/mypage/**").authenticated() - .requestMatchers(HttpMethod.POST, "/api/user/**").authenticated() - .requestMatchers(HttpMethod.GET, "/swagger-ui/**", "/api-docs/**").permitAll() - .requestMatchers(HttpMethod.POST, "/api/health-metric/**").authenticated() - .requestMatchers(HttpMethod.GET, "/api/health-metric/**").authenticated() - .requestMatchers(HttpMethod.GET, "/api/guide/**").authenticated() - .requestMatchers(HttpMethod.POST, "/api/health-connect/**").authenticated() - .requestMatchers(HttpMethod.PATCH, "/api/health-connect/**").authenticated() - .requestMatchers(HttpMethod.POST, "/api/point/**").authenticated() - .requestMatchers(HttpMethod.GET, "/api/point/**").authenticated() - .requestMatchers(HttpMethod.POST, "/api/log/**").permitAll() - .requestMatchers(HttpMethod.GET, "/api/notification/**").authenticated() - .requestMatchers(HttpMethod.POST, "/api/notification/**").authenticated() - .requestMatchers(HttpMethod.PATCH, "/api/notification/**").authenticated() + // version + .requestMatchers(HttpMethod.GET, uriPrefix + "/version/**").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/version/**").permitAll() + + // auth + .requestMatchers(HttpMethod.POST, uriPrefix + "/auth/logout").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/auth/logout").authenticated() + .requestMatchers(HttpMethod.POST, uriPrefix + "/api/auth/**").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/api/auth/**").permitAll() + + // user + .requestMatchers(HttpMethod.POST, uriPrefix + "/signup/**").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/signup/**").permitAll() + .requestMatchers(HttpMethod.POST, uriPrefix + "/user/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/user/**").authenticated() + .requestMatchers(HttpMethod.DELETE, uriPrefix + "/user/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.DELETE, uriPrefix + "/*/user/**").authenticated() + .requestMatchers(HttpMethod.GET, uriPrefix + "/user/duplicateNickname").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/user/duplicateNickname").permitAll() + .requestMatchers(HttpMethod.GET, uriPrefix + "/user/mypage/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/user/mypage/**").authenticated() + + // health-metric + .requestMatchers(uriPrefix + "/health-metric/**").authenticated() //TODO 제거 + .requestMatchers(uriPrefix + "/*/health-metric/**").authenticated() + + // health-connect + .requestMatchers(HttpMethod.POST, uriPrefix + "/health-connect/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/health-connect/**").authenticated() + .requestMatchers(HttpMethod.PATCH, uriPrefix + "/health-connect/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.PATCH, uriPrefix + "/*/health-connect/**").authenticated() + + // guide + .requestMatchers(HttpMethod.GET, uriPrefix + "/guide/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/guide/**").authenticated() + + // point + .requestMatchers(HttpMethod.POST, uriPrefix + "/point/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/point/**").authenticated() + .requestMatchers(HttpMethod.GET, uriPrefix + "/point/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/point/**").authenticated() + + // log + .requestMatchers(HttpMethod.POST, uriPrefix + "/log/**").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/log/**").permitAll() + + // notification + .requestMatchers(HttpMethod.GET, uriPrefix + "/notification/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/notification/**").authenticated() + .requestMatchers(HttpMethod.PATCH, uriPrefix + "/notification/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.PATCH, uriPrefix + "/*/notification/**").authenticated() + + // etc .anyRequest().permitAll() ) - .exceptionHandling( - handler -> handler.accessDeniedHandler(jwtAccessDeniedHandler) - .authenticationEntryPoint(jwtAuthenticationEntryPoint) - ); + .exceptionHandling(handler -> handler.accessDeniedHandler(jwtAccessDeniedHandler) + .authenticationEntryPoint(jwtAuthenticationEntryPoint)); return http.build(); } diff --git a/src/main/resources/config b/src/main/resources/config index 5fcc9338..1f099250 160000 --- a/src/main/resources/config +++ b/src/main/resources/config @@ -1 +1 @@ -Subproject commit 5fcc9338f9bc5543ffd496ce1c1249488c9650e5 +Subproject commit 1f0992500bd9501f10d7d62bfc74bbfcaede0111 diff --git a/src/test/java/com/coniverse/dangjang/domain/notification/service/NotificationServiceTest.java b/src/test/java/com/coniverse/dangjang/domain/notification/service/NotificationServiceTest.java index 8a37e302..e6de9048 100644 --- a/src/test/java/com/coniverse/dangjang/domain/notification/service/NotificationServiceTest.java +++ b/src/test/java/com/coniverse/dangjang/domain/notification/service/NotificationServiceTest.java @@ -17,7 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import com.coniverse.dangjang.domain.notification.dto.fluentd.FcmMessage; +import com.coniverse.dangjang.domain.notification.dto.message.FcmMessage; import com.coniverse.dangjang.domain.notification.dto.request.CheckNotificationIdRequest; import com.coniverse.dangjang.domain.notification.dto.response.NotificationResponse; import com.coniverse.dangjang.domain.notification.entity.Notification; @@ -172,8 +172,8 @@ void tearDown() { //when List fcmMessages = notificationService.makeAccessFcmMessage(); //then - assertThat(fcmMessages.get(0).title()).isEqualTo("오늘의 접속"); - assertThat(fcmMessages.get(0).body()).isEqualTo("오늘 접속하지 않았어요! 접속하고 포인트를 받아가세요!"); + assertThat(fcmMessages.get(0).title()).isEqualTo("오늘의 건강 상태는?"); + assertThat(fcmMessages.get(0).body()).isEqualTo("꾸준히 기록하고, 건강 상태를 비교해 봐요!"); assertThat(fcmMessages.get(0).registrationToken()).isEqualTo(이브_fcmToken); } diff --git a/src/test/resources/config/application.yml b/src/test/resources/config/application.yml index 43d09e5a..fba0327d 100644 --- a/src/test/resources/config/application.yml +++ b/src/test/resources/config/application.yml @@ -65,6 +65,11 @@ oauth: version: key: "1234" +api: + version: + uri-prefix: /api + sharing-uri-prefix: true + logging: level: org: @@ -83,6 +88,8 @@ logging: core: MongoTemplate: debug web: trace + given: + apiversion: trace --- spring: