-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ๐ Sms type ๋ณํ ์, ํด๋จผ ์๋ฌ ์ ๊ฑฐ ๋ฐ ์๋ฐฉ (#138)
* fix: verification type ํด๋จผ ์๋ฌ ๋ฐ์ ์ํ ์ ๊ฑฐ * docs: sms api ์ฟผ๋ฆฌ ํ๋ผ๋ฏธํฐ type์ phone ์ถ๊ฐ
- Loading branch information
1 parent
381f3ea
commit 3d0b5d1
Showing
2 changed files
with
16 additions
and
14 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
28 changes: 15 additions & 13 deletions
28
...yway-app-external-api/src/main/java/kr/co/pennyway/api/common/query/VerificationType.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,27 +1,29 @@ | ||
package kr.co.pennyway.api.common.query; | ||
|
||
import jakarta.annotation.Nonnull; | ||
import kr.co.pennyway.domain.common.redis.phone.PhoneCodeKeyType; | ||
import kr.co.pennyway.domain.domains.oauth.type.Provider; | ||
|
||
public enum VerificationType { | ||
GENERAL("general"), | ||
OAUTH("oauth"), | ||
USERNAME("username"), | ||
PASSWORD("password"), | ||
PHONE("phone"); | ||
GENERAL("general", PhoneCodeKeyType.SIGN_UP), | ||
OAUTH("oauth", null), | ||
USERNAME("username", PhoneCodeKeyType.FIND_USERNAME), | ||
PASSWORD("password", PhoneCodeKeyType.FIND_PASSWORD), | ||
PHONE("phone", PhoneCodeKeyType.PHONE); | ||
|
||
private final String type; | ||
private final PhoneCodeKeyType phoneCodeKeyType; | ||
|
||
VerificationType(String type) { | ||
VerificationType(String type, PhoneCodeKeyType phoneCodeKeyType) { | ||
this.type = type; | ||
this.phoneCodeKeyType = phoneCodeKeyType; | ||
} | ||
|
||
public PhoneCodeKeyType toPhoneVerificationType(Provider provider) { | ||
return switch (this) { | ||
case OAUTH -> PhoneCodeKeyType.getOauthSignUpTypeByProvider(provider); | ||
case USERNAME -> PhoneCodeKeyType.FIND_USERNAME; | ||
case PASSWORD -> PhoneCodeKeyType.FIND_PASSWORD; | ||
default -> PhoneCodeKeyType.SIGN_UP; | ||
}; | ||
public PhoneCodeKeyType toPhoneVerificationType(@Nonnull Provider provider) { | ||
if (this.equals(OAUTH)) { | ||
return PhoneCodeKeyType.getOauthSignUpTypeByProvider(provider); | ||
} | ||
|
||
return phoneCodeKeyType; | ||
} | ||
} |