Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] 최초 회원가입 타이틀 획득 버그 수정 #331

Merged
merged 1 commit into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions keewe-api/http/http-client.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"keewe-api-local": {
"host": "http://localhost:8080"
},
"keewe-api-dev": {
"host": "https://api-keewe.com/"
}
}
2 changes: 2 additions & 0 deletions keewe-api/http/signup.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// note. 로컬 가상 회원가입
GET {{host}}/api/v1/user/virtual?code=test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
import ccc.keewedomain.persistence.domain.user.enums.VendorType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/user")
Expand Down Expand Up @@ -38,6 +44,12 @@ public ApiResponse<?> getToken(@PathVariable Long userId) {
return ApiResponse.ok(userService.getToken(userId));
}

@GetMapping("/virtual")
@LocalOnlyApi
public ApiResponse<?> signUpWithVirtualVendor(@RequestParam String code) {
return ApiResponse.ok(userService.signupWithOauth(code, VendorType.VIRTUAL));
}

@PutMapping("/withdraw")
public ApiResponse<Void> withdraw() {
userService.withdraw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class UserApiService {
private final ProfileCommandDomainService profileCommandDomainService;
private final ChallengeCommandDomainService challengeCommandDomainService;

@Transactional
@FLogging
public <T extends OauthResponse> UserSignUpResponse signupWithOauth(String code, VendorType vendorType) {
T account = userDomainService.getOauthProfile(code, vendorType);
Expand All @@ -56,7 +55,7 @@ public <T extends OauthResponse> UserSignUpResponse signupWithOauth(String code,
, KeeweStringUtils.getOrDefault(account.getEmail(), "")
);

afterTheFirstSignUp(user);
this.afterTheFirstSignUp(user);
log.info("[UAS::signupWithOauth] 회원가입 완료 - email({})", account.getEmail());
return userAssembler.toUserSignUpResponse(user, false, getToken(user.getId()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public enum VendorType {
KAKAO,
NAVER,
GOOGLE,
APPLE
APPLE,
VIRTUAL,
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ccc.keeweinfra.dto.KakaoProfileResponse;
import ccc.keeweinfra.dto.NaverProfileResponse;
import ccc.keeweinfra.dto.OauthResponse;
import ccc.keeweinfra.dto.VirtualProfileResponse;
import ccc.keeweinfra.service.oauth.GoogleInfraService;
import ccc.keeweinfra.service.oauth.KakaoInfraService;
import ccc.keeweinfra.service.oauth.NaverInfraService;
Expand Down Expand Up @@ -38,6 +39,8 @@ public <T extends OauthResponse> T getOauthProfile(String code, VendorType vendo
return (T) getNaverProfile(code);
case GOOGLE:
return (T) getGoogleProfile(code);
case VIRTUAL:
return (T) getVirtualProfile(code);
default:
throw new KeeweException(KeeweRtnConsts.ERR504);
}
Expand Down Expand Up @@ -86,4 +89,7 @@ private GoogleProfileResponse getGoogleProfile(String code) {
}
}

private VirtualProfileResponse getVirtualProfile(String code) {
return new VirtualProfileResponse();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ccc.keeweinfra.dto;

import java.util.UUID;
import lombok.Data;

@Data
public class VirtualProfileResponse implements OauthResponse {
@Override
public String getId() {
return UUID.randomUUID().toString();
}

@Override
public String getEmail() {
return null;
}
}