Skip to content

[πŸš€ 사이클2 - λ―Έμ…˜ (μ˜ˆμ•½ λ³€κ²½/μ·¨μ†Œμ™€ μ—λŸ¬ 처리)] 무빙 λ―Έμ…˜ μ œμΆœν•©λ‹ˆλ‹€.#432

Open
mvg01 wants to merge 112 commits into
woowacourse:mvg01from
mvg01:step2-pr
Open

[πŸš€ 사이클2 - λ―Έμ…˜ (μ˜ˆμ•½ λ³€κ²½/μ·¨μ†Œμ™€ μ—λŸ¬ 처리)] 무빙 λ―Έμ…˜ μ œμΆœν•©λ‹ˆλ‹€.#432
mvg01 wants to merge 112 commits into
woowacourse:mvg01from
mvg01:step2-pr

Conversation

@mvg01
Copy link
Copy Markdown

@mvg01 mvg01 commented May 13, 2026

κ°œμš”

μ•ˆλ…•ν•˜μ„Έμš” κΈ°λ‘ , 리뷰이 λ¬΄λΉ™μž…λ‹ˆλ‹€.

μ΄λ²ˆμ—λ„ 리뷰 핑퐁 기간을 μΆ©λΆ„νžˆ ν™•λ³΄ν•˜λ €κ³  "일단 λ™μž‘ν•˜λŠ” κ΅¬ν˜„"을 μš°μ„ ν•΄μ„œ λΉ λ₯΄κ²Œ PR을 μ˜¬λ ΈμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‹€ λ³΄λ‹ˆ 이전 λ―Έμ…˜λ³΄λ‹€ μ½”λ“œ 일관성이 λ–¨μ–΄μ§€λŠ” 뢀뢄이 μžˆμ„ 것 κ°™μŠ΅λ‹ˆλ‹€.

이번 리뷰의 λͺ©ν‘œλŠ”, λ‹€μŒ λ―Έμ…˜μ—μ„œ νŽ˜μ–΄κ°€ 제 μ½”λ“œλ₯Ό 읽고 μ˜λ„λ₯Ό λΉ λ₯΄κ²Œ νŒŒμ•…ν•  수 μžˆλŠ” μˆ˜μ€€κΉŒμ§€ λŒμ–΄μ˜¬λ¦¬λŠ” κ²ƒμž…λ‹ˆλ‹€. κ°œλ…μ μœΌλ‘œ κΆκΈˆν•œ 뢀뢄은 μ•„λž˜μ—, μ½”λ“œ λ‹¨μœ„μ—μ„œ κΆκΈˆν•œ 뢀뢄은 인라인 μ½”λ©˜νŠΈλ‘œ λ‚¨κ²¨λ‘μ—ˆμŠ΅λ‹ˆλ‹€.

이번 리뷰도 잘 λΆ€νƒλ“œλ¦½λ‹ˆλ‹€. κ°μ‚¬ν•©λ‹ˆλ‹€!

체크 리슀트

  • λ―Έμ…˜μ˜ ν•„μˆ˜ μš”κ΅¬μ‚¬ν•­μ„ λͺ¨λ‘ κ΅¬ν˜„ν–ˆλ‚˜μš”?
  • Gradle testλ₯Ό μ‹€ν–‰ν–ˆμ„ λ•Œ, λͺ¨λ“  ν…ŒμŠ€νŠΈκ°€ μ •μƒμ μœΌλ‘œ ν†΅κ³Όν–ˆλ‚˜μš”?
  • μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ μ •μƒμ μœΌλ‘œ μ‹€ν–‰λ˜λ‚˜μš”?

베이슀 μ½”λ“œ 선택 체크

  • 이전 λ―Έμ…˜μ˜ λ‚΄ μ½”λ“œμ—μ„œ μ‹œμž‘
  • 이전 λ―Έμ…˜μ˜ νŽ˜μ–΄μ˜ μ½”λ“œμ—μ„œ μ‹œμž‘

