Conversation
WalkthroughAdds persistent user settings (screenshot auto-delete) with JPA entity, migration, repository, service methods, DTOs, controller endpoints (GET/PUT /v1/user/settings), error code/type entries, tests, and documentation terminology updates replacing "사용자/유저" with "회원". Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller as UserController
participant Service as UserService
participant Repo as UserSettingsRepository
participant DB as Database
rect rgb(230,250,240)
Note over Client,Controller: GET /v1/user/settings
Client->>Controller: GET /v1/user/settings (auth)
Controller->>Service: getUserSettings(username)
Service->>Repo: findById(userId)
Repo->>DB: SELECT user_settings
DB-->>Repo: row / empty
Repo-->>Service: UserSettings?
Service-->>Controller: UserSettings
Controller-->>Client: ApiResponse<UserSettingsRespDto>
end
rect rgb(240,240,255)
Note over Client,Controller: PUT /v1/user/settings
Client->>Controller: PUT /v1/user/settings (body, auth)
Controller->>Service: setUserSettings(userId, enabled)
Service->>Repo: findById(userId)
Repo->>DB: SELECT user_settings
alt exists
Service->>Repo: save(updated UserSettings)
else not exists
Service->>Service: UserSettings.init(userId)
Service->>Repo: save(new UserSettings)
end
Repo->>DB: INSERT/UPDATE user_settings
DB-->>Repo: saved row
Repo-->>Service: UserSettings
Service-->>Controller: UserSettings
Controller-->>Client: ApiResponse<UserSettingsRespDto>
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (7)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (1)
15-15: Remove unused import.The import for
UserSettingsis not used in this file. The DTO classes don't reference the entity directly.import com.capturecat.core.domain.user.User; import com.capturecat.core.domain.user.UserRole; -import com.capturecat.core.domain.user.UserSettings;capturecat-core/src/test/java/com/capturecat/core/api/user/UserControllerTest.java (1)
163-163: Consider usingany(LoginUser.class)instead ofnullable(String.class).Line 163 uses
nullable(String.class)for the first parameter ofsetUserSettings, but based on the pattern in other tests (e.g., line 112:any()), this should likely beany(LoginUser.class)to match the actual method signature.- willReturn(userSettings).given(userService).setUserSettings(nullable(String.class), anyBoolean()); + willReturn(userSettings).given(userService).setUserSettings(any(LoginUser.class), anyBoolean());
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
capturecat-core/src/docs/asciidoc/error-codes.adoc(2 hunks)capturecat-core/src/docs/asciidoc/user.adoc(1 hunks)capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java(4 hunks)capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java(2 hunks)capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java(2 hunks)capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettings.java(1 hunks)capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettingsRepository.java(1 hunks)capturecat-core/src/main/java/com/capturecat/core/service/user/UserService.java(6 hunks)capturecat-core/src/main/java/com/capturecat/core/support/error/ErrorCode.java(1 hunks)capturecat-core/src/main/java/com/capturecat/core/support/error/ErrorType.java(1 hunks)capturecat-core/src/test/java/com/capturecat/core/api/error/ErrorCodeControllerTest.java(1 hunks)capturecat-core/src/test/java/com/capturecat/core/api/user/UserControllerTest.java(2 hunks)capturecat-core/src/test/java/com/capturecat/core/service/user/UserServiceTest.java(5 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (1)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (4)
Getter(15-27)Getter(30-36)Getter(39-49)Getter(52-61)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (1)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (4)
Getter(21-46)Getter(49-54)Getter(57-62)Getter(65-69)
capturecat-core/src/test/java/com/capturecat/core/api/user/UserControllerTest.java (2)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (1)
UserReqDto(18-70)capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (1)
UserRespDto(12-63)
capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettings.java (2)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (4)
Getter(15-27)Getter(30-36)Getter(39-49)Getter(52-61)capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (4)
Getter(21-46)Getter(49-54)Getter(57-62)Getter(65-69)
capturecat-core/src/main/java/com/capturecat/core/service/user/UserService.java (1)
capturecat-core/src/test/java/com/capturecat/core/api/user/UserApiTest.java (1)
Transactional(22-100)
capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java (2)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (1)
UserReqDto(18-70)capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (1)
UserRespDto(12-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: deploy-dev
🔇 Additional comments (20)
capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettingsRepository.java (1)
1-6: LGTM!The repository interface follows Spring Data JPA conventions correctly. The interface is clean and leverages the default CRUD operations provided by
JpaRepository.capturecat-core/src/main/java/com/capturecat/core/support/error/ErrorCode.java (1)
44-45: LGTM!The new error code
NOT_FOUND_USER_SETTINGSis properly added with a clear Korean message, consistent with the existing error code patterns in the codebase.capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (1)
64-69: LGTM!The
UserSettingsReqDtois clean and follows the existing DTO pattern in this file. The boolean field appropriately represents the screenshot auto-delete preference.capturecat-core/src/docs/asciidoc/error-codes.adoc (1)
77-115: LGTM!The documentation updates are well-structured:
- Consistent terminology migration from "유저"/"사용자" to "회원" throughout
- New sections properly added for user settings retrieval and updates
- Anchor references align with the new error-code test identifiers
capturecat-core/src/test/java/com/capturecat/core/api/user/UserControllerTest.java (2)
134-155: LGTM!The test properly validates the GET endpoint for user settings retrieval:
- Correctly mocks the service response using
UserSettings.init(1L)- Validates all response fields including
userIdandscreenshotAutoDeleteEnabled- Generates proper REST Docs documentation
157-186: LGTM!The test properly validates the PUT endpoint for updating user settings:
- Correctly constructs the request DTO with the new setting value
- Mocks the service to return the updated settings
- Validates all request and response fields
- Generates proper REST Docs documentation
capturecat-core/src/test/java/com/capturecat/core/api/error/ErrorCodeControllerTest.java (1)
155-166: LGTM!The error code documentation tests properly cover the new user settings endpoints:
사용자_설정_정보_조회_에러_코드_문서()includes bothUSER_NOT_FOUNDandUSER_SETTINGS_NOT_FOUND사용자_설정_정보_변경_에러_코드_문서()includesUSER_NOT_FOUND- Follows the established pattern for error code documentation
Note: Once the HTTP status for
USER_SETTINGS_NOT_FOUNDis corrected toNOT_FOUND(404) in ErrorType.java as suggested in my earlier comment, these tests will automatically reflect the correct status code in the generated documentation.capturecat-core/src/test/java/com/capturecat/core/service/user/UserServiceTest.java (5)
60-61: LGTM!The mock setup for UserSettingsRepository is correct and follows the existing test pattern.
76-76: LGTM!Mocking
findByIdto returnOptional.empty()correctly simulates the case where user settings don't yet exist during the join flow.
117-126: LGTM!The withdrawal test correctly verifies that user settings are deleted alongside other user-related data.
145-156: LGTM!The test correctly verifies that getUserSettings returns the expected userId and default screenshotAutoDelete setting (false).
158-170: Test validates domain behavior, not persistence.The test mocks
save()to return the same settings object and then asserts on that object. This validates the domain object'schangeAutoDeletemethod but doesn't verify the full persistence flow. For a unit test, this is acceptable, but consider adding an integration test to verify the end-to-end persistence behavior.capturecat-core/src/docs/asciidoc/user.adoc (1)
1-129: LGTM!The documentation updates are consistent and well-structured:
- Terminology successfully migrated from "사용자"/"유저" to "회원" throughout
- New sections for user settings (회원-설정-조회, 회원-설정-변경) follow the existing documentation pattern
- All operations include success/failure blocks and reference appropriate error codes
capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java (1)
89-97: LGTM!The GET endpoint for retrieving user settings is correctly implemented:
- Uses @AuthenticationPrincipal for authentication
- Delegates to service layer
- Returns properly mapped DTO
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (1)
51-61: LGTM!The
UserSettingsRespDtois well-designed:
- Uses
@RequiredArgsConstructor(access = PRIVATE)for controlled instantiation- Final fields ensure immutability
- Static factory method
of()provides a clean mapping from domain to DTO- Simple, clear mapping logic from
UserSettingsto DTOcapturecat-core/src/main/java/com/capturecat/core/service/user/UserService.java (5)
60-61: LGTM!User settings are correctly initialized with default values (false) when users are created, both in the regular join flow and the social login flow. Since these calls are within transactional methods, atomicity is guaranteed.
Also applies to: 85-86
136-147: LGTM!The upsert pattern in
setUserSettingsis correctly implemented:
- Uses
findById().orElseGet(() -> UserSettings.init(userId))to handle both new and existing settings- Calls
save()to ensure persistence for newly created settings- The
@Transactionalannotation ensures atomicity
149-155: LGTM!The convenience wrapper method correctly validates that the user exists before delegating to the userId-based overload.
168-169: LGTM!User settings are properly deleted when a user is withdrawn, maintaining referential integrity.
127-134: Confirm migration readiness: both user creation paths initialize UserSettings, but verify no legacy users lack settings.Both
join()andupsertSocialUser()properly initialize UserSettings viasetUserSettings(), which uses the defensiveorElseGet()pattern. All new users receive settings. However, the concern remains valid if UserSettings was added to an existing system with pre-existing users—those users would fail ongetUserSettings()unlesssetUserSettings()is called first.Verify: (1) whether UserSettings was added to a live system with existing users, and (2) run a query to confirm no users lack settings records. If legacy users exist without settings, either run a backfill migration or ensure all code paths that read settings use the same
orElseGet()defensive pattern.
capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java
Show resolved
Hide resolved
capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettings.java
Show resolved
Hide resolved
capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettings.java
Show resolved
Hide resolved
| TOO_MANY_USER_TAGS(HttpStatus.BAD_REQUEST, ErrorCode.EXCEED_MAX_USER_TAG_COUNT, LogLevel.WARN), | ||
| USER_TAG_NOT_FOUND(HttpStatus.NOT_FOUND, ErrorCode.NOT_FOUND_USER_TAG, LogLevel.WARN); | ||
| USER_TAG_NOT_FOUND(HttpStatus.NOT_FOUND, ErrorCode.NOT_FOUND_USER_TAG, LogLevel.WARN), | ||
| USER_SETTINGS_NOT_FOUND(HttpStatus.INTERNAL_SERVER_ERROR, ErrorCode.NOT_FOUND_USER_SETTINGS, LogLevel.ERROR); |
There was a problem hiding this comment.
Use HttpStatus.NOT_FOUND for consistency with other "not found" errors.
USER_SETTINGS_NOT_FOUND currently uses HttpStatus.INTERNAL_SERVER_ERROR (500), but all other "not found" errors in the codebase use HttpStatus.NOT_FOUND (404):
- Line 27:
USER_NOT_FOUND→NOT_FOUND - Line 33:
TAG_NOT_FOUND→NOT_FOUND - Line 39:
BOOKMARK_NOT_FOUND→NOT_FOUND - Line 49:
USER_TAG_NOT_FOUND→NOT_FOUND
HTTP 404 is semantically correct for "resource not found" scenarios, while 500 should be reserved for unexpected server errors.
Apply this diff:
- USER_SETTINGS_NOT_FOUND(HttpStatus.INTERNAL_SERVER_ERROR, ErrorCode.NOT_FOUND_USER_SETTINGS, LogLevel.ERROR);
+ USER_SETTINGS_NOT_FOUND(HttpStatus.NOT_FOUND, ErrorCode.NOT_FOUND_USER_SETTINGS, LogLevel.WARN);📝 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.
| USER_SETTINGS_NOT_FOUND(HttpStatus.INTERNAL_SERVER_ERROR, ErrorCode.NOT_FOUND_USER_SETTINGS, LogLevel.ERROR); | |
| USER_SETTINGS_NOT_FOUND(HttpStatus.NOT_FOUND, ErrorCode.NOT_FOUND_USER_SETTINGS, LogLevel.WARN); |
🤖 Prompt for AI Agents
In
capturecat-core/src/main/java/com/capturecat/core/support/error/ErrorType.java
around line 50, the USER_SETTINGS_NOT_FOUND entry incorrectly uses
HttpStatus.INTERNAL_SERVER_ERROR; change it to HttpStatus.NOT_FOUND to match
other "not found" error entries (keep the existing
ErrorCode.NOT_FOUND_USER_SETTINGS and LogLevel.ERROR unchanged).
There was a problem hiding this comment.
@leeedohyun
로컬에서 돌릴 때 flyway 설정 관련해서 오류가 나는데, 뭐 설정 필요한게 있어?
Caused by: org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database:
개발계 배포할 때도 ddl-auto=update로 테이블 생성이 안돼서 실패했네
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
로컬에서는
flyway:
enabled: false이 설정 추가하면 되고, 테이블 생성은 직접 스크립트 짜야 돼! resources 하위 파일 참고하면 될 듯!
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java(4 hunks)capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettings.java(1 hunks)capturecat-core/src/main/resources/db/migration/V3__create_user_settings.sql(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- capturecat-core/src/main/java/com/capturecat/core/domain/user/UserSettings.java
🧰 Additional context used
🧬 Code graph analysis (1)
capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java (2)
capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserReqDto.java (1)
UserReqDto(18-70)capturecat-core/src/main/java/com/capturecat/core/api/user/dto/UserRespDto.java (1)
UserRespDto(12-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: deploy-dev
🔇 Additional comments (2)
capturecat-core/src/main/java/com/capturecat/core/api/user/UserController.java (2)
89-97: LGTM!The GET endpoint follows the established controller pattern, properly delegates to the service layer, and uses consistent authentication and response wrapping.
99-109: LGTM! Previous issue resolved.The
@RequestBodyannotation is now correctly present on line 104, resolving the critical deserialization issue flagged in the previous review. The endpoint implementation is clean and follows established patterns.
| create table if not exists user_settings | ||
| ( | ||
| user_id BIGINT NOT NULL PRIMARY KEY, | ||
| screenshot_auto_delete_enabled BOOLEAN NOT NULL DEFAULT FALSE, | ||
| created_date timestamp(6) not null, | ||
| last_modified_date timestamp(6) not null, | ||
| CONSTRAINT fk_user_settings_user FOREIGN KEY (user_id) REFERENCES users (id) | ||
| ); |
There was a problem hiding this comment.
Add ON DELETE CASCADE to the foreign key constraint.
The PR description states settings should be deleted when a user withdraws. Without ON DELETE CASCADE, if a user row is deleted directly at the database level, the corresponding settings row will become orphaned (causing FK constraint violations).
Apply this diff to ensure settings are automatically deleted when the parent user is removed:
- CONSTRAINT fk_user_settings_user FOREIGN KEY (user_id) REFERENCES users (id)
+ CONSTRAINT fk_user_settings_user FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE📝 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.
| create table if not exists user_settings | |
| ( | |
| user_id BIGINT NOT NULL PRIMARY KEY, | |
| screenshot_auto_delete_enabled BOOLEAN NOT NULL DEFAULT FALSE, | |
| created_date timestamp(6) not null, | |
| last_modified_date timestamp(6) not null, | |
| CONSTRAINT fk_user_settings_user FOREIGN KEY (user_id) REFERENCES users (id) | |
| ); | |
| create table if not exists user_settings | |
| ( | |
| user_id BIGINT NOT NULL PRIMARY KEY, | |
| screenshot_auto_delete_enabled BOOLEAN NOT NULL DEFAULT FALSE, | |
| created_date timestamp(6) not null, | |
| last_modified_date timestamp(6) not null, | |
| CONSTRAINT fk_user_settings_user FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE | |
| ); |
🤖 Prompt for AI Agents
In capturecat-core/src/main/resources/db/migration/V3__create_user_settings.sql
around lines 1 to 8, the foreign key constraint on user_id lacks ON DELETE
CASCADE so user_settings won't be removed when a user is deleted; modify the FK
definition to append "ON DELETE CASCADE" after "REFERENCES users (id)" (i.e.,
update the CREATE TABLE FK clause to include ON DELETE CASCADE) so settings are
automatically deleted when the parent user is removed.
# Conflicts: # capturecat-core/src/docs/asciidoc/user.adoc
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
capturecat-core/src/test/java/com/capturecat/core/api/error/ErrorCodeControllerTest.java (2)
3-4: Prefer explicit static imports if your style forbids star imports.Wildcard static imports can hide collisions and reduce grep-ability. Keep if your Checkstyle/Spotless allows it; otherwise switch back to explicit members.
160-171: Unify terminology: '회원' vs '사용자' in test names.Docs elsewhere use ‘회원’. Consider renaming for consistency.
Apply:
-void 사용자_설정_정보_조회_에러_코드_문서() { +void 회원_설정_정보_조회_에러_코드_문서() { -void 사용자_설정_정보_변경_에러_코드_문서() { +void 회원_설정_정보_변경_에러_코드_문서() {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
capturecat-core/src/docs/asciidoc/error-codes.adoc(2 hunks)capturecat-core/src/test/java/com/capturecat/core/api/error/ErrorCodeControllerTest.java(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: deploy-dev
🔇 Additional comments (2)
capturecat-core/src/docs/asciidoc/error-codes.adoc (1)
113-119: Snippet paths verified and aligned with test documentation.The snippet references in lines 113-119 are confirmed to be generated by corresponding REST documentation tests:
{snippets}/errorCode/getUserSettings/error-codes.adoc[]is generated byErrorCodeControllerTest.javaviagenerateErrorDocs("errorCode/getUserSettings", ...){snippets}/errorCode/updateUserSettings/error-codes.adoc[]is generated byErrorCodeControllerTest.javaviagenerateErrorDocs("errorCode/updateUserSettings", ...)The test infrastructure uses Spring REST Docs (
@ExtendWith(RestDocumentationExtension.class),ErrorCodeSnippet,TemplatedSnippet) to generate AsciiDoc snippets during test execution. The pattern is consistent with all 30+ other endpoints documented in the file.capturecat-core/src/test/java/com/capturecat/core/api/error/ErrorCodeControllerTest.java (1)
160-165: LGTM — GET user settings error-code docUSER_NOT_FOUND and USER_SETTINGS_NOT_FOUND make sense for retrieval. Identifier path also fits the existing naming pattern.
| [[회원정보조회]] | ||
| === 회원정보조회 |
There was a problem hiding this comment.
Inconsistent anchor naming convention.
The anchor [[회원정보조회]] on Line 81 lacks hyphens, while all subsequent anchors (회원-태그-, 회원-설정-) use hyphens for word separation. Update to [[회원-정보-조회]] for consistency.
-[[회원정보조회]]
-=== 회원정보조회
+[[회원-정보-조회]]
+=== 회원 정보 조회📝 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.
| [[회원정보조회]] | |
| === 회원정보조회 | |
| [[회원-정보-조회]] | |
| === 회원 정보 조회 |
🤖 Prompt for AI Agents
In capturecat-core/src/docs/asciidoc/error-codes.adoc around lines 81 to 82, the
anchor [[회원정보조회]] is inconsistent with the repository's hyphenated anchor naming
convention; change it to [[회원-정보-조회]] so it matches the pattern used by
subsequent anchors (회원-태그-*, 회원-설정-*), and update any internal cross-references
in the document to reference the new hyphenated anchor.
| @Test | ||
| void 사용자_설정_정보_변경_에러_코드_문서() { | ||
| List<ErrorCodeDescriptor> errorCodeDescriptors = generateErrorCodeDescriptors(USER_NOT_FOUND); | ||
| generateErrorDocs("errorCode/updateUserSettings", errorCodeDescriptors); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
Confirm UPDATE error cases (legacy users) and document if applicable.
If older accounts might lack settings, UPDATE could return USER_SETTINGS_NOT_FOUND unless the service creates defaults. If create‑if‑missing is guaranteed or a migration backfilled, current docs are fine; otherwise add the missing descriptor.
Run to confirm thrown/used error types around update:
🏁 Script executed:
#!/bin/bash
# Find update endpoint/service and nearby error handling
rg -n --type=java -C3 '(updateUserSettings|class .*UserSettings.*|@PutMapping|@PatchMapping)'
# Check whether USER_SETTINGS_NOT_FOUND appears in update flow
rg -n --type=java -C2 '\bUSER_SETTINGS_NOT_FOUND\b|\bNOT_FOUND_USER_SETTINGS\b'Length of output: 8621
Add USER_SETTINGS_NOT_FOUND to the updateUserSettings error documentation.
The setUserSettings method in UserService.java:132-133 explicitly throws USER_SETTINGS_NOT_FOUND when user settings are not found. The test method 사용자_설정_정보_변경_에러_코드_문서() currently documents only USER_NOT_FOUND, but should include USER_SETTINGS_NOT_FOUND to match the actual error cases the endpoint can return—consistent with how the corresponding GET endpoint documents both errors at line 162-163.
Update line 169 to:
List<ErrorCodeDescriptor> errorCodeDescriptors = generateErrorCodeDescriptors(USER_NOT_FOUND, USER_SETTINGS_NOT_FOUND);🤖 Prompt for AI Agents
In
capturecat-core/src/test/java/com/capturecat/core/api/error/ErrorCodeControllerTest.java
around lines 167 to 171, the test that generates error docs for
updateUserSettings only includes USER_NOT_FOUND but the service can also throw
USER_SETTINGS_NOT_FOUND; update the call to generateErrorCodeDescriptors to
include both USER_NOT_FOUND and USER_SETTINGS_NOT_FOUND so the test documents
both error cases (i.e., pass both constants into generateErrorCodeDescriptors).
📌 관련 이슈 (필수)
📝 작업 내용 (필수)
💬 리뷰 참고 사항 (선택)
Summary by CodeRabbit
New Features
Documentation
Tests
Chores