feat: default to Seoul for members without travel record and merge PM city data - #11
Conversation
📝 WalkthroughWalkthroughCity mappings are expanded and reordered, while member and companion responses now default to Seoul and zero jetlag values when no calculation exists. Services resolve the base city through ChangesCity defaults and mapping
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant MemberOrCompanionService
participant CityRepository
participant ResponseFactory
Client->>MemberOrCompanionService: Request member or companion data
MemberOrCompanionService->>CityRepository: findByDirection(BASE)
CityRepository-->>MemberOrCompanionService: Seoul City
MemberOrCompanionService->>ResponseFactory: Build response with latestResult and Seoul
ResponseFactory-->>Client: Response with Seoul defaults when no result exists
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
src/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.java (1)
28-42: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMissing assertion for
jetlagLabeldefault value.The issue objective explicitly specifies
jetlagLabel="0분"as part of the Seoul default contract, but this test doesn't verify it.✅ Suggested addition
assertThat(data.path("jetlagMinutes").asInt()).isEqualTo(0); + assertThat(data.path("jetlagLabel").asText()).isEqualTo("0분"); assertThat(data.path("direction").asText()).isEqualTo("SAME");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.java` around lines 28 - 42, Extend the test method 수면시차_계산_전에는_서울이_기본_위치로_내려온다 to assert that data.path("jetlagLabel").asText() equals "0분", covering the default Seoul response contract alongside jetlagMinutes.src/test/java/com/cotato/cokerthon/domain/companion/CompanionIntegrationTest.java (1)
51-55: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMissing assertion for
jetlagLabeldefault value.The PR objectives explicitly require
jetlagLabel="0분"for the no-history default, but this test only checkscityNameKr,jetlagMinutes,direction, andlastRecordedAt.✅ Suggested addition
assertThat(addedData.path("direction").asText()).isEqualTo("SAME"); + assertThat(addedData.path("jetlagLabel").asText()).isEqualTo("0분"); assertThat(addedData.path("lastRecordedAt").isNull()).isTrue();As per PR objectives: "
jetlagLabel="0분"" is a stated requirement for the missing-record default.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/cotato/cokerthon/domain/companion/CompanionIntegrationTest.java` around lines 51 - 55, Update the no-history default assertions in CompanionIntegrationTest to also verify that addedData.path("jetlagLabel").asText() equals "0분", alongside the existing city, minutes, direction, and timestamp checks.src/main/java/com/cotato/cokerthon/domain/auth/service/AuthService.java (1)
52-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
getBaseCitylookup logic across three services.The same
cityRepository.findByDirection(CityDirection.BASE).orElseThrow(...)block is repeated verbatim inCompanionService.getSeoul()andMemberService.getSeoul(). Consider extracting this into a shared component (e.g. aBaseCityProvider/CityQueryService) that all three services depend on, so the "no-history default = Seoul" business rule lives in one place.♻️ Example extraction
`@Component` public class BaseCityProvider { private final CityRepository cityRepository; public BaseCityProvider(CityRepository cityRepository) { this.cityRepository = cityRepository; } public City get() { return cityRepository.findByDirection(CityDirection.BASE) .orElseThrow(() -> new BusinessException(ErrorCode.CITY_NOT_MATCHED)); } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/cotato/cokerthon/domain/auth/service/AuthService.java` around lines 52 - 56, Extract the duplicated base-city lookup into a shared component such as BaseCityProvider or CityQueryService with a get() method containing the CityDirection.BASE query and BusinessException fallback. Inject this component into AuthService, CompanionService, and MemberService, replacing each local getSeoul or inline lookup with the shared method.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/main/java/com/cotato/cokerthon/domain/auth/service/AuthService.java`:
- Around line 52-56: Extract the duplicated base-city lookup into a shared
component such as BaseCityProvider or CityQueryService with a get() method
containing the CityDirection.BASE query and BusinessException fallback. Inject
this component into AuthService, CompanionService, and MemberService, replacing
each local getSeoul or inline lookup with the shared method.
In
`@src/test/java/com/cotato/cokerthon/domain/companion/CompanionIntegrationTest.java`:
- Around line 51-55: Update the no-history default assertions in
CompanionIntegrationTest to also verify that
addedData.path("jetlagLabel").asText() equals "0분", alongside the existing city,
minutes, direction, and timestamp checks.
In `@src/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.java`:
- Around line 28-42: Extend the test method 수면시차_계산_전에는_서울이_기본_위치로_내려온다 to
assert that data.path("jetlagLabel").asText() equals "0분", covering the default
Seoul response contract alongside jetlagMinutes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: efb0a31a-b548-4b19-8a7e-62cf0e544145
📒 Files selected for processing (9)
src/main/java/com/cotato/cokerthon/domain/auth/service/AuthService.javasrc/main/java/com/cotato/cokerthon/domain/city/config/CityDataInitializer.javasrc/main/java/com/cotato/cokerthon/domain/companion/dto/response/CompanionResponse.javasrc/main/java/com/cotato/cokerthon/domain/companion/service/CompanionService.javasrc/main/java/com/cotato/cokerthon/domain/member/dto/response/MemberResponse.javasrc/main/java/com/cotato/cokerthon/domain/member/service/MemberService.javasrc/test/java/com/cotato/cokerthon/domain/companion/CompanionIntegrationTest.javasrc/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.javasrc/test/java/com/cotato/cokerthon/domain/sleep/SleepJetlagIntegrationTest.java
Summary
city=서울,jetlagMinutes=0,direction=SAME)Test plan
./gradlew build전체 통과Closes #10
Summary by CodeRabbit