μ–΄λ–€ 뢀뢄에 μ§‘μ€‘ν•˜μ—¬ 리뷰해야 ν• κΉŒμš”?

1. mockData.sql에 λŒ€ν•œ ν…ŒμŠ€νŠΈ μ˜μ‘΄μ„±

μ§„ν–‰ν•˜λ‹€ λ³΄λ‹ˆ 컨트둀러 ν…ŒμŠ€νŠΈλ“€μ΄ mockData.sql에 κ°•ν•˜κ²Œ μ˜μ‘΄ν•˜κ²Œ λœλ‹€λŠ” κ±Έ λŠκΌˆμŠ΅λ‹ˆλ‹€. λ‹€μ–‘ν•œ μΌ€μ΄μŠ€λ₯Ό ν…ŒμŠ€νŠΈν•˜κΈ° μœ„ν•΄ mockData.sql에 데이터λ₯Ό μΆ”κ°€ν•˜λ©΄, κ·Έλ•Œλ§ˆλ‹€ κΈ°μ‘΄ ν…ŒμŠ€νŠΈλ“€μ΄ κΉ¨μ§€κ³€ ν–ˆμŠ΅λ‹ˆλ‹€. mockData.sql을 μˆ˜μ •ν•˜λŠ” 게 λ‘λ €μ›Œμ§ˆ μ •λ„μ˜€μŠ΅λ‹ˆλ‹€. 이 데이터가 λ°”λ€Œμ–΄λ„ ν…ŒμŠ€νŠΈκ°€ μžμ—°μŠ€λŸ½κ²Œ λ”°λΌκ°ˆ 수 μžˆλŠ” 방법이 μžˆμ„κΉŒμš”? 이 λΆˆνŽΈν•¨μ„ ν•΄κ²°ν•˜λŠ” λ°©λ²•λ‘ μ΄λ‚˜ 도ꡬ가 μžˆμ„ 것 같은데, μ§€κΈˆ μ‹œμ μ—μ„  잘 λͺ¨λ₯΄κ² μŠ΅λ‹ˆλ‹€.

2. ErrorCode Enum ν™œμš©

ν† λ‘  쑰원듀과 ν•¨κ»˜ μ˜ˆμ™Έ 응닡에 λ‹΄κΈΈ λ‚΄μš©μ„ μ •μ˜ν–ˆκ³ , μ•„λž˜ ν˜•μ‹μ„ λ”°λžμŠ΅λ‹ˆλ‹€.

μ—λŸ¬ 응닡 ν˜•μ‹ (ν† λ‘  κ·Έλ£Ήμ—μ„œ μ •ν•œ ν˜•μ‹)

{
  "code": "μ—λŸ¬_μ½”λ“œ",
  "path": "/μš”μ²­_URI",
  "message": "μ‚¬μš©μžμ—κ²Œ 보여쀄 λ©”μ‹œμ§€",
  "action": "ν•΄κ²° 방법 μ•ˆλ‚΄ (μ—†μœΌλ©΄ null)"
}

이 νŒλ‹¨μ΄ 정닡인지 μ•„λ‹Œμ§€λŠ” κ³ λ €ν•˜μ§€ μ•Šμ•˜κ³ , 각자의 값이 ν•„μš”ν•˜λ‹€κ³  μƒκ°ν•œ μ΄μœ λŠ” λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.

  1. code: ν”„λ‘ νŠΈμ—μ„œ μ˜ˆμ™Έλ₯Ό μ‰½κ²Œ λΆ„κΈ°ν•  수 있게 ν•˜κΈ° μœ„ν•΄μ„œ μ œκ³΅ν•©λ‹ˆλ‹€.
  2. path: μ˜ˆμ™Έκ°€ λ°œμƒν•œ URI
  3. message: ν”„λ‘ νŠΈλž‘ ν΄λΌμ΄μ–ΈνŠΈμ—κ²Œ μžμ—°μ–΄λ‘œ 전달할 μƒμ„Έν•œ μ„€λͺ…
  4. action: κ·Έλž˜μ„œ 이 μ—λŸ¬λ₯Ό ν•΄κ²°ν•˜κΈ° μœ„ν•΄ ν”„λ‘ νŠΈ ν˜Ήμ€ ν΄λΌμ΄μ–ΈνŠΈκ°€ 무엇을 해야할지에 λŒ€ν•œ μ„€λͺ… (nullable)

그리고 μ½”λ“œλ₯Ό μž‘μ„±ν•˜κΈ° 전에 직접 μ΄λŸ°μ‹μœΌλ‘œ μš”μ²­μ— λŒ€ν•˜μ—¬ λ°œμƒν•  수 μžˆλŠ” μ˜ˆμ™Έ 상황을 미리 μ •λ¦¬ν•΄λ΄€μŠ΅λ‹ˆλ‹€.
image

  • μ½”λ“œ μž‘μ„± 전에 λ°œμƒ κ°€λŠ₯ν•œ μ˜ˆμ™Έ 상황을 미리 μ •λ¦¬ν•΄λ‘μ—ˆκ³ , ν•΄λ‹Ή λ‚΄μš©μ€ study-log/error-design.md에 κΈ°λ‘ν•΄λ‘μ—ˆμŠ΅λ‹ˆλ‹€.

    • 이런 λ°©μ‹μœΌλ‘œ μ—λŸ¬ 응닡을 ν†΅μΌν•˜λŠ” 게 μ μ ˆν•œμ§€ κΆκΈˆν•©λ‹ˆλ‹€. μ–΄λ–€ 뢀뢄이 λΆ€μ‘±ν•˜κ±°λ‚˜ κ³Όν•œμ§€ ν”Όλ“œλ°± λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.
  • κ΅¬ν˜„ν•˜λ©΄μ„œ λŠλ‚€ λΆˆνŽΈν•œ 점도 μžˆμ—ˆμŠ΅λ‹ˆλ‹€. ErrorCode Enum에 미리 μ„ μ–Έν•΄μ•Ό ν•˜λŠ” ν•­λͺ©μ΄ λ§Žμ•„μ§ˆμˆ˜λ‘ 클래슀 자체의 가독성이 λ–¨μ–΄μ§„λ‹€κ³  λŠκΌˆμŠ΅λ‹ˆλ‹€. μ»€μŠ€ν…€ μ˜ˆμ™Έ ꡬ쑰도 제 νŒλ‹¨λŒ€λ‘œ 자유둭게 μ„€κ³„ν•œ 것이라 μ μ ˆν•œμ§€ 확신이 μ—†μŠ΅λ‹ˆλ‹€.

    • ErrorCodeλ₯Ό Enum으둜 κ΄€λ¦¬ν•˜λŠ” 것보닀 더 λ‚˜μ€ ꡬ쑰가 μžˆλ‹€λ©΄ μ•Œκ³  μ‹ΆμŠ΅λ‹ˆλ‹€.

K-iise and others added 30 commits May 4, 2026 14:42
- μ‚­μ œμ—μ„œ μ—†λŠ” ID μž…λ ₯ μ‹œ μ˜ˆμ™Έμ²˜λ¦¬ 제거
- reservaiton ν…Œμ΄λΈ” μ‚½μž… ν›„ 도메인을 λ°˜ν™˜ν•˜κΈ° μœ„ν•΄ joinν•˜λŠ” 과정을 μ œκ±°ν•¨.
- ReservationServiceμ—μ„œ λ‹€λ₯Έ Serviceλ₯Ό μ˜μ‘΄ν•˜λ„λ‘ 변경함.
- ReservationRepository에 λ‹€λ₯Έ service의 response 값을 전달함.
- μ˜ˆμ•½ ν…Œλ§ˆ μ‚­μ œ μ‹œ CASCADE
- μ˜ˆμ•½ μ‹œκ°„ μ‚­μ œ μ‹œ RESTRICT
mvg01 added 25 commits May 12, 2026 17:37
- 이미 μ‘΄μž¬ν•˜λŠ” μ‹œκ°„μ— λŒ€ν•΄μ„œλ„ μ»€μŠ€ν…€ μ—λŸ¬ 응닡 λ°˜ν™˜
- 이미 μ§€λ‚œ μ‹œκ°„μ˜ μ˜ˆμ•½ μˆ˜μ • λ°©μ§€
- 이미 μ§€λ‚œ μ‹œκ°„μœΌλ‘œμ˜ μ˜ˆμ•½ μˆ˜μ • λ°©μ§€
Copy link
Copy Markdown

