diff --git a/smeem-api/src/main/java/com/smeem/api/auth/controller/AuthController.java b/smeem-api/src/main/java/com/smeem/api/auth/controller/AuthController.java index ec5ed8e3..9af1b785 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/controller/AuthController.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/controller/AuthController.java @@ -10,6 +10,7 @@ import com.smeem.api.common.BaseResponse; import com.smeem.common.util.Util; import lombok.RequiredArgsConstructor; +import lombok.val; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -31,13 +32,13 @@ public class AuthController { @PostMapping public ResponseEntity> signIn(@RequestHeader("Authorization") String socialAccessToken, @RequestBody SignInRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException { - SignInResponse response = SignInResponse.of(authService.signIn(socialAccessToken, SignInServiceRequest.of(request))); + val response = SignInResponse.of(authService.signIn(socialAccessToken, SignInServiceRequest.of(request))); return ApiResponseUtil.success(SUCCESS_SIGNIN, response); } @PostMapping("/token") public ResponseEntity> reissueToken(Principal principal) { - TokenResponse response = TokenResponse.of(tokenService.issueToken(Util.getMemberId(principal))); + val response = TokenResponse.of(tokenService.issueToken(Util.getMemberId(principal))); return ApiResponseUtil.success(SUCCESS_ISSUE_TOKEN, response); } diff --git a/smeem-api/src/main/java/com/smeem/api/auth/controller/dto/response/SignInResponse.java b/smeem-api/src/main/java/com/smeem/api/auth/controller/dto/response/SignInResponse.java index ae1ee3a0..a0428e38 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/controller/dto/response/SignInResponse.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/controller/dto/response/SignInResponse.java @@ -1,12 +1,13 @@ package com.smeem.api.auth.controller.dto.response; -import com.smeem.api.auth.jwt.SmeemToken; import com.smeem.api.auth.service.dto.response.SignInServiceResponse; import lombok.Builder; +import static lombok.AccessLevel.PRIVATE; -@Builder + +@Builder(access = PRIVATE) public record SignInResponse( String accessToken, String refreshToken, @@ -15,11 +16,11 @@ public record SignInResponse( ) { public static SignInResponse of(SignInServiceResponse response) { - return new SignInResponse( - response.accessToken(), - response.refreshToken(), - response.isRegistered(), - response.hasPlan()); + return SignInResponse.builder() + .accessToken(response.accessToken()) + .refreshToken(response.refreshToken()) + .isRegistered(response.isRegistered()) + .hasPlan(response.hasPlan()) + .build(); } - } diff --git a/smeem-api/src/main/java/com/smeem/api/auth/jwt/TokenProvider.java b/smeem-api/src/main/java/com/smeem/api/auth/jwt/TokenProvider.java index 0bc11b43..5ce393a8 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/jwt/TokenProvider.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/jwt/TokenProvider.java @@ -1,22 +1,16 @@ package com.smeem.api.auth.jwt; -import com.smeem.common.config.ValueConfig; -import com.smeem.common.exception.AuthException; -import io.jsonwebtoken.*; -import io.jsonwebtoken.security.Keys; +import io.jsonwebtoken.Header; +import io.jsonwebtoken.Jwts; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import lombok.val; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Component; -import javax.crypto.SecretKey; import java.util.Date; -import static com.smeem.api.auth.jwt.JwtValidationType.*; -import static java.util.Base64.getEncoder; - @Slf4j @Component @RequiredArgsConstructor diff --git a/smeem-api/src/main/java/com/smeem/api/auth/service/dto/response/TokenServiceResponse.java b/smeem-api/src/main/java/com/smeem/api/auth/service/dto/response/TokenServiceResponse.java index fc94a920..faf8d095 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/service/dto/response/TokenServiceResponse.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/service/dto/response/TokenServiceResponse.java @@ -13,9 +13,9 @@ public record TokenServiceResponse( ) { public static TokenServiceResponse of(SmeemToken token) { - return new TokenServiceResponse( - token.getAccessToken(), - token.getRefreshToken() - ); + return TokenServiceResponse.builder() + .accessToken(token.getAccessToken()) + .refreshToken(token.getRefreshToken()) + .build(); } } diff --git a/smeem-api/src/main/java/com/smeem/api/badge/controller/BadgeController.java b/smeem-api/src/main/java/com/smeem/api/badge/controller/BadgeController.java index 84ec42fb..44d1c872 100644 --- a/smeem-api/src/main/java/com/smeem/api/badge/controller/BadgeController.java +++ b/smeem-api/src/main/java/com/smeem/api/badge/controller/BadgeController.java @@ -1,11 +1,11 @@ package com.smeem.api.badge.controller; -import com.smeem.api.badge.controller.dto.response.BadgeListResponse; import com.smeem.api.badge.service.BadgeService; import com.smeem.api.common.ApiResponseUtil; import com.smeem.api.common.BaseResponse; import com.smeem.common.util.Util; import lombok.RequiredArgsConstructor; +import lombok.val; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -24,7 +24,7 @@ public class BadgeController { @GetMapping public ResponseEntity> getBadges(Principal principal) { - BadgeListResponse response = badgeService.getBadges(Util.getMemberId(principal)); + val response = badgeService.getBadges(Util.getMemberId(principal)); return ApiResponseUtil.success(SUCCESS_GET_BADGES, response); } diff --git a/smeem-api/src/main/java/com/smeem/api/badge/controller/dto/response/BadgeResponse.java b/smeem-api/src/main/java/com/smeem/api/badge/controller/dto/response/BadgeResponse.java index 4093850d..1dd81452 100644 --- a/smeem-api/src/main/java/com/smeem/api/badge/controller/dto/response/BadgeResponse.java +++ b/smeem-api/src/main/java/com/smeem/api/badge/controller/dto/response/BadgeResponse.java @@ -1,7 +1,6 @@ package com.smeem.api.badge.controller.dto.response; import com.smeem.api.badge.service.dto.response.BadgeServiceResponse; -import com.smeem.domain.badge.model.Badge; import lombok.AccessLevel; import lombok.Builder; diff --git a/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/MemberNameResponse.java b/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/MemberNameResponse.java index 4bc959f5..c6439983 100644 --- a/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/MemberNameResponse.java +++ b/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/MemberNameResponse.java @@ -1,13 +1,20 @@ package com.smeem.api.member.controller.dto.response; import com.smeem.api.member.service.dto.response.MemberNameServiceResponse; +import lombok.AccessLevel; +import lombok.Builder; +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) public record MemberNameResponse( boolean isExist ) { public static MemberNameResponse of(MemberNameServiceResponse response) { - return new MemberNameResponse(response.isExist()); + return MemberNameResponse.builder() + .isExist(response.isExist()) + .build(); } } diff --git a/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/TrainingTimeResponse.java b/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/TrainingTimeResponse.java index f95a13f2..93c4b2ff 100644 --- a/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/TrainingTimeResponse.java +++ b/smeem-api/src/main/java/com/smeem/api/member/controller/dto/response/TrainingTimeResponse.java @@ -1,12 +1,21 @@ package com.smeem.api.member.controller.dto.response; import com.smeem.api.member.service.dto.response.TrainingTimeServiceResponse; +import lombok.Builder; -public record TrainingTimeResponse(String day, int hour, int minute) { +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) +public record TrainingTimeResponse( + String day, + int hour, + int minute +) { public static TrainingTimeResponse of(TrainingTimeServiceResponse response) { - return new TrainingTimeResponse( - response.day(), - response.hour(), - response.minute()); + return TrainingTimeResponse.builder() + .day(response.day()) + .hour(response.hour()) + .minute(response.minute()) + .build(); } }