Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.somemore.user.controller;

import com.somemore.global.auth.annotation.UserId;
import com.somemore.global.common.response.ApiResponse;
import com.somemore.user.usecase.UserQueryUseCase;
import com.somemore.user.usecase.ValidateBasicInfoUseCase;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
Expand All @@ -11,6 +13,8 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@Tag(name = "User Query API", description = "유저 조회 관련 API")
@RestController
@Slf4j
Expand All @@ -19,13 +23,24 @@
public class UserQueryController {

private final UserQueryUseCase userQueryUseCase;
private final ValidateBasicInfoUseCase validateBasicInfoUseCase;

@GetMapping("/exists/")
@GetMapping("/exists")
@Operation(summary = "아이디 중복 확인", description = "입력한 아이디가 중복되었는지 확인합니다.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 이슈가 있었군요....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그러게요 ㅋㅋㅋ 저도 보고 후다닥..

public ApiResponse<Boolean> checkUserExists(
@RequestParam String accountId
) {
boolean isAccountIdDuplicate = userQueryUseCase.isDuplicateAccountId(accountId);
return ApiResponse.ok(isAccountIdDuplicate, "중복 조회 완료");
}

@GetMapping("/check/basic-info")
@Operation(summary = "유저 기본 정보 입력 상태 확인", description = "현재 유저의 필수 입력 정보가 모두 완료되었는지 확인합니다."
)
public ApiResponse<Boolean> checkUserExists(
@UserId UUID userId
) {
boolean isBasicInfoComplete = validateBasicInfoUseCase.isBasicInfoComplete(userId);
return ApiResponse.ok(isBasicInfoComplete, "필수 입력 정보 설정 조회 완료");
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.somemore.user.service;

import com.somemore.user.domain.UserCommonAttribute;
import com.somemore.user.usecase.UserQueryUseCase;
import com.somemore.user.usecase.ValidateBasicInfoUseCase;
import lombok.RequiredArgsConstructor;
Expand All @@ -20,18 +19,6 @@ public class ValidateBasicInfoService implements ValidateBasicInfoUseCase {

@Override
public boolean isBasicInfoComplete(UUID userId) {
// 객체지향적: UserCommonAttribute 객체를 활용하여 데이터를 관리
// 최신 데이터와는 조금 멀어질 수 있음
UserCommonAttribute userCommonAttribute = userQueryUseCase.getCommonAttributeByUserId(userId);
boolean isCustomized1 = userCommonAttribute.isCustomized();

// 비용 절감: 특정 필드만 조회하여 데이터베이스 접근을 최소화
// 최신 데이터에 더 가까움
boolean isCustomized2 = userQueryUseCase.getIsCustomizedByUserId(userId);

// TODO:
// - 두 접근 방식 중 하나를 선택.

return isCustomized1 && isCustomized2;
return userQueryUseCase.getIsCustomizedByUserId(userId);
}
}
Loading