@Gyuchool Gyuchool left a comment

Choose a reason for hiding this comment

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

μ•ˆλ…•ν•˜μ„Έμš” 무빙!
λΉ λ₯΄κ²Œ κ΅¬ν˜„ν•΄μ£Όμ…¨λ„€μš”πŸ‘ λ‹€λ§Œ, λ‚΄ μ˜ˆμ•½μ„ μ‚­μ œν–ˆλŠ”λ° μ˜ˆμ•½κ΄€λ¦¬μ—λŠ” κ·ΈλŒ€λ‘œ μžˆλŠ”λ° 이뢀뢄 ν™•μΈλΆ€νƒλ“œλ¦΄κ»˜μš”!

Image Image

λ§ˆμ§€λ§‰ 사이클2도 νŒŒμ΄νŒ…μž…λ‹ˆλ‹€πŸ’ͺ

λͺ‡ κ°€μ§€ μ½”λ©˜νŠΈλ₯Ό λ‚¨κ²¨λ‘μ—ˆμœΌλ‹ˆ 반영 및 의견 μ£Όμ‹œλ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€.πŸ™
κΆκΈˆν•œ 점은 DMμ΄λ‚˜ PR 컀멘트둜 μ–Έμ œλ“ μ§€ μ—¬μ­€λ΄μ£Όμ„Έμš”!

mockData.sql에 λŒ€ν•œ ν…ŒμŠ€νŠΈ μ˜μ‘΄μ„±
μ§„ν–‰ν•˜λ‹€ λ³΄λ‹ˆ 컨트둀러 ν…ŒμŠ€νŠΈλ“€μ΄ mockData.sql에 κ°•ν•˜κ²Œ μ˜μ‘΄ν•˜κ²Œ λœλ‹€λŠ” κ±Έ λŠκΌˆμŠ΅λ‹ˆλ‹€.

μ˜μ‘΄μ„±μ΄ κ°•ν•΄μ§€λ©΄ μ–΄λ–»κ²Œ ν•΄κ²°ν•  수 μžˆμ„κΉŒμš”?πŸ™„ μ˜μ‘΄μ„±μ„ λŠμ–΄λ‚΄λ³ΌκΉŒμš”?

ErrorCode Enum ν™œμš©
이런 λ°©μ‹μœΌλ‘œ μ—λŸ¬ 응닡을 ν†΅μΌν•˜λŠ” 게 μ μ ˆν•œμ§€ κΆκΈˆν•©λ‹ˆλ‹€. μ–΄λ–€ 뢀뢄이 λΆ€μ‘±ν•˜κ±°λ‚˜ κ³Όν•œμ§€ ν”Όλ“œλ°± λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.
ErrorCodeλ₯Ό Enum으둜 κ΄€λ¦¬ν•˜λŠ” 것보닀 더 λ‚˜μ€ ꡬ쑰가 μžˆλ‹€λ©΄ μ•Œκ³  μ‹ΆμŠ΅λ‹ˆλ‹€.

μžμ„Έν•œ μ—λŸ¬ μ„€λͺ…을 ν•¨κ»˜ μ œκ³΅ν•΄μ£Όμ‹  점이 μ’‹λ„€μš” πŸ‘

