Skip to content

유저 프로퍼티 조회 API prod 반영#164

Merged
ose0221 merged 4 commits intomainfrom
dev
Apr 7, 2026
Merged

유저 프로퍼티 조회 API prod 반영#164
ose0221 merged 4 commits intomainfrom
dev

Conversation

@ose0221
Copy link
Copy Markdown
Contributor

@ose0221 ose0221 commented Apr 7, 2026

🚀 PR 요약

목적이 무엇인가요? - 지우고 작성

✨ PR 상세 내용

어떤 부분이 어떻게 변경이 되었나요? - 지우고 작성

🚨 주의 사항

주의할 부분이 무엇인가요? - 지우고 작성

✅ 체크 리스트

  • 리뷰어 설정했나요?
  • Label 설정했나요?
  • 제목 양식 맞췄나요? (ex. feat: 기능 추가)
  • 변경 사항에 대한 테스트를 진행했나요?

Summary by CodeRabbit

  • New Features
    • Added new API endpoint to retrieve user properties including job role information
    • Google login responses now include job role data for authenticated users
    • Introduced dedicated response structure for user property queries

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

A new API endpoint and supporting infrastructure are introduced to expose user property information via /api/v3/users/properties. This includes a new response DTO, controller endpoint, interface contract, and use case implementation. Additionally, GoogleLoginResponseV3 is enhanced to carry jobRole data from authentication flows.

Changes

Cohort / File(s) Summary
New API Endpoint
api/src/main/java/com/pinback/api/user/controller/UserControllerV3.java
Added GET /properties endpoint that retrieves user properties by delegating to userManagementPort.getUserProperty(user).
User Property Response Infrastructure
application/src/main/java/com/pinback/application/user/dto/response/UserPropertyResponse.java
New record with userId and jobRole components; includes factory method of(UUID id, String jobRole).
User Management Port & Implementation
application/src/main/java/com/pinback/application/user/port/in/UserManagementPort.java, application/src/main/java/com/pinback/application/user/usecase/UserManagementUsecase.java
Added interface contract and read-only implementation for getUserProperty(User user), fetching current user data and returning property response.
Authentication Response Enhancement
application/src/main/java/com/pinback/application/google/dto/response/GoogleLoginResponseV3.java, application/src/main/java/com/pinback/application/auth/usecase/AuthUsecase.java
Updated GoogleLoginResponseV3 record to include jobRole field; modified getInfoAndTokenV3 to derive and pass jobRole (or null) from user's job status when constructing login response.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 bounces with delight
New endpoints hop through fields of code,
JobRole travels the auth-blessed road!
Records and ports in tandem dance,
User properties get their chance,
Fresh features sprout where logic grows! 🥕🎭

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is completely unfilled, consisting only of the template placeholder text with '지우고 작성' (delete and write) instructions in all required sections. Fill in all required sections: provide the purpose of the changes, detailed explanation of what was modified, precautions to consider, and ensure checklist items are reviewed.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a user property retrieval API for production deployment.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@application/src/main/java/com/pinback/application/user/usecase/UserManagementUsecase.java`:
- Around line 100-106: getUserProperty in UserManagementUsecase calls
getUser.getJob().getValue() which can NPE when job is null; change this to
obtain the user via userGetServicePort.findById(user.getId()) and pass a
null-safe job value to UserPropertyResponse.of by checking User.hasJob() (or
user.getJob() != null) and using job.getValue() only when present, otherwise
pass null, mirroring the pattern used in AuthUsecase and
GetSharedArticleUsecase.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0adc76b0-bb84-48c6-8c03-d40d7cb30731

📥 Commits

Reviewing files that changed from the base of the PR and between df39a3d and eff5040.

📒 Files selected for processing (6)
  • api/src/main/java/com/pinback/api/user/controller/UserControllerV3.java
  • application/src/main/java/com/pinback/application/auth/usecase/AuthUsecase.java
  • application/src/main/java/com/pinback/application/google/dto/response/GoogleLoginResponseV3.java
  • application/src/main/java/com/pinback/application/user/dto/response/UserPropertyResponse.java
  • application/src/main/java/com/pinback/application/user/port/in/UserManagementPort.java
  • application/src/main/java/com/pinback/application/user/usecase/UserManagementUsecase.java

Comment on lines +100 to +106
@Override
@Transactional(readOnly = true)
public UserPropertyResponse getUserProperty(User user) {
User getUser = userGetServicePort.findById(user.getId());

return UserPropertyResponse.of(getUser.getId(), getUser.getJob().getValue());
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how other methods handle potentially null job field
rg -n -A3 -B3 'getJob\(\)' --type=java

# Check the hasJob() method implementation
ast-grep --pattern $'public boolean hasJob() {
  $$$
}'

Repository: Pinback-Team/pinback-server

Length of output: 6183


Potential NullPointerException when user has no job set.

The job field is nullable (confirmed by the hasJob() method in User.java). Calling getUser.getJob().getValue() on line 105 will throw a NullPointerException for users who haven't set their job role.

Other query methods in the codebase handle this consistently: AuthUsecase.java (line 170) uses updatedUser.hasJob() ? updatedUser.getJob().getValue() : null, and GetSharedArticleUsecase.java (line 30) explicitly checks if (user.getJob() == null) before access.

Proposed fix with null-safe handling
 `@Override`
 `@Transactional`(readOnly = true)
 public UserPropertyResponse getUserProperty(User user) {
     User getUser = userGetServicePort.findById(user.getId());
-
-    return UserPropertyResponse.of(getUser.getId(), getUser.getJob().getValue());
+    String jobRole = getUser.getJob() != null ? getUser.getJob().getValue() : null;
+    return UserPropertyResponse.of(getUser.getId(), jobRole);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Override
@Transactional(readOnly = true)
public UserPropertyResponse getUserProperty(User user) {
User getUser = userGetServicePort.findById(user.getId());
return UserPropertyResponse.of(getUser.getId(), getUser.getJob().getValue());
}
`@Override`
`@Transactional`(readOnly = true)
public UserPropertyResponse getUserProperty(User user) {
User getUser = userGetServicePort.findById(user.getId());
String jobRole = getUser.getJob() != null ? getUser.getJob().getValue() : null;
return UserPropertyResponse.of(getUser.getId(), jobRole);
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@application/src/main/java/com/pinback/application/user/usecase/UserManagementUsecase.java`
around lines 100 - 106, getUserProperty in UserManagementUsecase calls
getUser.getJob().getValue() which can NPE when job is null; change this to
obtain the user via userGetServicePort.findById(user.getId()) and pass a
null-safe job value to UserPropertyResponse.of by checking User.hasJob() (or
user.getJob() != null) and using job.getValue() only when present, otherwise
pass null, mirroring the pattern used in AuthUsecase and
GetSharedArticleUsecase.

@ose0221 ose0221 merged commit c7ac76a into main Apr 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant