Skip to content

Conversation

@l5x5l
Copy link
Contributor

@l5x5l l5x5l commented Feb 1, 2026

[ PR Content ]

도메인 모듈 내 날자/시간 관련된 클래스를 LocalDate, LocalTime 기반으로 통일합니다.
도메인 모듈 내 공통적으로 사용되는 BitnagilError 클래스의 경로를 common/model으로 이동합니다.

Related issue

Screenshot 📸

x

Work Description

  • 도메인 모듈 내에서 사용하는 날자/시간 클래스를 LocalDate/LocalTime으로 통일
  • BitnagilError클래스의 경로를 domain/common 로 수정

To Reviewers 📢

  • BitnagilError 클래스의 경로를 domain/common/error 로 하고자 하였으나, 도메인 모듈 내 타 패키지의 model 폴더에서 별도의 하위 폴더 없이 바로 클래스를 배치하고 있어 domain/common 에 배치했습니다
  • 궁금한 점 있으시면 코멘트 부탁드립니다!

Summary by CodeRabbit

  • 리팩토링
    • 루틴 생성/수정 및 표시에서 날짜·시간 처리를 플랫폼 표준(java.time)으로 전환하여 안정성과 일관성을 높였습니다.
    • 뷰모델과 표시 모델의 시간/날짜 파싱·포맷 흐름을 정비했습니다.
  • 기타
    • 오류 모델 경로 변경 등 내부 네임스페이스 정리를 수행했습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@l5x5l l5x5l self-assigned this Feb 1, 2026
@l5x5l l5x5l added the 🔨 Refactor 기존 기능 개선 label Feb 1, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

Walkthrough

도메인 내 Time/Date 클래스를 Java 8의 LocalTime/LocalDate로 통일하고, BitnagilError의 패키지를 domain.common.model로 이동했습니다. 관련 인터페이스, 저장소 구현, 유스케이스, 프레젠테이션 변환 로직과 뷰모델에서 타입 및 import를 업데이트했습니다.

개요

날짜/시간 도메인 클래스(Time, Date)를 Java 8의 LocalTime, LocalDate로 통일하고, BitnagilError를 domain.common 패키지로 이동하는 대규모 리팩토링. 저장소 계층, 도메인 계층, 프레젠테이션 계층 전반에 걸쳐 타입 및 import 경로 업데이트.

Changes

Cohort / File(s) Summary
도메인 - 클래스 제거
domain/.../writeroutine/model/Time.kt, domain/.../writeroutine/model/Date.kt, domain/.../writeroutine/model/Routine.kt
도메인 전용 Time, Date, Routine 데이터 클래스 삭제(검증 로직 및 toFormattedString() 제거).
도메인 - 공통 패키지 이동
domain/.../common/model/BitnagilError.kt, data/.../common/SafeApiCall.kt
BitnagilError 패키지 경로를 domain.common.model로 변경; 관련 import 경로 수정(동작 변경 없음).
도메인 인터페이스 변경
domain/.../writeroutine/repository/WriteRoutineRepository.kt
registerRoutineeditRoutine 시그니처에서 TimeLocalTime, DateLocalDate로 변경 (공개 API 타입 변경).
데이터 레이어 구현 변경
data/.../writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt
레포지토리 구현에서 파라미터 타입을 Java time으로 변경하고 요청에 사용되는 날짜/시간 포맷을 toString()으로 사용하도록 수정.
도메인 유스케이스 변경
domain/.../writeroutine/usecase/RegisterRoutineUseCase.kt, domain/.../writeroutine/usecase/EditRoutineUseCase.kt
유스케이스 invoke() 시그니처와 내부 호출을 LocalTime/LocalDate로 전환.
프레젠테이션 모델 변경
presentation/.../writeroutine/model/Time.kt, presentation/.../writeroutine/model/Date.kt
파서/변환 API 이름 및 반환 타입 변경: fromDomainTimeStringfromString, toDomainTimetoLocalTime, toDomainDatetoLocalDate 등; now/checkInRange 로직을 LocalDate 기반으로 조정.
프레젠테이션 뷰모델 변경
presentation/.../writeroutine/WriteRoutineViewModel.kt
루틴 등록/수정 흐름에서 변환 호출을 새 API로 변경(로컬 LocalDate/LocalTime 사용).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

나는 작은 토끼, 코드밭을 뛰놀며 🐰
Time과 Date를 정리하고 Local을 불러왔네.
BitnagilError는 집을 옮겼지, common에 둥지.
코드는 가벼워졌고 타입은 단정해,
리팩토링 축하해 — 당근 한 조각 어때? 🥕

🚥 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
Title check ✅ Passed PR 제목은 도메인 모듈 내 클래스 정리라는 주요 변경사항을 명확하게 요약하고 있습니다.
Description check ✅ Passed PR 설명은 템플릿의 주요 섹션(Related issue, Work Description, To Reviewers)을 포함하고 있으며, 변경사항을 명확하게 기술하고 있습니다.
Linked Issues check ✅ Passed PR은 linked issue #169의 모든 코딩 요구사항을 충족합니다: (1) LocalDate/LocalTime 통일 [#169], (2) BitnagilError를 domain/common으로 이동 [#169].
Out of Scope Changes check ✅ Passed 모든 변경사항이 issue #169의 목표 범위 내에 있으며, 관련 없는 변경사항은 없습니다.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/domain_module_class

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

@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: 2

🤖 Fix all issues with AI agents
In
`@presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/Date.kt`:
- Around line 53-63: fromString() can produce invalid Date instances that cause
LocalDate.of(...) in toLocalDate() / checkInRange() to throw DateTimeException;
fix by validating input and handling construction failures: in fromString() (the
factory/parser) verify the split has exactly 3 parts, parse year/month/day with
safe integer parsing, then either (a) validate month in 1..12 and day in 1..31
and attempt to build a LocalDate inside a try/catch to catch DateTimeException,
or (b) return a nullable/Result/throw a clear IllegalArgumentException on
invalid parse so callers know creation failed. Also consider making
toLocalDate() either handle DateTimeException (wrap and rethrow with context) or
return LocalDate? / optional to avoid unexpected runtime crashes; ensure
checkInRange() uses the validated/constructed LocalDate only after successful
creation.
- Around line 14-18: In the Date.now() factory function, avoid calling
LocalDate.now() three times; instead call LocalDate.now() once, store the result
in a local val (e.g., now) and extract year/month/day from that single instance
so year/month/day can't come from different dates; update the companion/object
function Date.now to use the single captured LocalDate.

@l5x5l l5x5l requested a review from wjdrjs00 February 1, 2026 10:14
Copy link
Member

@wjdrjs00 wjdrjs00 left a comment

Choose a reason for hiding this comment

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

LGTM~👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 기존 기능 개선

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 도메인 모듈 내 클래스 정리

3 participants