-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from backendoori/feature-user-validation
🚀 사용자 인증 요청 및 user entity validation 추가
- Loading branch information
Showing
19 changed files
with
555 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.backendoori.ootw.common; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Supplier; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.lang.Nullable; | ||
import org.springframework.util.Assert; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public final class AssertUtil extends Assert { | ||
|
||
public static void notBlank(@Nullable String string, String message) { | ||
if (string == null || string.isBlank()) { | ||
throw new IllegalArgumentException(message); | ||
} | ||
} | ||
|
||
public static void hasPattern(@Nullable String string, @Nullable String pattern, String message) { | ||
notNull(string, message); | ||
|
||
if (!string.matches(Objects.requireNonNull(pattern))) { | ||
throw new IllegalArgumentException(message); | ||
} | ||
} | ||
|
||
public static void throwIf(boolean state, Supplier<RuntimeException> exceptionSupplier) { | ||
if (state) { | ||
throw exceptionSupplier.get(); | ||
} | ||
} | ||
|
||
} |
38 changes: 0 additions & 38 deletions
38
src/main/java/com/backendoori/ootw/exception/ExceptionResponse.java
This file was deleted.
Oops, something went wrong.
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
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
19 changes: 17 additions & 2 deletions
19
src/main/java/com/backendoori/ootw/user/dto/SignupDto.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,10 +1,25 @@ | ||
package com.backendoori.ootw.user.dto; | ||
|
||
import com.backendoori.ootw.user.validation.Message; | ||
import com.backendoori.ootw.user.validation.Password; | ||
import com.backendoori.ootw.user.validation.RFC5322; | ||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record SignupDto( | ||
@NotNull | ||
@NotBlank | ||
@Email(regexp = RFC5322.REGEX) | ||
String email, | ||
|
||
@NotNull | ||
@Password | ||
String password, | ||
String nickname, | ||
String image | ||
|
||
@NotNull | ||
@NotBlank(message = Message.BLANK_NICKNAME) | ||
String nickname | ||
) { | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...exception/AlreadyExistEmailException.java → ...exception/AlreadyExistEmailException.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
...exception/IncorrectPasswordException.java → ...exception/IncorrectPasswordException.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
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.