Skip to content

feat: default to Seoul for members without travel record and merge PM city data - #11

Merged
hamtorygoals merged 1 commit into
developfrom
feat/default-seoul-and-city-data
Jul 10, 2026
Merged

feat: default to Seoul for members without travel record and merge PM city data#11
hamtorygoals merged 1 commit into
developfrom
feat/default-seoul-and-city-data

Conversation

@hamtorygoals

@hamtorygoals hamtorygoals commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 수면시차 계산 기록이 없는 회원/동행자는 서울을 기본 위치로 표시 (city=서울, jetlagMinutes=0, direction=SAME)
  • PM이 정리한 국가별 대표 도시 리스트를 기존 City 데이터 포맷 그대로 병합 (26개 → 58개), 새로 생긴 시차 구간에 맞춰 매핑 경계 재계산

Test plan

  • ./gradlew build 전체 통과
  • 새로 생긴 tie(뉴델리/콜롬보, 베이징/싱가포르/타이베이 등) 반영해 기존 시나리오 테스트 갱신
  • 랜덤 매칭 안정성 확인을 위해 테스트 반복 실행

Closes #10

Summary by CodeRabbit

  • New Features
    • Member and companion responses now include Seoul as the default city when no jet-lag calculation exists.
    • Default values are provided: 0 minutes, “0분,” and “SAME” direction.
    • City data coverage has been expanded and refreshed for improved travel matching.
  • Bug Fixes
    • Signup and companion/member lookups now report an error when required city data is unavailable.
  • Tests
    • Updated integration coverage for default city details and expanded city-matching scenarios.

@hamtorygoals hamtorygoals linked an issue Jul 10, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

City 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 CityRepository, and integration tests cover default responses and expanded tie cases.

Changes

City defaults and mapping

Layer / File(s) Summary
Expanded city seed mappings
src/main/java/com/cotato/cokerthon/domain/city/config/CityDataInitializer.java
West and east representative-city lists, UTC offsets, ordering, and gap boundaries are updated.
Default response contracts
src/main/java/com/cotato/cokerthon/domain/member/dto/response/MemberResponse.java, src/main/java/com/cotato/cokerthon/domain/companion/dto/response/CompanionResponse.java
Response factories accept Seoul and return Seoul, 0, "0분", and SAME when no jetlag result exists.
Service city resolution
src/main/java/com/cotato/cokerthon/domain/auth/service/AuthService.java, src/main/java/com/cotato/cokerthon/domain/member/service/MemberService.java, src/main/java/com/cotato/cokerthon/domain/companion/service/CompanionService.java
Signup, member, and companion flows inject CityRepository, resolve the base city, and pass it to response factories.
Integration validation
src/test/java/com/cotato/cokerthon/domain/companion/CompanionIntegrationTest.java, src/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.java, src/test/java/com/cotato/cokerthon/domain/sleep/SleepJetlagIntegrationTest.java
Tests cover Seoul defaults and accept newly possible city matches from expanded tie mappings.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the Seoul default behavior and PM city-data merge.
Linked Issues check ✅ Passed The code updates member/companion responses, signup, city seed data, and tests to match issue #10 requirements.
Out of Scope Changes check ✅ Passed The changes stay focused on default Seoul handling, city data expansion, and the related tests.
✨ 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 feat/default-seoul-and-city-data

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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

@hamtorygoals hamtorygoals self-assigned this Jul 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
src/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.java (1)

28-42: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Missing assertion for jetlagLabel default 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 win

Missing assertion for jetlagLabel default value.

The PR objectives explicitly require jetlagLabel="0분" for the no-history default, but this test only checks cityNameKr, jetlagMinutes, direction, and lastRecordedAt.

✅ 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 win

Duplicate getBaseCity lookup logic across three services.

The same cityRepository.findByDirection(CityDirection.BASE).orElseThrow(...) block is repeated verbatim in CompanionService.getSeoul() and MemberService.getSeoul(). Consider extracting this into a shared component (e.g. a BaseCityProvider/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

📥 Commits

Reviewing files that changed from the base of the PR and between 043e55b and 4406524.

📒 Files selected for processing (9)
  • src/main/java/com/cotato/cokerthon/domain/auth/service/AuthService.java
  • src/main/java/com/cotato/cokerthon/domain/city/config/CityDataInitializer.java
  • src/main/java/com/cotato/cokerthon/domain/companion/dto/response/CompanionResponse.java
  • src/main/java/com/cotato/cokerthon/domain/companion/service/CompanionService.java
  • src/main/java/com/cotato/cokerthon/domain/member/dto/response/MemberResponse.java
  • src/main/java/com/cotato/cokerthon/domain/member/service/MemberService.java
  • src/test/java/com/cotato/cokerthon/domain/companion/CompanionIntegrationTest.java
  • src/test/java/com/cotato/cokerthon/domain/member/MemberIntegrationTest.java
  • src/test/java/com/cotato/cokerthon/domain/sleep/SleepJetlagIntegrationTest.java

@hamtorygoals
hamtorygoals merged commit 8c1adad into develop Jul 10, 2026
4 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.

미여행자 서울 기본값 처리 + PM 도시 리스트 병합

1 participant