λ‹€λ§Œ ν•œ κ°€μ§€ 더 κ³ λ―Όν•΄λ³Ό 뢀뢄은, μ‚¬μš©μžμ—κ²Œ ꡬ체적인 μ˜ˆμ™Έ λ‚΄μš©μ„ μ–΄λ””κΉŒμ§€ λ…ΈμΆœν•  것인가라고 μƒκ°ν•΄μš”. 예λ₯Ό λ“€μ–΄ 둜그인 κΈ°λŠ₯μ—μ„œ "λΉ„λ°€λ²ˆν˜Έκ°€ ν‹€λ ΈμŠ΅λ‹ˆλ‹€" λ˜λŠ” "λΉ„λ°€λ²ˆν˜ΈλŠ” 8자 이상이어야 ν•©λ‹ˆλ‹€"와 같이 μƒμ„Έν•œ 정보λ₯Ό μ œκ³΅ν•˜λ©΄, μ‚¬μš©μžμ—κ²ŒλŠ” μΉœμ ˆν•  수 μžˆμ§€λ§Œ κ³΅κ²©μžμ—κ²Œλ„ μœ μš©ν•œ 힌트λ₯Ό 쀄 수 μžˆλ‹€κ³  μƒκ°ν•΄μ„œμš”.

λ”°λΌμ„œ μ—λŸ¬ λ©”μ‹œμ§€λ₯Ό λˆ„κ΅¬μ—κ²Œ μ œκ³΅ν•˜λŠ”μ§€, 그리고 디버깅을 μœ„ν•œ 것인지 UX κ°œμ„ μ„ μœ„ν•œ 것인지 λ¨Όμ € λͺ…ν™•νžˆ ν•˜λŠ” 것이 μ€‘μš”ν•˜λ‹€κ³  μƒκ°ν•΄μš”. 이λ₯Ό λ°”νƒ•μœΌλ‘œ μ‚¬μš©μž νŽΈμ˜μ„±κ³Ό λ³΄μ•ˆ μ‚¬μ΄μ—μ„œ μ μ ˆν•œ μˆ˜μ€€μ˜ 정보λ₯Ό μ œκ³΅ν•˜λŠ” λ°©ν–₯으둜 고민해보면 쒋을것 κ°™λ„€μš”πŸ˜Š

λ˜ν•œ ErrorCode enum에 λͺ¨λ“  μ’…λ₯˜μ˜ μ˜ˆμ™Έλ₯Ό ν•œκ³³μ— λͺ¨μœΌκΈ° μ‹œμž‘ν•˜λ©΄ λΉ λ₯΄κ²Œ λ¬΄κ±°μ›Œμ§ˆ 수 μžˆμŠ΅λ‹ˆλ‹€. λ§Œμ•½ ErrorCodeλ₯Ό λͺ¨μ•„λ‘κΈ°λ‘œ ν•œλ‹€λ©΄ κ°œμΈμ μœΌλ‘œλŠ” λΉ„μ¦ˆλ‹ˆμŠ€ 둜직과 κ΄€λ ¨λœ 핡심 μ˜ˆμ™ΈλΆ€ν„° enum으둜 관리할 것 κ°™λ„€μš”.

this.date = date;
this.time = time;
this.theme = theme;
validateName(name);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

validateλ₯Ό λ§¨μ•„λž˜λ‘œ λ‚΄λ¦° μ΄μœ κ°€ μžˆμ„κΉŒμš”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

이전 μ‚¬μ΄ν΄μ—μ„œ ν–ˆλ˜ μ‹€μˆ˜μ˜ μž”μž¬κ°€ λ‚¨μ•„μžˆμ—ˆλ„€μš”!! λ°˜μ˜ν•˜κ² μŠ΅λ‹ˆλ‹€.

private final LocalDate date;
private final ReservationTime time;
private final Theme theme;
public record Reservation(Long id, String name, LocalDate date, ReservationTime time, Theme theme) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

record둜 λ°”κΎΌ μ΄μœ κ°€ μžˆμ„κΉŒμš”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

