Skip to content

Commit

Permalink
fix: ๐Ÿ› Sms type ๋ณ€ํ™˜ ์‹œ, ํœด๋จผ ์—๋Ÿฌ ์ œ๊ฑฐ ๋ฐ ์˜ˆ๋ฐฉ (#138)
Browse files Browse the repository at this point in the history
* fix: verification type ํœด๋จผ ์—๋Ÿฌ ๋ฐœ์ƒ ์œ„ํ—˜ ์ œ๊ฑฐ

* docs: sms api ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ type์— phone ์ถ”๊ฐ€
  • Loading branch information
psychology50 committed Jul 25, 2024
1 parent 381f3ea commit 3d0b5d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface SmsApi {
@Operation(summary = "์ „ํ™”๋ฒˆํ˜ธ๋กœ ์ธ์ฆ์ฝ”๋“œ ์ „์†ก", description = "์ „ํ™”๋ฒˆํ˜ธ๋กœ ์ธ์ฆ๋ฒˆํ˜ธ๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ๋ฏธ์ธ์ฆ ์‚ฌ์šฉ์ž๋งŒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.")
@Parameters({
@Parameter(name = "type", description = "์ธ์ฆ ํƒ€์ž…", required = true, examples = {
@ExampleObject(name = "์ผ๋ฐ˜ ํšŒ์›๊ฐ€์ž…", value = "general"), @ExampleObject(name = "์†Œ์…œ ํšŒ์›๊ฐ€์ž…", value = "oauth"), @ExampleObject(name = "์•„์ด๋”” ์ฐพ๊ธฐ", value = "username"), @ExampleObject(name = "๋น„๋ฐ€๋ฒˆํ˜ธ ์ฐพ๊ธฐ", value = "password")
@ExampleObject(name = "์ผ๋ฐ˜ ํšŒ์›๊ฐ€์ž…", value = "general"), @ExampleObject(name = "์†Œ์…œ ํšŒ์›๊ฐ€์ž…", value = "oauth"), @ExampleObject(name = "์•„์ด๋”” ์ฐพ๊ธฐ", value = "username"), @ExampleObject(name = "๋น„๋ฐ€๋ฒˆํ˜ธ ์ฐพ๊ธฐ", value = "password"), @ExampleObject(name = "ํœด๋Œ€ํฐ ๋ฒˆํ˜ธ ๋ณ€๊ฒฝ", value = "phone")
}, in = ParameterIn.QUERY),
@Parameter(name = "provider", description = "์†Œ์…œ ๋กœ๊ทธ์ธ ์ œ๊ณต์ž. type์ด oauth์ธ ๊ฒฝ์šฐ ๋ฐ˜๋“œ์‹œ ํฌํ•จ๋˜์–ด์•ผ ํ•œ๋‹ค.", required = false, examples = {
@ExampleObject(name = "์นด์นด์˜ค", value = "kakao"), @ExampleObject(name = "์• ํ”Œ", value = "apple"), @ExampleObject(name = "๊ตฌ๊ธ€", value = "google")
Expand Down
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;
}
}

0 comments on commit 3d0b5d1

Please sign in to comment.