-
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.
Showing
20 changed files
with
232 additions
and
47 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
11 changes: 11 additions & 0 deletions
11
src/main/java/sopt/makers/authentication/application/auth/api/SocialAccountApi.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,11 @@ | ||
package sopt.makers.authentication.application.auth.api; | ||
|
||
import sopt.makers.authentication.application.auth.dto.request.SocialAccountRequest; | ||
import sopt.makers.authentication.support.common.api.BaseResponse; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
|
||
public interface SocialAccountApi { | ||
ResponseEntity<BaseResponse<?>> updateSocialAccount( | ||
SocialAccountRequest.UpdateSocialAccount socialAccountInfo); | ||
} |
29 changes: 29 additions & 0 deletions
29
...main/java/sopt/makers/authentication/application/auth/api/SocialAccountApiController.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,29 @@ | ||
package sopt.makers.authentication.application.auth.api; | ||
|
||
import sopt.makers.authentication.application.auth.dto.request.SocialAccountRequest; | ||
import sopt.makers.authentication.support.code.domain.success.SocialAccountSuccess; | ||
import sopt.makers.authentication.support.common.api.BaseResponse; | ||
import sopt.makers.authentication.support.util.ResponseUtil; | ||
import sopt.makers.authentication.usecase.auth.port.in.UpdateSocialAccountUsecase; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/social/accounts") | ||
@RequiredArgsConstructor | ||
public class SocialAccountApiController implements SocialAccountApi { | ||
private final UpdateSocialAccountUsecase updateSocialAccountUsecase; | ||
|
||
@Override | ||
@PatchMapping | ||
public ResponseEntity<BaseResponse<?>> updateSocialAccount( | ||
SocialAccountRequest.UpdateSocialAccount socialAccountInfo) { | ||
updateSocialAccountUsecase.update(socialAccountInfo.toCommand()); | ||
return ResponseUtil.success(SocialAccountSuccess.UPDATE_SOCIAL_ACCOUNT); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
...in/java/sopt/makers/authentication/application/auth/dto/request/SocialAccountRequest.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,16 @@ | ||
package sopt.makers.authentication.application.auth.dto.request; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
import sopt.makers.authentication.usecase.auth.port.in.UpdateSocialAccountUsecase.UpdateSocialAccountCommand; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor(access = PRIVATE) | ||
public final class SocialAccountRequest { | ||
public record UpdateSocialAccount(String phone, String code, String authPlatform) { | ||
public UpdateSocialAccountCommand toCommand() { | ||
return UpdateSocialAccountCommand.of(phone, authPlatform, code); | ||
} | ||
} | ||
} |
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: 19 additions & 0 deletions
19
src/main/java/sopt/makers/authentication/database/rdb/repository/UserRegister.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,19 @@ | ||
package sopt.makers.authentication.database.rdb.repository; | ||
|
||
import sopt.makers.authentication.database.rdb.entity.UserEntity; | ||
|
||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class UserRegister { | ||
private final UserJpaRepository userJpaRepository; | ||
|
||
public UserEntity save(UserEntity userEntity) { | ||
return userJpaRepository.save(userEntity); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
...ain/java/sopt/makers/authentication/support/code/domain/success/SocialAccountSuccess.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 sopt.makers.authentication.support.code.domain.success; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
import sopt.makers.authentication.support.code.base.*; | ||
|
||
import org.springframework.http.*; | ||
|
||
import lombok.*; | ||
|
||
@Getter | ||
@RequiredArgsConstructor(access = PRIVATE) | ||
public enum SocialAccountSuccess implements SuccessCode { | ||
UPDATE_SOCIAL_ACCOUNT(HttpStatus.OK, "소셜 계정 변경에 성공했습니다."); | ||
|
||
private final HttpStatus status; | ||
private final String message; | ||
} |
20 changes: 11 additions & 9 deletions
20
src/main/java/sopt/makers/authentication/support/util/KeyFileUtil.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
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
11 changes: 11 additions & 0 deletions
11
...main/java/sopt/makers/authentication/usecase/auth/port/in/UpdateSocialAccountUsecase.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,11 @@ | ||
package sopt.makers.authentication.usecase.auth.port.in; | ||
|
||
public interface UpdateSocialAccountUsecase { | ||
boolean update(UpdateSocialAccountCommand command); | ||
|
||
record UpdateSocialAccountCommand(String phone, String authPlatform, String code) { | ||
public static UpdateSocialAccountCommand of(String phone, String authPlatform, String code) { | ||
return new UpdateSocialAccountCommand(phone, authPlatform, code); | ||
} | ||
} | ||
} |
Oops, something went wrong.