객체 μžμ²΄κ°€ 변경될 μ—¬μ§€κ°€ μ—†λ‹€κ³  νŒλ‹¨ν•΄μ„œ μž…λ‹ˆλ‹€. λ§ˆμ°¬κ°€μ§€λ‘œ ReservationTime도 record인데 μ„œλΉ„μŠ€ λ‘œμ§μ΄λ‚˜ 생λͺ…μ£ΌκΈ°μ—μ„œ 변경될 μ—¬μ§€κ°€ μ—†μ—ˆμŠ΅λ‹ˆλ‹€.

ν•˜μ§€λ§Œ java record의 의미λ₯Ό λ‹€μ‹œ μ‚΄νŽ΄λ³΄λ‹ˆ μˆœμˆ˜ν•˜κ²Œ 데이터λ₯Ό λ‹΄λŠ” λͺ©μ μ—λ§Œ μ΅œμ ν™”λœ 클래슀라고 ν•©λ‹ˆλ‹€. μ €λŠ” λ”±νžˆ 이런 의미λ₯Ό λͺ°λžμ–΄μ„œ, λ‹¨μˆœνžˆ λ³΄μΌλŸ¬ν”Œλ ˆμ΄νŠΈ μ½”λ“œλ₯Ό 쀄이기 μœ„ν•΄μ„œ μ‚¬μš©ν–ˆλ˜ 것 κ°™μŠ΅λ‹ˆλ‹€.

λ˜ν•œ 도메인에 λΉ„μ¦ˆλ‹ˆμŠ€ λ‘œμ§λ„ λ‹΄κ²¨μžˆμœΌλ‹ˆ, record보단 classκ°€ μ ν•©ν•˜λ‹€κ³  νŒλ‹¨λ©λ‹ˆλ‹€. μˆ˜μ •ν•΄μ„œ λ°˜μ˜ν•˜κ² μŠ΅λ‹ˆλ‹€.

