Skip to content

Commit

Permalink
chore : 테스트 케이스 수정 및 로그를 추가한다
Browse files Browse the repository at this point in the history
  • Loading branch information
packdev937 committed May 8, 2024
1 parent 31f0b4b commit f104523
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import kusitms.duduk.core.security.port.input.LoginOAuthUseCase;
import kusitms.duduk.domain.user.vo.Provider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -13,9 +14,10 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping( "/api/oauth")
@RequestMapping("/api/oauth")
public class OAuthController implements OAuthControllerDocs {

private final LoginOAuthUseCase loginOAuthUseCase;
Expand All @@ -24,6 +26,7 @@ public class OAuthController implements OAuthControllerDocs {
public ResponseEntity<OAuthLoginResponse> oAuthLogin(
@RequestParam(name = "prodiver") final String provider,
@RequestHeader("OAuth") final String accessToken) {
log.info("oAuthLogin() start \n provider: {}, accessToken: {}\n", provider, accessToken);
return new ResponseEntity<>(loginOAuthUseCase.process(Provider.from(provider), accessToken),
HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import kusitms.duduk.domain.global.Id;
import kusitms.duduk.domain.user.User;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RequiredArgsConstructor
@Adapter
public class UserPersistenceAdapter implements UpdateUserPort, LoadUserPort, SaveUserPort,
Expand All @@ -26,6 +28,8 @@ public User save(User user) {
UserJpaEntity userJpaEntity = userJpaMapper.toJpaEntity(user);
// 변환한 UserJpaEntity를 저장 (Id 값이 자동으로 생성)
UserJpaEntity userSaved = userRepository.save(userJpaEntity);

log.info("userSaved: {}\n", userSaved.toString());
return userJpaMapper.toDomain(userSaved);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,23 @@ public class UserJpaEntity {
// @LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;

@Override
public String toString() {
return "UserJpaEntity{" +
"id=" + id +
", email='" + email + '\'' +
", nickname='" + nickname + '\'' +
", refreshToken='" + refreshToken + '\'' +
", gender=" + gender +
", birthday=" + birthday +
", role=" + role +
", provider=" + provider +
", category=" + category +
", goal=" + goal +
", acornCount=" + acornCount +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import kusitms.duduk.core.user.port.output.SaveUserPort;
import kusitms.duduk.domain.user.User;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@RequiredArgsConstructor
@Service
public class RegisterUserCommand implements RegisterUserUseCase {
Expand All @@ -20,6 +22,7 @@ public class RegisterUserCommand implements RegisterUserUseCase {

@Override
public UserResponse register(CreateUserRequest request) {
log.info("register() start\n");
User user = userDtoMapper.toDomain(request);

if (loadUserPort.existsUserByEmail(user.getEmail().getValue())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class NewsLetterTest {
String content = "content";
String thumbnail = "thumbnail";
String keywords = "keyword1,keyword2,keyword3";
String stock = "주식";
String stock = "stock";
String summary = "summary\nsummary\nsummary";

// when
Expand Down

0 comments on commit f104523

Please sign in to comment.