-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
프로젝트 구조 1차 리팩토링 테스트 코드는 함께 수정하지 못했다 https 테스트는 진행 issue key : #78
- Loading branch information
Showing
83 changed files
with
1,561 additions
and
1,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...eBoard02/b-server-user/src/main/java/kim/zhyun/serveruser/common/advice/ApiException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package kim.zhyun.serveruser.common.advice; | ||
|
||
public class ApiException extends RuntimeException { | ||
|
||
public ApiException(String exceptionMessage) { | ||
super(exceptionMessage); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../serveruser/advice/MailAuthException.java → ...user/common/advice/MailAuthException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...un/serveruser/advice/MemberException.java → ...eruser/common/advice/MemberException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...un/serveruser/advice/SignUpException.java → ...eruser/common/advice/SignUpException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
simpleBoard02/b-server-user/src/main/java/kim/zhyun/serveruser/common/annotation/Email.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package kim.zhyun.serveruser.common.annotation; | ||
|
||
import jakarta.validation.Constraint; | ||
import jakarta.validation.Payload; | ||
import kim.zhyun.serveruser.common.annotation.constraint.EmailValidator; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static kim.zhyun.serveruser.common.message.ExceptionMessage.EXCEPTION_VALID_EMAIL_CODE; | ||
import static kim.zhyun.serveruser.common.message.ExceptionMessage.EXCEPTION_VALID_EMAIL_FORMAT; | ||
|
||
@Target({ElementType.PARAMETER, ElementType.FIELD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Constraint(validatedBy = EmailValidator.class) | ||
public @interface Email { | ||
|
||
String message() default EXCEPTION_VALID_EMAIL_FORMAT; | ||
Class<?>[] groups() default {}; | ||
Class<? extends Payload>[] payload() default {}; | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...eBoard02/b-server-user/src/main/java/kim/zhyun/serveruser/common/annotation/Nickname.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package kim.zhyun.serveruser.common.annotation; | ||
|
||
import jakarta.validation.Constraint; | ||
import jakarta.validation.Payload; | ||
import kim.zhyun.serveruser.common.annotation.constraint.NicknameValidator; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static kim.zhyun.serveruser.common.message.ExceptionMessage.EXCEPTION_VALID_EMAIL_CODE; | ||
import static kim.zhyun.serveruser.common.message.ExceptionMessage.EXCEPTION_VALID_NICKNAME_FORMAT; | ||
|
||
@Target({ElementType.PARAMETER, ElementType.FIELD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Constraint(validatedBy = NicknameValidator.class) | ||
public @interface Nickname { | ||
|
||
String message() default EXCEPTION_VALID_NICKNAME_FORMAT; | ||
Class<?>[] groups() default {}; | ||
Class<? extends Payload>[] payload() default {}; | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...oard02/b-server-user/src/main/java/kim/zhyun/serveruser/common/annotation/VerifyCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package kim.zhyun.serveruser.common.annotation; | ||
|
||
import jakarta.validation.Constraint; | ||
import jakarta.validation.Payload; | ||
import kim.zhyun.serveruser.common.annotation.constraint.VerifyCodeValidator; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static kim.zhyun.serveruser.common.message.ExceptionMessage.EXCEPTION_VALID_EMAIL_CODE; | ||
|
||
@Target({ElementType.PARAMETER, ElementType.FIELD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Constraint(validatedBy = VerifyCodeValidator.class) | ||
public @interface VerifyCode { | ||
|
||
String message() default EXCEPTION_VALID_EMAIL_CODE; | ||
Class<?>[] groups() default {}; | ||
Class<? extends Payload>[] payload() default {}; | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...-user/src/main/java/kim/zhyun/serveruser/common/annotation/constraint/EmailValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package kim.zhyun.serveruser.common.annotation.constraint; | ||
|
||
import jakarta.validation.ConstraintValidator; | ||
import jakarta.validation.ConstraintValidatorContext; | ||
import kim.zhyun.serveruser.common.advice.ApiException; | ||
import kim.zhyun.serveruser.common.annotation.Email; | ||
import org.apache.logging.log4j.util.Strings; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class EmailValidator implements ConstraintValidator<Email, String> { | ||
|
||
@Override | ||
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { | ||
|
||
if (value != null) { | ||
String regex = "^[_a-z0-9-]+(.[_a-z0-9-]+)*@(?:\\w+\\.)+\\w+$"; | ||
Matcher patternMatcher = Pattern.compile(regex).matcher(value); | ||
|
||
return patternMatcher.matches(); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...er/src/main/java/kim/zhyun/serveruser/common/annotation/constraint/NicknameValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package kim.zhyun.serveruser.common.annotation.constraint; | ||
|
||
import jakarta.validation.ConstraintValidator; | ||
import jakarta.validation.ConstraintValidatorContext; | ||
import kim.zhyun.serveruser.common.advice.ApiException; | ||
import kim.zhyun.serveruser.common.annotation.Nickname; | ||
import org.apache.logging.log4j.util.Strings; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.util.StringUtils; | ||
|
||
public class NicknameValidator implements ConstraintValidator<Nickname, String> { | ||
|
||
@Override | ||
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { | ||
|
||
if (value != null) { | ||
int length = value.length(); | ||
|
||
return length >= 1 && length <= 6; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
.../src/main/java/kim/zhyun/serveruser/common/annotation/constraint/VerifyCodeValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kim.zhyun.serveruser.common.annotation.constraint; | ||
|
||
import jakarta.validation.ConstraintValidator; | ||
import jakarta.validation.ConstraintValidatorContext; | ||
import kim.zhyun.serveruser.common.advice.ApiException; | ||
import kim.zhyun.serveruser.common.annotation.VerifyCode; | ||
import org.apache.logging.log4j.util.Strings; | ||
import org.springframework.stereotype.Component; | ||
|
||
public class VerifyCodeValidator implements ConstraintValidator<VerifyCode, String> { | ||
|
||
@Override | ||
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { | ||
|
||
return Strings.isNotBlank(value); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...eruser/data/message/ExceptionMessage.java → ...user/common/message/ExceptionMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kim.zhyun.serveruser.data.message; | ||
package kim.zhyun.serveruser.common.message; | ||
|
||
import lombok.Getter; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...veruser/data/message/ResponseMessage.java → ...ruser/common/message/ResponseMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kim.zhyun.serveruser.data.message; | ||
package kim.zhyun.serveruser.common.message; | ||
|
||
import lombok.Getter; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...serveruser/data/response/ApiResponse.java → .../serveruser/common/model/ApiResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...data/response/ValidExceptionResponse.java → .../common/model/ValidExceptionResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...eBoard02/b-server-user/src/main/java/kim/zhyun/serveruser/common/model/type/RoleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package kim.zhyun.serveruser.common.model.type; | ||
|
||
public class RoleType { | ||
public static final String TYPE_ADMIN = "ADMIN"; | ||
public static final String TYPE_MEMBER = "MEMBER"; | ||
public static final String TYPE_WITHDRAWAL = "WITHDRAWAL"; | ||
} |
18 changes: 18 additions & 0 deletions
18
...leBoard02/b-server-user/src/main/java/kim/zhyun/serveruser/config/ObjectMapperConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kim.zhyun.serveruser.config; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class ObjectMapperConfig { | ||
|
||
@Bean | ||
public ObjectMapper objectMapper() { | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
return objectMapper; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.