Comment on lines -11 to -12
private static void validateName(String name) {
if (name.isBlank() || name.length() > MAX_THEME_LENGTH) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

requestμ—μ„œ validλ₯Ό μ œκ±°ν•œ μ΄μœ κ°€ μžˆμ„κΉŒμš”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

requestμ—μ„œ validateλ₯Ό μ œκ±°ν•œ μ΄μœ λŠ”, DTOλŠ” λ°μ΄ν„°μ˜ 이동/λ³€ν™˜ μ±…μž„λ§Œ λ‹΄λ‹Ήν•΄μ•Ό ν•œλ‹€κ³  νŒλ‹¨ν–ˆκΈ° λ•Œλ¬Έμž…λ‹ˆλ‹€.

검증 μœ„μΉ˜λŠ” 두 κ³³μž…λ‹ˆλ‹€.

  • Service: ν•„λ“œ μžμ²΄κ°€ null인지(μž…λ ₯값이 μ•„μ˜ˆ μ•ˆ λ“€μ–΄μ˜¨ μƒνƒœμΈμ§€)
  • Model: 값이 μžˆλ”λΌλ„ 도메인 κ·œμΉ™μƒ μœ νš¨ν•˜μ§€ μ•Šμ€ 경우(blank, 길이 초과, μž…λ ₯κ°’ κ·Έ μžμ²΄κ°€ μœ νš¨ν•œμ§€)

μΆ”κ°€λ‘œ λ„λ©”μΈμ—μ„œμ˜ κ²€μ¦μ˜ 기쀀은, Repositoryμ—μ„œ 도메인 객체λ₯Ό λ§Œλ“œλŠ” 과정이 있기 λ•Œλ¬Έμ— 도메인 슀슀둜 μžμ‹ μ˜ κ°’ 경계λ₯Ό 보μž₯ν•΄μ•Ό ν•œλ‹€κ³  νŒλ‹¨ν–ˆμŠ΅λ‹ˆλ‹€.


public boolean existsByDateAndTimeIdAndThemeId(LocalDate date, Long timeId, Long themeId) {
String sql = "SELECT COUNT(*) FROM reservation WHERE date = ? AND time_id = ? AND theme_id = ?";
String sql = "SELECT COUNT(id) FROM reservation WHERE date = ? AND time_id = ? AND theme_id = ?";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

idκ°€ 듀어간것과 *κ°€ λ“€μ–΄κ°„κ²ƒμ˜ 차이가 μžˆμ„κΉŒμš”? idλ₯Ό μΉ΄μš΄νŠΈν•˜λ„λ‘ λ°”κΎΌ μ΄μœ κ°€ μžˆμ„κΉŒμš”?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이전에 SELECT * μ‚¬μš©μ— λŒ€ν•œ 리뷰의 영ν–₯으둜 λ³€κ²½ν•˜μ‹  것이라면, COUNT(*)μ—μ„œ μ‚¬μš©λœ *κ°€ μ–΄λ–€ 의미λ₯Ό κ°€μ§€λŠ”μ§€λ„ ν•œ 번 μƒκ°ν•΄λ³΄μ‹œλ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.

μ œκ°€ λ“œλ¦° 리뷰의 μ˜λ„λŠ” λͺ¨λ“  SQLμ—μ„œ *λ₯Ό μ‚¬μš©ν•˜λ©΄ μ•ˆ λœλ‹€λŠ” λœ»μ€ μ•„λ‹ˆμ—ˆμ–΄μš”! SELECT 와 COUNT()의 *λŠ” μ—­ν• κ³Ό μ˜λ―Έκ°€ μ„œλ‘œ λ‹€λ₯΄κΈ° λ•Œλ¬Έμ— λ‹€μ‹œ μƒκ°ν•΄λ³΄μ‹œμ£ !

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

COUNT(*)은 ν–‰ 개수λ₯Ό μ²΄ν¬ν•˜λŠ” 의미라 μ§€κΈˆ μ½”λ“œμ—μ„  사싀 λ¬Έμ œμ—†μ΄ μ‚¬μš©ν•  순 μžˆμŠ΅λ‹ˆλ‹€. ν•˜μ§€λ§Œ COUNT(id)λŠ” idκ°€ null이 μ•„λ‹Œ 행을 μ„Έμ£ΌλŠ” 것이기 λ•Œλ¬Έμ— μ˜λ―Έκ°€ μ•½κ°„ λ‹¬λžμŠ΅λ‹ˆλ‹€. 였히렀 COUNT(*) 이 μœ μ§€κ°€ 더 λ‚˜μ„ 것 κ°™μ•„μ„œ κ·Έλ ‡κ²Œ μˆ˜μ •ν•˜κ² μŠ΅λ‹ˆλ‹€!

Comment on lines +69 to +78
private void reservationRequestDayCheck(LocalDate date, ReservationTime time) {
if (date.isBefore(LocalDate.now())) {
throw new RoomescapeException(ErrorCode.RESERVATION_WRONG_DATE);
}
if (date.isEqual(LocalDate.now())) {
if (time.startAt().getHour() <= LocalTime.now().getHour()) {
throw new RoomescapeException(ErrorCode.RESERVATION_WRONG_TIME);
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

항상 같은 κΈ°μ€€ μ‹œμ μœΌλ‘œ λΉ„κ΅λœλ‹€κ³  λ³Ό 수 μžˆμ„κΉŒμš”?

예λ₯Ό λ“€μ–΄ λ‚ μ§œλ₯Ό λΉ„κ΅ν•˜λŠ” μˆœκ°„κ³Ό μ‹œκ°„μ„ λΉ„κ΅ν•˜λŠ” μˆœκ°„ 사이에 μ‹œκ°„μ΄ μ•„μ£Ό μ‘°κΈˆμ΄λΌλ„ 흐λ₯Έλ‹€λ©΄, 이 λ‘œμ§μ€ ν•˜λ‚˜μ˜ λ™μΌν•œ β€œν˜„μž¬ μ‹œκ°β€μ„ κΈ°μ€€μœΌλ‘œ νŒλ‹¨ν•œλ‹€κ³  말할 수 μžˆμ„μ§€ 고민해보면 μ’‹κ² μŠ΅λ‹ˆλ‹€.

Comment on lines +80 to +81
private void reservationRequestValidate(ReservationRequest reservationRequest) {
if (reservationRequest.name() == null) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

request에 λŒ€ν•œ validation인데 null만 κ²€μ‚¬ν•˜λŠ” μ΄μœ κ°€ μžˆμ„κΉŒμš”?

PRIMARY KEY (id),
FOREIGN KEY (time_id) REFERENCES reservation_time (id),
FOREIGN KEY (theme_id) REFERENCES theme (id)
FOREIGN KEY (theme_id) REFERENCES theme (id) ON DELETE CASCADE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CASCADEλ₯Ό κ±°μ‹  μ΄μœ κ°€ μžˆμ„κΉŒμš”? μ–΄λ–€ μž₯단점이 μžˆλ‚˜μš”?

reservation.time(), reservation.theme());
}

public boolean existsByDateAndTimeIdAndThemeId(LocalDate date, Long timeId, Long themeId) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

같은 date, timeId, themeIdλ₯Ό κ°€μ§€λ©΄ μ˜ˆμ•½μ„ λͺ»ν•˜λŠ” λ‘œμ§μΈκ±°κ°™μ€λ°, μ§€κΈˆμ€ λ™μ‹œμ— μš”μ²­μ΄ λ“€μ–΄μ˜€λ©΄ 생성이 κ°€λŠ₯ν•˜κ² λ„€μš”? μ–΄λ–»κ²Œ ν•΄κ²°ν•  수 μžˆμ„κΉŒμš”?

힌트: λ°μ΄ν„°λ² μ΄μŠ€


Assertions.assertThatThrownBy(() -> reservationService.register(reservationRequest))
.isInstanceOf(RoomescapeException.class);
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

μ—¬κΈ°μ„œ timeId=1L은 μ˜€μ „ 10μ‹œμž…λ‹ˆλ‹€. μ˜€μ „ 10μ‹œ 이전에 이 ν…ŒμŠ€νŠΈλ₯Ό 돌리면 정상 μ˜ˆμ•½ μš”μ²­μœΌλ‘œ κ°„μ£Όλ˜μ–΄ ν…ŒμŠ€νŠΈκ°€ μ‹€νŒ¨ν•˜κ³ , 이후라면 μ„±κ³΅ν•©λ‹ˆλ‹€. μƒˆλ²½μ— μž‘μ—…ν•΄λ„ μ‹€νŒ¨ν•  κ²ƒμž…λ‹ˆλ‹€..

"였늘 λ‚ μ§œμ΄λ©΄μ„œ 이미 μ§€λ‚œ μ‹œκ°„μ—λŠ” μ˜ˆμ•½/μˆ˜μ •μ΄ λΆˆκ°€λŠ₯ν•˜λ‹€"λŠ” μΌ€μ΄μŠ€λ₯Ό μ•ˆμ •μ μœΌλ‘œ ν…ŒμŠ€νŠΈν•˜λ €λ©΄ μ–΄λ–»κ²Œ ν•΄μ•Ό ν• μ§€ λͺ¨λ₯΄κ² μŠ΅λ‹ˆλ‹€. μ§€κΈˆμ²˜λŸΌ mockData.sql의 데이터λ₯Ό ν™œμš©ν•˜λŠ” μ‹μœΌλ‘œλŠ” λΆˆκ°€λŠ₯ν•œ κ²ƒμΌκΉŒμš”?

mvg01 added 3 commits May 14, 2026 13:28
- 정각 μ‹œκ°„ 정책은 도메인 검증보단 μ„œλΉ„μŠ€ 검증이 μ˜¬λ°”λ₯΄λ‹€κ³  νŒλ‹¨
- 잘λͺ»λœ κ°’ μ‚½μž… μ‹œ μ˜ˆμ™Έ, 쑰회 μ‹œ κ²½κ³  둜그둜 뢄리(μ˜ˆμ™ΈλŠ” μ•ˆν„°μ§)
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.

3 participants