Skip to content

Commit

Permalink
Merge branch 'refactor-v1' into feature/#78/chatbot-refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 committed Nov 27, 2024
2 parents 7a63099 + 311213c commit 4f60468
Show file tree
Hide file tree
Showing 54 changed files with 470 additions and 347 deletions.
Binary file modified dump.rdb
Binary file not shown.
38 changes: 0 additions & 38 deletions src/main/java/kusitms/backend/auth/application/AuthService.java

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/kusitms/backend/global/code/BaseCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
public interface BaseCode {
ReasonDto getReason();
ReasonDto getReasonHttpStatus();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
public interface BaseErrorCode {
ErrorReasonDto getReason();
ErrorReasonDto getReasonHttpStatus();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public class QueryDslConfig {
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(entityManager);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/kusitms/backend/global/config/S3Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ public void configureS3Cors(AmazonS3 s3) {

s3.setBucketCrossOriginConfiguration(bucketName, configuration);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public OpenAPI customOpenAPI() {

return openAPI;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public class BaseTimeEntity {

@LastModifiedDate
private LocalDateTime updatedDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public class ErrorReasonDto {
private final boolean isSuccess;
private final String code;
private final String message;
}
}
2 changes: 1 addition & 1 deletion src/main/java/kusitms/backend/global/dto/ReasonDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public class ReasonDto {
private final boolean isSuccess;
private final String code;
private final String message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public String getCode() {
public HttpStatus getHttpStatus() {
return errorCode.getReasonHttpStatus().getHttpStatus();
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/kusitms/backend/global/redis/RedisManager.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package kusitms.backend.global.redis;

import kusitms.backend.auth.jwt.JWTUtil;
import kusitms.backend.auth.status.AuthErrorStatus;
import kusitms.backend.global.exception.CustomException;
import kusitms.backend.global.status.ErrorStatus;
import kusitms.backend.user.infra.jwt.JWTUtil;
import kusitms.backend.user.status.AuthErrorStatus;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/kusitms/backend/global/status/ErrorStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ public enum ErrorStatus implements BaseErrorCode {
_RESOURCE_NOT_FOUND(HttpStatus.NOT_FOUND, "COMMON-003", "요청한 리소스를 찾을 수 없습니다."),

// Cookie Errors
_MISSING_TOKEN_IN_COOKIE(HttpStatus.UNAUTHORIZED, "COOKIE-001", "쿠키에 토큰이 존재하지 않습니다.")
;
_MISSING_TOKEN_IN_COOKIE(HttpStatus.UNAUTHORIZED, "COOKIE-001", "쿠키에 토큰이 존재하지 않습니다."),

// Format Errors
_FAILED_FORMAT_PHONE_NUMBER(HttpStatus.BAD_REQUEST, "FORMAT-001", "잘못된 휴대폰 번호 형식입니다. 010-XXXX-XXXX 형식으로 입력해주세요.");

private final HttpStatus httpStatus;
private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ public ReasonDto getReasonHttpStatus() {
.message(message)
.build();
}
}
}
11 changes: 11 additions & 0 deletions src/main/java/kusitms/backend/global/util/CookieUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public static void setAuthCookies(HttpServletResponse response, String accessTok
(int) (accessTokenExpiry * 1.5) / 1000);
}

/**
* 유저 온보딩을 위한 쿠키를 설정합니다 (Register Token, Expiration Time).
*
* @param response HTTP 응답 객체
* @param registerToken 레지스터 토큰
* @param registerTokenExpiry 레지스터 토큰 만료 시간 (밀리초)
*/
public static void setRegisterCookies(HttpServletResponse response, String registerToken, long registerTokenExpiry) {
setCookie(response, "registerToken", registerToken, (int) registerTokenExpiry / 1000);
}

/**
* HTTP-Only 쿠키를 설정합니다.
*
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/kusitms/backend/global/util/FormatUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package kusitms.backend.global.util;

import kusitms.backend.global.exception.CustomException;
import kusitms.backend.global.status.ErrorStatus;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FormatUtil {

/**
* 전화번호 형식을 010-XXXX-XXXX 형태로 변경한다.
* @param phoneNumber 휴대폰 번호
* @return 변경된 형식의 전화번호
*/
public static String formatPhoneNumber(String phoneNumber) {
String pattern = "^010(\\d{4})(\\d{4})$";
Pattern regex = Pattern.compile(pattern);
Matcher matcher = regex.matcher(phoneNumber.replaceAll("-", "")); // 입력값에서 "-" 제거
if (matcher.matches()) {
return "010-" + matcher.group(1) + "-" + matcher.group(2);
} else {
throw new CustomException(ErrorStatus._FAILED_FORMAT_PHONE_NUMBER);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kusitms.backend.result.application;

import kusitms.backend.auth.jwt.JWTUtil;
import kusitms.backend.user.infra.jwt.JWTUtil;
import kusitms.backend.result.application.dto.request.SaveTopRankedZoneRequestDto;
import kusitms.backend.result.application.dto.response.GetProfileResponseDto;
import kusitms.backend.result.application.dto.response.GetZonesResponseDto;
Expand Down
Loading

0 comments on commit 4f60468

Please sign in to comment.