From 2675e9a0b57026d0ca563d17ff2c9ed67e22eabc Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:04:13 +0900 Subject: [PATCH 01/17] =?UTF-8?q?build:=20api=20version=20library=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 6b9568b0..dff73b25 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ configurations { repositories { mavenCentral() + maven { url 'https://jitpack.io' } } dependencies { @@ -80,6 +81,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') { From f0c95c38706c7d68c0fdf87984978f95270efa25 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:11:05 +0900 Subject: [PATCH 02/17] chore: update submodule --- src/main/resources/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/config b/src/main/resources/config index 5fcc9338..ff8b66a6 160000 --- a/src/main/resources/config +++ b/src/main/resources/config @@ -1 +1 @@ -Subproject commit 5fcc9338f9bc5543ffd496ce1c1249488c9650e5 +Subproject commit ff8b66a614d9d2661938557e9c7899203dd4eb6a From 2d2801c22c08c449e4936e253b6893a010500dce Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:12:04 +0900 Subject: [PATCH 03/17] =?UTF-8?q?chore:=20api=20verion=20property=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/config/application.yml | 7 +++++++ 1 file changed, 7 insertions(+) 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: From a1a095227ea4666ba936e9658685a7c0ebbbf8f0 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:12:18 +0900 Subject: [PATCH 04/17] =?UTF-8?q?refactor:=20uri=20prefix=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dangjang/DangjangApplication.java | 3 + .../auth/controller/LoginController.java | 2 +- .../controller/BloodSugarGuideController.java | 2 +- .../common/controller/GuideController.java | 2 +- .../controller/ExerciseGuideController.java | 2 +- .../controller/WeightGuideController.java | 2 +- .../controller/HealthConnectController.java | 2 +- .../controller/HealthMetricController.java | 2 +- .../log/controller/AppLogController.java | 2 +- .../controller/NotificationController.java | 2 +- .../point/controller/PointController.java | 2 +- .../user/controller/SignupController.java | 2 +- .../user/controller/UserController.java | 2 +- .../version/controller/VersionController.java | 2 +- .../global/config/SecurityConfig.java | 74 ++++++++++++------- 15 files changed, 63 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/coniverse/dangjang/DangjangApplication.java b/src/main/java/com/coniverse/dangjang/DangjangApplication.java index 4aa49da7..36467b5b 100644 --- a/src/main/java/com/coniverse/dangjang/DangjangApplication.java +++ b/src/main/java/com/coniverse/dangjang/DangjangApplication.java @@ -6,6 +6,9 @@ import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; +import given.apiversion.autoconfigure.EnableApiVersion; + +@EnableApiVersion @EnableScheduling @EnableJpaAuditing @EnableAsync 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..d56d819e 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 @@ -26,7 +26,7 @@ */ @RestController @RequiredArgsConstructor -@RequestMapping("/api/auth") +@RequestMapping("/auth") public class LoginController { private final OauthLoginService oauthLoginService; private static String headerKeyFcmToken = "FcmToken"; 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..7eaf1503 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 @@ -24,7 +24,7 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/guide/blood-sugar") +@RequestMapping("/guide/blood-sugar") @RequiredArgsConstructor @Validated public class BloodSugarGuideController { 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..dd3b1bc6 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 @@ -23,7 +23,7 @@ * @author EVE * @since 1.0.0 */ -@RequestMapping("/api/guide") +@RequestMapping("/guide") @RestController @RequiredArgsConstructor @Validated 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..3da70371 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 @@ -27,7 +27,7 @@ @RestController @RequiredArgsConstructor @Validated -@RequestMapping("/api/guide/exercise") +@RequestMapping("/guide/exercise") public class ExerciseGuideController { private final ExerciseGuideSearchService exerciseGuideSearchService; 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..e775a2da 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 @@ -24,7 +24,7 @@ * @since 1.0.0 */ -@RequestMapping("/api/guide/weight") +@RequestMapping("/guide/weight") @RequiredArgsConstructor @RestController @Validated 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..33288439 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 @@ -25,7 +25,7 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/health-connect") +@RequestMapping("/health-connect") @RequiredArgsConstructor public class HealthConnectController { private final HealthConnectService healthConnectService; 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..94765c52 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 @@ -39,7 +39,7 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/health-metric") +@RequestMapping("/health-metric") @RequiredArgsConstructor @Validated public class HealthMetricController { 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..0e3b97d7 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 @@ -21,7 +21,7 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/log") +@RequestMapping("/log") @RequiredArgsConstructor public class AppLogController { private final LogService logService; 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..5d819e0b 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 @@ -25,7 +25,7 @@ * @since 1.1.0 */ @RestController -@RequestMapping("/api/notification") +@RequestMapping("/notification") @RequiredArgsConstructor public class NotificationController { private final NotificationService notificationService; 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..a210af8e 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 @@ -27,7 +27,7 @@ * @since 1.0.0 */ @RestController -@RequestMapping("/api/point") +@RequestMapping("/point") @RequiredArgsConstructor @Validated public class PointController { 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..cd81ba1d 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 @@ -22,7 +22,7 @@ */ @RestController @RequiredArgsConstructor -@RequestMapping("/api/signup") +@RequestMapping("/signup") public class SignupController { private final UserSignupService userSignupService; private final OauthLoginService oauthLoginService; 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..029265b5 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 @@ -33,7 +33,7 @@ */ @RestController @RequiredArgsConstructor -@RequestMapping("/api/user") +@RequestMapping("/user") @Validated public class UserController { // TODO 전체 수정 (위치: signup, 이름: duplicated-nickname, 바디없어도됨) private final UserSignupService userSignupService; 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..e3a38480 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 @@ -23,7 +23,7 @@ * @since 1.3.0 */ @RestController -@RequestMapping("/api/version") +@RequestMapping("/version") @RequiredArgsConstructor public class VersionController { private final VersionService versionService; 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..5525b5e3 100644 --- a/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java +++ b/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java @@ -36,6 +36,8 @@ 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; @@ -58,40 +60,58 @@ 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() + // version + .requestMatchers(HttpMethod.GET, uriPrefix + "/version/**").permitAll() + + // auth + .requestMatchers(HttpMethod.POST, uriPrefix + "/auth/logout").authenticated() + .requestMatchers(HttpMethod.POST, uriPrefix + "/api/auth/**").permitAll() + + // user + .requestMatchers(HttpMethod.POST, uriPrefix + "/signup/**").permitAll() + .requestMatchers(HttpMethod.POST, uriPrefix + "/user/**").authenticated() + .requestMatchers(HttpMethod.DELETE, uriPrefix + "/user/**").authenticated() + .requestMatchers(HttpMethod.GET, uriPrefix + "/user/duplicateNickname").permitAll() + .requestMatchers(HttpMethod.GET, uriPrefix + "/user/mypage/**").authenticated() + + // swagger .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() + + // health-metric + .requestMatchers(HttpMethod.POST, uriPrefix + "/health-metric/**").authenticated() + .requestMatchers(HttpMethod.PATCH, uriPrefix + "/health-metric/**").authenticated() + .requestMatchers(HttpMethod.GET, uriPrefix + "/health-metric/**").authenticated() + .requestMatchers(HttpMethod.DELETE, uriPrefix + "/health-metric/**").authenticated() + + // health-connect + .requestMatchers(HttpMethod.POST, uriPrefix + "/health-connect/**").authenticated() + .requestMatchers(HttpMethod.PATCH, uriPrefix + "/health-connect/**").authenticated() + + // guide + .requestMatchers(HttpMethod.GET, uriPrefix + "/guide/**").authenticated() + + // point + .requestMatchers(HttpMethod.POST, uriPrefix + "/point/**").authenticated() + .requestMatchers(HttpMethod.GET, uriPrefix + "/point/**").authenticated() + + // log + .requestMatchers(HttpMethod.POST, uriPrefix + "/log/**").permitAll() + + // notification + .requestMatchers(HttpMethod.GET, uriPrefix + "/notification/**").authenticated() + .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(); } From 9e3b12e9d53afba57fdc443836e41d72d39020b3 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:15:41 +0900 Subject: [PATCH 05/17] =?UTF-8?q?build:=20kafka,=20kinesiss=20dependency?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index dff73b25..fc79a530 100644 --- a/build.gradle +++ b/build.gradle @@ -37,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' @@ -55,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' From 35e85a5c6176ef7d23e4744efe9087af794740a1 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:15:54 +0900 Subject: [PATCH 06/17] =?UTF-8?q?refactor:=20deprecated=20code=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datastream/LogProducer.java | 18 --- .../datastream/enums/Topic.java | 14 -- .../datastream/kafka/KafkaProducer.java | 37 ------ .../datastream/kinesis/KinesisProducer.java | 53 -------- .../dangjang/global/config/KafkaConfig.java | 125 ------------------ .../dangjang/global/config/KinesisConfig.java | 43 ------ 6 files changed, 290 deletions(-) delete mode 100644 src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/LogProducer.java delete mode 100644 src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/enums/Topic.java delete mode 100644 src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kafka/KafkaProducer.java delete mode 100644 src/main/java/com/coniverse/dangjang/domain/infrastructure/datastream/kinesis/KinesisProducer.java delete mode 100644 src/main/java/com/coniverse/dangjang/global/config/KafkaConfig.java delete mode 100644 src/main/java/com/coniverse/dangjang/global/config/KinesisConfig.java 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/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(); - } -} From 495ee62ae6f6c32c13575e7a5f850ce0d71cc283 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:17:01 +0900 Subject: [PATCH 07/17] =?UTF-8?q?refactor:=20=EC=96=B4=EB=85=B8=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=9D=B4=EB=8F=99,=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/coniverse/dangjang/DangjangApplication.java | 2 -- .../{SchedulerConfiguration.java => SchedulerConfig.java} | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) rename src/main/java/com/coniverse/dangjang/global/config/{SchedulerConfiguration.java => SchedulerConfig.java} (82%) diff --git a/src/main/java/com/coniverse/dangjang/DangjangApplication.java b/src/main/java/com/coniverse/dangjang/DangjangApplication.java index 36467b5b..c609e081 100644 --- a/src/main/java/com/coniverse/dangjang/DangjangApplication.java +++ b/src/main/java/com/coniverse/dangjang/DangjangApplication.java @@ -4,12 +4,10 @@ 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; import given.apiversion.autoconfigure.EnableApiVersion; @EnableApiVersion -@EnableScheduling @EnableJpaAuditing @EnableAsync @SpringBootApplication 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)); } - } From 8d470bcfd7d402cbbf1f3d35665cb4f733ba79bc Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:20:15 +0900 Subject: [PATCH 08/17] =?UTF-8?q?refactor:=20async=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/coniverse/dangjang/DangjangApplication.java | 2 -- .../coniverse/dangjang/global/config/AsyncConfig.java | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/coniverse/dangjang/global/config/AsyncConfig.java diff --git a/src/main/java/com/coniverse/dangjang/DangjangApplication.java b/src/main/java/com/coniverse/dangjang/DangjangApplication.java index c609e081..7f1c1b91 100644 --- a/src/main/java/com/coniverse/dangjang/DangjangApplication.java +++ b/src/main/java/com/coniverse/dangjang/DangjangApplication.java @@ -3,13 +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 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/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 설정 +} From 7d5085bf5e575e74e2d753f47cbbdf3d884b7296 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sat, 11 Nov 2023 23:25:24 +0900 Subject: [PATCH 09/17] chore: update submodule --- src/main/resources/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/config b/src/main/resources/config index ff8b66a6..1f099250 160000 --- a/src/main/resources/config +++ b/src/main/resources/config @@ -1 +1 @@ -Subproject commit ff8b66a614d9d2661938557e9c7899203dd4eb6a +Subproject commit 1f0992500bd9501f10d7d62bfc74bbfcaede0111 From ef0b273c12cbe79b322a1275d70f9106e3ec68a6 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sun, 12 Nov 2023 01:40:14 +0900 Subject: [PATCH 10/17] =?UTF-8?q?refactor:=20=EB=B2=84=EC=A0=80=EB=8B=9D?= =?UTF-8?q?=EB=90=9C=20api=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/LoginController.java | 86 +++++++++++++++-- .../controller/BloodSugarGuideController.java | 22 ++++- .../common/controller/GuideController.java | 21 +++- .../controller/ExerciseGuideController.java | 23 ++++- .../controller/WeightGuideController.java | 26 ++++- .../controller/HealthConnectController.java | 42 +++++++- .../controller/HealthMetricController.java | 96 ++++++++++++++++++- .../log/controller/AppLogController.java | 18 +++- .../controller/NotificationController.java | 38 +++++++- .../point/controller/PointController.java | 38 +++++++- .../user/controller/SignupController.java | 24 ++++- .../user/controller/UserController.java | 81 +++++++++++++++- .../version/controller/VersionController.java | 34 ++++++- .../global/config/SecurityConfig.java | 59 +++++++----- 14 files changed, 557 insertions(+), 51 deletions(-) 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 d56d819e..a96b4b97 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; @@ -28,23 +29,38 @@ @RequiredArgsConstructor @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.4.0 */ + @Deprecated(since = "1.4.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 카카오 accessToken + * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. + * @since 1.4.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 +68,30 @@ public ResponseEntity> loginKakao(@Valid @R * @param params 네이버 accessToken * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. * @since 1.0.0 + * @deprecated 1.4.0 */ + @Deprecated(since = "1.4.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 네이버 accessToken + * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. + * @since 1.4.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 +101,30 @@ public ResponseEntity> loginNaver(@Valid @R * @param request 재발급 요청 , header에 accessToken이 필요 * @return AuthToken * @since 1.0.0 + * @deprecated 1.4.0 */ + @Deprecated(since = "1.4.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(headerKeyAccessToken, newAccessToken) + .header(ACCESS_TOKEN, newAccessToken) + .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); + } + + /** + * refreshToken으로 AuthToken 재발급 + * + * @param request 재발급 요청 , header에 accessToken이 필요 + * @return AuthToken + * @since 1.4.0 + */ + @ApiVersion("1") + @PostMapping("/reissue") + public ResponseEntity> reissueV1(HttpServletRequest request) { + String newAccessToken = oauthLoginService.reissueToken(request.getHeader(AUTHORIZATION)); + return ResponseEntity.ok() + .header(ACCESS_TOKEN, newAccessToken) .body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), null)); } @@ -83,10 +134,27 @@ public ResponseEntity> reissue(HttpServletRequest reque * @param request HttpServletRequest oauthId * @param logoutFcmTokenRequest fcmToken * @since 1.1.0 + * @deprecated 1.4.0 */ + @Deprecated(since = "1.4.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 oauthId + * @param logoutFcmTokenRequest fcmToken + * @since 1.4.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 7eaf1503..d0ecc0e9 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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 dd3b1bc6..74be6e3f 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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 3da70371..db209df3 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; /** @@ -38,13 +39,31 @@ public class ExerciseGuideController { * @param principal 유저 정보 * @return 운동 가이드 응답 * @since 1.0.0 + * @deprecated 1.4.0 */ - + @Deprecated(since = "1.4.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.4.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 e775a2da..c87b0332 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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 33288439..27533d79 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ - + @Deprecated(since = "1.4.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.4.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 94765c52..4a09954d 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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/log/controller/AppLogController.java b/src/main/java/com/coniverse/dangjang/domain/log/controller/AppLogController.java index 0e3b97d7..a87d16a1 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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 5d819e0b..d343f1cb 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ - + @Deprecated(since = "1.4.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.4.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/point/controller/PointController.java b/src/main/java/com/coniverse/dangjang/domain/point/controller/PointController.java index a210af8e..29ccf6c8 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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/user/controller/SignupController.java b/src/main/java/com/coniverse/dangjang/domain/user/controller/SignupController.java index cd81ba1d..37b7651a 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; @@ -24,21 +25,40 @@ @RequiredArgsConstructor @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.4.0 */ + @Deprecated(since = "1.4.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.4.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 029265b5..21c5c0e9 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("/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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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.4.0 + */ + @Deprecated(since = "1.4.0") @DeleteMapping("/withdrawal") public ResponseEntity withdraw(@AuthenticationPrincipal User user) { userWithdrawalService.withdraw(user.getUsername()); return ResponseEntity.noContent().build(); } + /** + * 회원 탈퇴 + * + * @param user 사용자 정보 + * @return ResponseEntity + * @since 1.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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 e3a38480..560b42f7 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("/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.4.0 */ + @Deprecated(since = "1.4.0") @GetMapping("/intro") public ResponseEntity>> getIntro() { VersionResponse versionResponse = versionService.getVersionResponse(); return ResponseEntity.ok().body(new SuccessSingleResponse<>(HttpStatus.OK.getReasonPhrase(), versionResponse)); } + /** + * 버전 정보를 조회한다. + * + * @return 버전 정보 + * @since 1.4.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.4.0 */ + @Deprecated(since = "1.4.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.4.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/SecurityConfig.java b/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java index 5525b5e3..054d7931 100644 --- a/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java +++ b/src/main/java/com/coniverse/dangjang/global/config/SecurityConfig.java @@ -39,7 +39,7 @@ public class SecurityConfig { @Value("${api.version.uri-prefix}") private final String uriPrefix; @Value("${cors.allowed-origins}") - private String allowedOrigins; + private final String allowedOrigins; /** * SecurityFilterChain 설정 @@ -67,45 +67,56 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .addFilterAt(jwtValidationFilter, UsernamePasswordAuthenticationFilter.class) .authorizeHttpRequests(authorize -> authorize // version - .requestMatchers(HttpMethod.GET, uriPrefix + "/version/**").permitAll() + .requestMatchers(HttpMethod.GET, uriPrefix + "/version/**").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/version/**").permitAll() // auth - .requestMatchers(HttpMethod.POST, uriPrefix + "/auth/logout").authenticated() - .requestMatchers(HttpMethod.POST, uriPrefix + "/api/auth/**").permitAll() + .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() - .requestMatchers(HttpMethod.POST, uriPrefix + "/user/**").authenticated() - .requestMatchers(HttpMethod.DELETE, uriPrefix + "/user/**").authenticated() - .requestMatchers(HttpMethod.GET, uriPrefix + "/user/duplicateNickname").permitAll() - .requestMatchers(HttpMethod.GET, uriPrefix + "/user/mypage/**").authenticated() - - // swagger - .requestMatchers(HttpMethod.GET, "/swagger-ui/**", "/api-docs/**").permitAll() + .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(HttpMethod.POST, uriPrefix + "/health-metric/**").authenticated() - .requestMatchers(HttpMethod.PATCH, uriPrefix + "/health-metric/**").authenticated() - .requestMatchers(HttpMethod.GET, uriPrefix + "/health-metric/**").authenticated() - .requestMatchers(HttpMethod.DELETE, uriPrefix + "/health-metric/**").authenticated() + .requestMatchers(uriPrefix + "/health-metric/**").authenticated() //TODO 제거 + .requestMatchers(uriPrefix + "/*/health-metric/**").authenticated() // health-connect - .requestMatchers(HttpMethod.POST, uriPrefix + "/health-connect/**").authenticated() - .requestMatchers(HttpMethod.PATCH, uriPrefix + "/health-connect/**").authenticated() + .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() + .requestMatchers(HttpMethod.GET, uriPrefix + "/guide/**").authenticated() //TODO 제거 + .requestMatchers(HttpMethod.GET, uriPrefix + "/*/guide/**").authenticated() // point - .requestMatchers(HttpMethod.POST, uriPrefix + "/point/**").authenticated() - .requestMatchers(HttpMethod.GET, uriPrefix + "/point/**").authenticated() + .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() + .requestMatchers(HttpMethod.POST, uriPrefix + "/log/**").permitAll() //TODO 제거 + .requestMatchers(HttpMethod.POST, uriPrefix + "/*/log/**").permitAll() // notification - .requestMatchers(HttpMethod.GET, uriPrefix + "/notification/**").authenticated() - .requestMatchers(HttpMethod.PATCH, uriPrefix + "/notification/**").authenticated() + .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() From 40f3fc71702710a35296efc8a616fdde05fe4f52 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sun, 12 Nov 2023 01:40:24 +0900 Subject: [PATCH 11/17] =?UTF-8?q?refactor:=20=EB=94=94=EB=A0=89=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/dto/{fluentd => message}/FcmMessage.java | 2 +- .../domain/notification/service/NotificationSendService.java | 2 +- .../domain/notification/service/NotificationService.java | 2 +- .../dangjang/domain/scheduler/service/SchedulerService.java | 2 +- .../domain/notification/service/NotificationServiceTest.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename src/main/java/com/coniverse/dangjang/domain/notification/dto/{fluentd => message}/FcmMessage.java (78%) 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..4f7d8fd6 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; 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/test/java/com/coniverse/dangjang/domain/notification/service/NotificationServiceTest.java b/src/test/java/com/coniverse/dangjang/domain/notification/service/NotificationServiceTest.java index 8a37e302..47eb2449 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; From 8dd3ccb8a998a56f1bb11cc93c10efb291f32b15 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sun, 12 Nov 2023 01:48:36 +0900 Subject: [PATCH 12/17] =?UTF-8?q?docs:=20Javadoc=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/LoginController.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 a96b4b97..cc1b2c84 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 @@ -50,8 +50,10 @@ public ResponseEntity> loginKakao(@Valid @R } /** - * @param params 카카오 accessToken - * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. + * 카카오 로그인 + * + * @param params 카카오 access token + * @return jwt token, 로그인 정보 * @since 1.4.0 */ @ApiVersion("1") @@ -81,8 +83,10 @@ public ResponseEntity> loginNaver(@Valid @R } /** - * @param params 네이버 accessToken - * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. + * 네이버 로그인 + * + * @param params 네이버 access token + * @return jwt token, 로그인 정보 * @since 1.4.0 */ @ApiVersion("1") @@ -113,9 +117,9 @@ public ResponseEntity> reissue(HttpServletRequest reque } /** - * refreshToken으로 AuthToken 재발급 + * refresh token으로 access token 재발급 * - * @param request 재발급 요청 , header에 accessToken이 필요 + * @param request 재발급 요청, header에 access token 필요 * @return AuthToken * @since 1.4.0 */ @@ -147,8 +151,8 @@ public ResponseEntity logout(HttpServletRequest request, /** * 로그아웃 * - * @param request HttpServletRequest oauthId - * @param logoutFcmTokenRequest fcmToken + * @param request HttpServletRequest + * @param logoutFcmTokenRequest fcm token 정보 * @since 1.4.0 */ @ApiVersion("1") From 43859029b553483609f504f30b388cd00ec55696 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sun, 12 Nov 2023 21:07:53 +0900 Subject: [PATCH 13/17] =?UTF-8?q?docs:=20Javadoc=20=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/LoginController.java | 24 +++++++-------- .../controller/BloodSugarGuideController.java | 6 ++-- .../common/controller/GuideController.java | 6 ++-- .../controller/ExerciseGuideController.java | 6 ++-- .../controller/WeightGuideController.java | 6 ++-- .../controller/HealthConnectController.java | 12 ++++---- .../controller/HealthMetricController.java | 30 +++++++++---------- .../log/controller/AppLogController.java | 6 ++-- .../controller/NotificationController.java | 12 ++++---- .../point/controller/PointController.java | 12 ++++---- .../user/controller/SignupController.java | 6 ++-- .../user/controller/UserController.java | 24 +++++++-------- .../version/controller/VersionController.java | 12 ++++---- 13 files changed, 81 insertions(+), 81 deletions(-) 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 cc1b2c84..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 @@ -37,9 +37,9 @@ public class LoginController { * @param params 카카오 accessToken * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping("/kakao") public ResponseEntity> loginKakao(@Valid @RequestBody KakaoLoginRequest params) { LoginResponse loginResponse = oauthLoginService.login(params); @@ -54,7 +54,7 @@ public ResponseEntity> loginKakao(@Valid @R * * @param params 카카오 access token * @return jwt token, 로그인 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping("/kakao") @@ -70,9 +70,9 @@ public ResponseEntity> loginKakaoV1(@Valid * @param params 네이버 accessToken * @return ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, auth id)를 전달한다. * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping("/naver") public ResponseEntity> loginNaver(@Valid @RequestBody NaverLoginRequest params) { LoginResponse loginResponse = oauthLoginService.login(params); @@ -87,7 +87,7 @@ public ResponseEntity> loginNaver(@Valid @R * * @param params 네이버 access token * @return jwt token, 로그인 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping("/naver") @@ -105,9 +105,9 @@ public ResponseEntity> loginNaverV1(@Valid * @param request 재발급 요청 , header에 accessToken이 필요 * @return AuthToken * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping("/reissue") public ResponseEntity> reissue(HttpServletRequest request) { String newAccessToken = oauthLoginService.reissueToken(request.getHeader(AUTHORIZATION)); @@ -121,7 +121,7 @@ public ResponseEntity> reissue(HttpServletRequest reque * * @param request 재발급 요청, header에 access token 필요 * @return AuthToken - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping("/reissue") @@ -138,9 +138,9 @@ public ResponseEntity> reissueV1(HttpServletRequest req * @param request HttpServletRequest oauthId * @param logoutFcmTokenRequest fcmToken * @since 1.1.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping("/logout") public ResponseEntity logout(HttpServletRequest request, @RequestBody LogoutFcmTokenRequest logoutFcmTokenRequest) { oauthLoginService.logout(request.getHeader(AUTHORIZATION), logoutFcmTokenRequest.fcmToken()); @@ -153,7 +153,7 @@ public ResponseEntity logout(HttpServletRequest request, * * @param request HttpServletRequest * @param logoutFcmTokenRequest fcm token 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping("/logout") 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 d0ecc0e9..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 @@ -38,9 +38,9 @@ public class BloodSugarGuideController { * @param principal 사용자 정보 * @return 혈당 가이드 응답 dto * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { @@ -54,7 +54,7 @@ public ResponseEntity> get(@Valid * @param date 조회할 일자 * @param principal 사용자 정보 * @return 혈당 가이드 응답 dto - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping 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 74be6e3f..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 @@ -37,9 +37,9 @@ public class GuideController { * @param date 조회날짜 * @author EVE * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> getDayGuide(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { @@ -52,7 +52,7 @@ public ResponseEntity> getDayGuide(@Vali * * @param date 조회날짜 * @author EVE - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping 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 db209df3..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 @@ -39,9 +39,9 @@ public class ExerciseGuideController { * @param principal 유저 정보 * @return 운동 가이드 응답 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { @@ -56,7 +56,7 @@ public ResponseEntity> get(@ValidLo * @param date 조회하는 날짜 * @param principal 유저 정보 * @return 운동 가이드 응답 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping 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 c87b0332..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 @@ -39,9 +39,9 @@ public class WeightGuideController { * @param principal 유저 정보 * @author EVE * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@ValidLocalDate @RequestParam String date, @AuthenticationPrincipal User principal) { @@ -55,7 +55,7 @@ public ResponseEntity> get(@ValidLoca * @param date 조회하는 날짜 * @param principal 유저 정보 * @author EVE - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping 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 27533d79..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 @@ -37,9 +37,9 @@ public class HealthConnectController { * @param requests 건강 지표 request post dto n개 * @param principal 유저 정보 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> postHealthConnect(@Valid @RequestBody HealthConnectPostRequest requests, @AuthenticationPrincipal User principal) { @@ -53,7 +53,7 @@ public ResponseEntity> postHealthConnect(@Valid @Reques * * @param requests 건강 지표 request post dto n개 * @param principal 유저 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping @@ -71,9 +71,9 @@ public ResponseEntity> postHealthConnectV1(@Valid @Requ * @param requests health connect 연동 여부 데이터 * @param principal 유저 정보 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PatchMapping("/interlock") public ResponseEntity> interlockHealthConnect(@Valid @RequestBody HealthConnectRegisterRequest requests, @AuthenticationPrincipal User principal) { @@ -87,7 +87,7 @@ public ResponseEntity> interlockHealthConnect(@Valid @R * * @param requests health connect 연동 여부 데이터 * @param principal 유저 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PatchMapping("/interlock") 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 4a09954d..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 @@ -52,9 +52,9 @@ public class HealthMetricController { * HTTP POST METHOD * * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> post(@Valid @RequestBody HealthMetricPostRequest postRequest, @AuthenticationPrincipal User principal) { @@ -65,7 +65,7 @@ public ResponseEntity> post(@Valid @ /** * HTTP POST METHOD // TODO 작성 * - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping @@ -80,9 +80,9 @@ public ResponseEntity> postHealthMet * HTTP PATCH METHOD * * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PatchMapping public ResponseEntity> patch(@Valid @RequestBody HealthMetricPatchRequest patchRequest, @AuthenticationPrincipal User principal) { @@ -96,7 +96,7 @@ public ResponseEntity> patch(@Valid /* * HTTP PATCH METHOD // TODO 작성 * - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PatchMapping @@ -118,9 +118,9 @@ public ResponseEntity> patchHealthMe * @param principal 유저 정보 * @return 건강지표 차트 데이터 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> getHealthMetrics(@ValidLocalDate @RequestParam String startDate, @ValidLocalDate @RequestParam String endDate, @AuthenticationPrincipal User principal) { @@ -136,7 +136,7 @@ public ResponseEntity> getHealt * @param endDate 조회 종료 날짜 * @param principal 유저 정보 * @return 건강지표 차트 데이터 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping @@ -154,9 +154,9 @@ public ResponseEntity> getHealt * @param principal 유저 정보 * @return 유저의 마지막 건강지표 생성일 * @since 1.1.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping("/last-date") public ResponseEntity> getHealthMetricLastDate(@AuthenticationPrincipal User principal) { String oauthId = principal.getUsername(); @@ -169,7 +169,7 @@ public ResponseEntity> getHe * * @param principal 유저 정보 * @return 유저의 마지막 건강지표 생성일 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping("/last-date") @@ -188,9 +188,9 @@ public ResponseEntity> getLa * @param principal 유저 정보 * @return 성공 메시지 * @since 1.3.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @DeleteMapping public ResponseEntity> deleteHealthMetric(@ValidLocalDate @RequestParam String date, @NotBlank @RequestParam String type, @AuthenticationPrincipal User principal) { @@ -205,7 +205,7 @@ public ResponseEntity> deleteHealthMetric(@ValidLocalDa * @param type 건강지표 타입 * @param principal 유저 정보 * @return 성공 메시지 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @DeleteMapping 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 a87d16a1..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 @@ -31,9 +31,9 @@ public class AppLogController { * 앱 로그를 post 요청한다. * * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> post(@Valid @RequestBody LogRequest request) { logService.sendLog(request); @@ -44,7 +44,7 @@ public ResponseEntity> post(@Valid @RequestBody LogRequ * 앱 로그를 post 요청한다. * * @param request 로그 요청 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping 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 d343f1cb..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 @@ -37,9 +37,9 @@ public class NotificationController { * @param user 사용자 * @return notificationList 확인 안된 알림 목록 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> get(@AuthenticationPrincipal User user) { NotificationListResponse response = new NotificationListResponse(notificationService.getNotificationList(user.getUsername())); @@ -51,7 +51,7 @@ public ResponseEntity> get(@Auth * * @param user 사용자 정보 * @return notificationList 확인하지 않은 알림 목록 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping @@ -69,9 +69,9 @@ public ResponseEntity> getUnread * * @param notificationIdList 알림Id 목록 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PatchMapping public ResponseEntity> patch(@Valid @RequestBody CheckNotificationIdRequest notificationIdList) { notificationService.updateNotificationIsRead(notificationIdList); @@ -84,7 +84,7 @@ public ResponseEntity> patch(@Valid @RequestBody CheckN * 클라이언트에서 사용자가 확인한 알림 id 목록을 서버로 전달하고 서버에서 알림 확인 여부를 변경한다. * * @param notificationIds 푸쉬 알림 id 목록 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PatchMapping 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 29ccf6c8..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 @@ -40,9 +40,9 @@ public class PointController { * @param request 포인트 구매하고자 하는 내역 정보 * @return response 사용자 구매 완료 내역 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> purchaseProduct(@Valid @RequestBody UsePointRequest request, @AuthenticationPrincipal User user) { @@ -56,7 +56,7 @@ public ResponseEntity> purchaseProduct(@ * @param request 포인트 구매하고자 하는 내역 정보 * @param user 사용자 정보 * @return response 사용자 구매 완료 내역 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping @@ -72,9 +72,9 @@ public ResponseEntity> purchaseProductV1 * * @return response 사용자 포인트 잔액, 구매 가능한 상품 내역 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping public ResponseEntity> getProductList(@AuthenticationPrincipal User user) { ProductListResponse response = pointService.getProducts(user.getUsername()); @@ -86,7 +86,7 @@ public ResponseEntity> getProductList * * @param user 사용자 정보 * @return response 사용자 포인트 잔액, 구매 가능한 상품 내역 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping 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 37b7651a..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 @@ -33,9 +33,9 @@ public class SignupController { * @param params 회원가입에 필요한 정보를 담아온다. * @return 회원가입 후 로그인을 시도 , ResponseEntity 로그인을 성공하면, JWT TOKEN과 사용자 정보(nickname, authID)를 전달한다. * @since 1.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity> signUp(@Valid @RequestBody SignUpRequest params) { LoginResponse loginResponse = userSignupService.signUp(params); @@ -50,7 +50,7 @@ public ResponseEntity> signUp(@Valid @Reque * * @param params 회원가입에 필요한 정보 * @return jwt token, 로그인 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping 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 21c5c0e9..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 @@ -47,9 +47,9 @@ public class UserController { * @param nickname 확인이 필요한 닉네임을 담아온다. * @return 닉네임이 중복되지 않았으면 true, 중복된 닉네임이면 false를 담은 DuplicateNicknameResponse 객체를 반환한다. * @since 1.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.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) { @@ -62,7 +62,7 @@ public ResponseEntity> checkDup * * @param nickname 확인이 필요한 닉네임 * @return 닉네임이 중복되지 않았으면 true, 중복된 닉네임이면 false를 담은 DuplicateNicknameResponse 객체를 반환한다. - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping("/duplicateNickname") // TODO 위치: signup, 이름: duplicated-nickname, 바디없어도됨 @@ -78,9 +78,9 @@ public ResponseEntity> verifyDu * * @return MypageResponse 사용자 닉네임과 포인트 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping("/mypage") public ResponseEntity> getMyPage(@AuthenticationPrincipal User user) { MypageResponse response = mypageService.getMypage(user.getUsername()); @@ -92,7 +92,7 @@ public ResponseEntity> getMyPage(@Authenti * * @param user 사용자 정보 * @return 닉네임, 보유 포인트 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping("/mypage") @@ -108,9 +108,9 @@ public ResponseEntity> getMyPageV1(@Authen * @param user 사용자 정보 * @return ResponseEntity * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @DeleteMapping("/withdrawal") public ResponseEntity withdraw(@AuthenticationPrincipal User user) { userWithdrawalService.withdraw(user.getUsername()); @@ -122,7 +122,7 @@ public ResponseEntity withdraw(@AuthenticationPrincipal User user) { * * @param user 사용자 정보 * @return ResponseEntity - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @DeleteMapping("/withdrawal") @@ -138,9 +138,9 @@ public ResponseEntity withdrawV1(@AuthenticationPrincipal User user) { * @param request fcmToken * @return MyPageResponse 사용자 닉네임과 포인트 * @since 1.0.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping("/fcmToken") public ResponseEntity> postFcmToken(@AuthenticationPrincipal User user, @Valid @RequestBody PostFcmTokenRequest request) { notificationService.saveOrUpdateFcmToken(request, user.getUsername()); @@ -152,7 +152,7 @@ public ResponseEntity> postFcmToken(@AuthenticationPrin * * @param user 사용자 정보 * @param request fcm token 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping("/fcmToken") 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 560b42f7..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 @@ -33,9 +33,9 @@ public class VersionController { * 버전 정보를 GET 요청한다. * * @since 1.3.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @GetMapping("/intro") public ResponseEntity>> getIntro() { VersionResponse versionResponse = versionService.getVersionResponse(); @@ -46,7 +46,7 @@ public ResponseEntity>> getIntro() { * 버전 정보를 조회한다. * * @return 버전 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @GetMapping("/intro") @@ -59,9 +59,9 @@ public ResponseEntity>> getIntroV1() { * 버전 정보를 POST 요청한다. * * @since 1.3.0 - * @deprecated 1.4.0 + * @deprecated 1.6.0 */ - @Deprecated(since = "1.4.0") + @Deprecated(since = "1.6.0") @PostMapping public ResponseEntity>> postVersion(@Valid @RequestBody VersionRequest request) { VersionResponse versionResponse = versionService.saveVersion(request); @@ -73,7 +73,7 @@ public ResponseEntity>> postVersion(@Va * * @param request 버전 정보 * @return 등록된 버전 정보 - * @since 1.4.0 + * @since 1.6.0 */ @ApiVersion("1") @PostMapping From d10358f86e4e7e84447577ca502ea56062855383 Mon Sep 17 00:00:00 2001 From: NAM GIBEOM Date: Sun, 12 Nov 2023 21:08:20 +0900 Subject: [PATCH 14/17] =?UTF-8?q?chore:=20Jacoco=EC=97=90=EC=84=9C=20lombo?= =?UTF-8?q?k=20=EC=BB=A4=EB=B2=84=EB=A6=AC=EC=A7=80=20=EC=A0=9C=EC=99=B8?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lombok.config | 1 + 1 file changed, 1 insertion(+) 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 From e95026ad95bde8cba53cfcb176486a1339ff9acc Mon Sep 17 00:00:00 2001 From: 13wjdgk <13wjdgk@naver.com> Date: Tue, 14 Nov 2023 19:55:04 +0900 Subject: [PATCH 15/17] =?UTF-8?q?refactor=20:=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/service/NotificationService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..866c5383 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 @@ -147,8 +147,8 @@ public List makeAccessFcmMessage() { List fcmTokens = userFcmTokens.stream() .map(userFcmToken -> userFcmToken.getFcmToken()) .collect(Collectors.toList()); - String title = "오늘의 접속"; - String content = "오늘 접속하지 않았어요! 접속하고 포인트를 받아가세요!"; + String title = "오늘의 건강 상태는?"; + String content = "꾸준히 기록하고, 현재 건강 상태를 확인해 봐요!"; NotificationType notificationType = notificationSearchService.findNotificationType("접속"); List notifications = userFcmTokens.stream() From 9454f04a89f878eb8e4e49714317820205fdfef1 Mon Sep 17 00:00:00 2001 From: 13wjdgk <13wjdgk@naver.com> Date: Tue, 14 Nov 2023 20:06:18 +0900 Subject: [PATCH 16/17] =?UTF-8?q?refactor=20:=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=A9=94=EC=84=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/service/NotificationService.java | 2 +- .../domain/notification/service/NotificationServiceTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 866c5383..93dbd6c2 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 @@ -148,7 +148,7 @@ public List makeAccessFcmMessage() { .map(userFcmToken -> userFcmToken.getFcmToken()) .collect(Collectors.toList()); String title = "오늘의 건강 상태는?"; - String content = "꾸준히 기록하고, 현재 건강 상태를 확인해 봐요!"; + String content = "꾸준히 기록하고, 건강 상태를 비교해 봐요!"; NotificationType notificationType = notificationSearchService.findNotificationType("접속"); List notifications = userFcmTokens.stream() 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..fb1a83ac 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 @@ -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); } From b3ee4477b9548ae79e87172c09e3d5ca74d6889d Mon Sep 17 00:00:00 2001 From: 13wjdgk <13wjdgk@naver.com> Date: Tue, 14 Nov 2023 20:26:37 +0900 Subject: [PATCH 17/17] =?UTF-8?q?docs=20:=20=EC=95=8C=EB=A6=BC=20todo=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/service/NotificationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 93dbd6c2..1a44fb4d 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 @@ -147,7 +147,7 @@ public List makeAccessFcmMessage() { List fcmTokens = userFcmTokens.stream() .map(userFcmToken -> userFcmToken.getFcmToken()) .collect(Collectors.toList()); - String title = "오늘의 건강 상태는?"; + String title = "오늘의 건강 상태는?"; //TODO : title, content Enum으로 관리 String content = "꾸준히 기록하고, 건강 상태를 비교해 봐요!"; NotificationType notificationType = notificationSearchService.findNotificationType("접속");