Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #23

Merged
merged 4 commits into from
Nov 18, 2024
Merged

Develop #23

merged 4 commits into from
Nov 18, 2024

Conversation

HyunWoo9930
Copy link
Collaborator

@HyunWoo9930 HyunWoo9930 commented Nov 18, 2024

  • πŸ”€ PR 제λͺ©μ˜ ν˜•μ‹μ„ 잘 μž‘μ„±ν–ˆλ‚˜μš”? e.g. [feat] PR을 λ“±λ‘ν•œλ‹€.
  • πŸ’― ν…ŒμŠ€νŠΈλŠ” 잘 ν†΅κ³Όν–ˆλ‚˜μš”?
  • πŸ—οΈ λΉŒλ“œλŠ” μ„±κ³΅ν–ˆλ‚˜μš”?
  • 🧹 λΆˆν•„μš”ν•œ μ½”λ“œλŠ” μ œκ±°ν–ˆλ‚˜μš”?
  • πŸ’­ μ΄μŠˆλŠ” λ“±λ‘ν–ˆλ‚˜μš”?
  • 🏷️ 라벨은 λ“±λ‘ν–ˆλ‚˜μš”?

μž‘μ—… λ‚΄μš©

μ£Όμ˜μ‚¬ν•­

Summary by CodeRabbit

  • μƒˆλ‘œμš΄ κΈ°λŠ₯

    • μΆ”κ°€ 맀μž₯ 정보 μ €μž₯을 μœ„ν•œ μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈ 생성.
    • 맀μž₯ 정보 쑰회 둜직 κ°„μ†Œν™”: 이제 인증된 μ‚¬μš©μž 정보λ₯Ό 기반으둜 맀μž₯ 정보λ₯Ό κ°€μ Έμ˜΅λ‹ˆλ‹€.
    • 맀μž₯ μ˜ˆμ•½ μ„€μ • 및 결제 세뢀정보 μ—…λ°μ΄νŠΈλ₯Ό μœ„ν•œ μƒˆλ‘œμš΄ λ©”μ„œλ“œ μΆ”κ°€.
    • νŒ€ 등둝 κΈ°λŠ₯ μΆ”κ°€: μ‚¬μš©μžκ°€ νŒ€μ„ 생성할 수 μžˆλŠ” κΈ°λŠ₯ 제곡.
  • λ³€κ²½ 사항

    • 맀μž₯ 운영 μ‹œκ°„ 및 μš”μΌμ˜ 데이터 ꡬ쑰 κ°œμ„ .
    • DTO ν΄λž˜μŠ€μ—μ„œ μ˜ˆμ•½ κ΄€λ ¨ ν•„λ“œ 제거 및 데이터 νƒ€μž… λ³€κ²½.
    • νŒ€ κ΄€λ ¨ 데이터 ꡬ쑰 κ°œμ„ : νŒ€κ³Ό μ‚¬μš©μž κ°„μ˜ 관계λ₯Ό λͺ…ν™•νžˆ ν•˜κΈ° μœ„ν•œ ꡬ쑰 λ³€κ²½.
    • 인증 νŒŒμ„œμ—μ„œ μ‚¬μš©μž ID 처리 방식 λ³€κ²½: μ‚¬μš©μž IDλ₯Ό λ¬Έμžμ—΄λ‘œ λ°˜ν™˜ν•˜λ„λ‘ μˆ˜μ •.

Copy link

coderabbitai bot commented Nov 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

이 λ³€κ²½ 사항은 OAuthUserService, Store, StoreCreateRequestDTO, StoreGetResponseDTO, StoreUpdateRequestDTO, StoreAdditionalInfoCreateRequestDTO, StoreController, 및 StoreService 클래슀의 μ—¬λŸ¬ λ©”μ„œλ“œμ™€ 속성에 λŒ€ν•œ μˆ˜μ •μœΌλ‘œ κ΅¬μ„±λ©λ‹ˆλ‹€. OAuthUserServiceλŠ” μ‚¬μš©μž 생성 및 μ—­ν•  ν• λ‹Ή λ‘œμ§μ„ μ—…λ°μ΄νŠΈν–ˆμœΌλ©°, Store ν΄λž˜μŠ€λŠ” μ—¬λŸ¬ μš”μΌμ„ μ €μž₯ν•  수 μžˆλ„λ‘ 속성을 λ³€κ²½ν–ˆμŠ΅λ‹ˆλ‹€. μƒˆλ‘œμš΄ DTO ν΄λž˜μŠ€κ°€ μΆ”κ°€λ˜μ—ˆκ³ , κΈ°μ‘΄ DTO 클래슀의 ν•„λ“œ νƒ€μž…μ΄ λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ, μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈ 및 λ©”μ„œλ“œκ°€ μΆ”κ°€λ˜μ–΄ μ €μž₯μ†Œ 정보 처리 방식이 κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
src/main/java/com/jangburich/domain/oauth/domain/service/OAuthUserService.java loadUser λ©”μ„œλ“œμ—μ„œ μ‚¬μš©μž 쑴재 여뢀와 역할을 ν™•μΈν•˜λŠ” 쑰건을 μˆ˜μ •ν•˜μ—¬ μƒˆλ‘œμš΄ μ†Œμœ μž μ‚¬μš©μžλ₯Ό μƒμ„±ν•˜λ„λ‘ λ³€κ²½.
src/main/java/com/jangburich/domain/store/domain/Store.java dayOfWeek 속성을 List<DayOfWeek>둜 λ³€κ²½ν•˜κ³ , openTime 및 closeTime을 LocalTime으둜 λ³€κ²½. κ΄€λ ¨ μ• λ„ˆν…Œμ΄μ…˜ μΆ”κ°€.
src/main/java/com/jangburich/domain/store/domain/StoreCreateRequestDTO.java reservationAvailable, maxReservation, minPrepayment, prepaymentDuration ν•„λ“œλ₯Ό μ œκ±°ν•˜κ³ , dayOfWeekλ₯Ό List<DayOfWeek>둜, openTime 및 closeTime을 LocalTime으둜 λ³€κ²½.
src/main/java/com/jangburich/domain/store/domain/StoreGetResponseDTO.java dayOfWeek, openTime, closeTime ν•„λ“œλ₯Ό List<DayOfWeek>, LocalTime으둜 λ³€κ²½. μƒμ„±μž 및 of λ©”μ„œλ“œ μˆ˜μ •.
src/main/java/com/jangburich/domain/store/domain/StoreUpdateRequestDTO.java dayOfWeekλ₯Ό List<DayOfWeek>둜, openTime 및 closeTime을 LocalTime으둜 λ³€κ²½.
src/main/java/com/jangburich/domain/store/domain/StoreAdditionalInfoCreateRequestDTO.java μƒˆλ‘œμš΄ DTO 클래슀 μΆ”κ°€, μ˜ˆμ•½ κ΄€λ ¨ 정보λ₯Ό λ‹΄λŠ” ν•„λ“œ 포함.
src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java μƒˆλ‘œμš΄ λ©”μ„œλ“œ createAdditionalInfo μΆ”κ°€ 및 getStoreInfo λ©”μ„œλ“œμ—μ„œ storeIdλ₯Ό μ œκ±°ν•˜κ³  인증된 μ‚¬μš©μž 정보λ₯Ό μ‚¬μš©ν•˜μ—¬ μ €μž₯μ†Œ 정보λ₯Ό κ°€μ Έμ˜€λ„λ‘ λ³€κ²½.
src/main/java/com/jangburich/domain/store/domain/service/StoreService.java μƒˆλ‘œμš΄ λ©”μ„œλ“œ CreateAdditionalInfo μΆ”κ°€ 및 getStoreInfo λ©”μ„œλ“œμ—μ„œ storeId 제거, 인증된 μ‚¬μš©μžμ™€ μ—°κ²°λœ μ €μž₯μ†Œλ₯Ό 직접 κ°€μ Έμ˜€λ„λ‘ λ³€κ²½.

Poem

🐰 μƒˆλ‘œμš΄ λ³€ν™”κ°€ μ™”μ–΄μš”,
μ €μž₯μ†Œμ˜ 정보가 λ°μ•„μ‘Œμ£ .
μš”μΌκ³Ό μ‹œκ°„, 더 λͺ…ν™•ν•˜κ²Œ,
μ‚¬μš©μž 역할도 잘 μ •λ¦¬λ˜μ—ˆμ£ .
ν•¨κ»˜ 뛰어놀며 κΈ°λ»ν•΄μš”,
λ³€ν™”μ˜ μˆœκ°„μ„ μΆ•ν•˜ν•΄μš”! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

* feat: 결제 κΈ°λŠ₯ μš”κ΅¬μ‚¬ν•­ 반영

* feat: Team 도메인 μˆ˜μ • 및 일급 μ»¬λ ‰μ…˜ν™” (#3)

* feat: νŒ€ 생성 κΈ°λŠ₯ κ΅¬ν˜„ (#4)

* feat: Team 도메인 μˆ˜μ • 및 일급 μ»¬λ ‰μ…˜ν™”

* feat: νŒ€ 생성 κΈ°λŠ₯ κ΅¬ν˜„
@HyunWoo9930 HyunWoo9930 merged commit 995181c into main Nov 18, 2024
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: 5

🧹 Outside diff range and nitpick comments (9)
src/main/java/com/jangburich/domain/store/domain/StoreAdditionalInfoCreateRequestDTO.java (1)

1-15: 클래슀 λ¬Έμ„œν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

클래슀의 λͺ©μ κ³Ό 각 ν•„λ“œμ— λŒ€ν•œ μ„€λͺ…이 μ—†μ–΄ μ½”λ“œμ˜ 가독성과 μœ μ§€λ³΄μˆ˜μ„±μ΄ λ–¨μ–΄μ§‘λ‹ˆλ‹€.

Javadoc μΆ”κ°€λ₯Ό μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

+/**
+ * 맀μž₯의 μΆ”κ°€ 정보λ₯Ό μƒμ„±ν•˜κΈ° μœ„ν•œ DTO ν΄λž˜μŠ€μž…λ‹ˆλ‹€.
+ */
public class StoreAdditionalInfoCreateRequestDTO {
+    /** μ˜ˆμ•½ κ°€λŠ₯ μ—¬λΆ€ */
     private Boolean reservationAvailable;
+    /** μ΅œλŒ€ μ˜ˆμ•½ κ°€λŠ₯ 인원 */
     private Long maxReservation;
+    /** μ΅œμ†Œ μ„ κ²°μ œ κΈˆμ•‘ (원) */
     private Long minPrepayment;
+    /** μ„ κ²°μ œ 유효 κΈ°κ°„ (λΆ„) */
     private Long prepaymentDuration;
src/main/java/com/jangburich/domain/store/domain/StoreCreateRequestDTO.java (1)

34-36: ν•„λ“œ νƒ€μž… 변경이 μ μ ˆν•˜λ‚˜, 좔가적인 κ°œμ„ μ‚¬ν•­μ΄ μžˆμŠ΅λ‹ˆλ‹€.

νƒ€μž… 변경은 λ°μ΄ν„°μ˜ μ •ν™•μ„±κ³Ό μ•ˆμ •μ„±μ„ ν–₯μƒμ‹œμΌ°μŠ΅λ‹ˆλ‹€. λ‹€λ§Œ λ‹€μŒ 사항듀을 κ³ λ €ν•΄μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€:

  1. dayOfWeek λ¦¬μŠ€νŠΈμ— λŒ€ν•œ μœ νš¨μ„± 검증이 ν•„μš”ν•©λ‹ˆλ‹€ (μ€‘λ³΅λœ μš”μΌ, 빈 리슀트 λ“±).
  2. openTimeκ³Ό closeTime에 λŒ€ν•œ λΉ„μ¦ˆλ‹ˆμŠ€ κ·œμΉ™ 검증이 ν•„μš”ν•©λ‹ˆλ‹€ (예: closeTime이 openTime보닀 λŠ¦μ€ μ‹œκ°„μΈμ§€).
  3. 각 ν•„λ“œμ˜ μš©λ„μ™€ μ œμ•½μ‚¬ν•­μ„ μ„€λͺ…ν•˜λŠ” JavaDoc 주석 μΆ”κ°€λ₯Ό ꢌμž₯ν•©λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 κ°œμ„ ν•˜μ‹€ 것을 μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

 // business hour
+/**
+ * μ˜μ—…μΌ λͺ©λ‘
+ * μ€‘λ³΅λœ μš”μΌμ€ ν—ˆμš©λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
+ */
 private List<DayOfWeek> dayOfWeek;
 
+/**
+ * μ˜μ—… μ‹œμž‘ μ‹œκ°„
+ * closeTime보닀 이λ₯Έ μ‹œκ°„μ΄μ–΄μ•Ό ν•©λ‹ˆλ‹€.
+ */
 private LocalTime openTime;
 
+/**
+ * μ˜μ—… μ’…λ£Œ μ‹œκ°„
+ * openTime보닀 λŠ¦μ€ μ‹œκ°„μ΄μ–΄μ•Ό ν•©λ‹ˆλ‹€.
+ */
 private LocalTime closeTime;
src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java (1)

66-69: μ—”λ“œν¬μΈνŠΈ 경둜 섀계λ₯Ό κ²€ν† ν•΄ μ£Όμ„Έμš”.

빈 λ¬Έμžμ—΄("")을 경둜둜 μ‚¬μš©ν•˜λŠ” 것은 λ‹€λ₯Έ μ—”λ“œν¬μΈνŠΈμ™€ μΆ©λŒν•  수 μžˆμŠ΅λ‹ˆλ‹€. λͺ…μ‹œμ μΈ 경둜λ₯Ό μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

- @GetMapping("")
+ @GetMapping("/info")

λ˜ν•œ, Swagger λ¬Έμ„œμ— 응닡 μ˜ˆμ‹œμ™€ κ°€λŠ₯ν•œ 였λ₯˜ 상황을 μΆ”κ°€ν•˜λ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€:

@Operation(
    summary = "κ°€κ²Œ 정보 쑰회",
    description = "κ°€κ²Œ 상세 정보λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€.",
    responses = {
        @ApiResponse(
            responseCode = "200",
            description = "쑰회 성곡",
            content = @Content(schema = @Schema(implementation = StoreGetResponseDTO.class))
        ),
        @ApiResponse(
            responseCode = "404",
            description = "κ°€κ²Œ 정보λ₯Ό 찾을 수 μ—†μŒ"
        )
    }
)
src/main/java/com/jangburich/domain/store/domain/Store.java (2)

79-91: μ‹œκ°„ ν˜•μ‹μ— λŒ€ν•œ νƒ€μž„μ‘΄ κ³ λ €κ°€ ν•„μš”ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

@JsonFormat νŒ¨ν„΄μ΄ "HH:mm:ss"둜 μ§€μ •λ˜μ–΄ μžˆμ§€λ§Œ, νƒ€μž„μ‘΄μ— λŒ€ν•œ μ²˜λ¦¬κ°€ λͺ…μ‹œλ˜μ–΄ μžˆμ§€ μ•ŠμŠ΅λ‹ˆλ‹€. κΈ€λ‘œλ²Œ μ„œλΉ„μŠ€λ₯Ό κ³ λ €ν•˜κ³  μžˆλ‹€λ©΄ νƒ€μž„μ‘΄ 처리λ₯Ό μΆ”κ°€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 timezone을 λͺ…μ‹œμ μœΌλ‘œ μ§€μ •ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”:

-@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss")
+@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "Asia/Seoul")

Line range hint 96-113: μ€‘λ³΅λœ setAddress() ν˜ΈμΆœμ„ μ œκ±°ν•΄μ•Ό ν•©λ‹ˆλ‹€.

of() λ©”μ†Œλ“œμ—μ„œ setAddress()κ°€ 두 번 호좜되고 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•΄μ£Όμ„Έμš”:

 newStore.setLongitude(storeCreateRequestDTO.getLongitude());
 newStore.setAddress(storeCreateRequestDTO.getAddress());
-newStore.setAddress(storeCreateRequestDTO.getAddress());
 newStore.setLocation(storeCreateRequestDTO.getLocation());
src/main/java/com/jangburich/domain/oauth/domain/service/OAuthUserService.java (1)

79-79: μ—­ν•  검증 둜직이 κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€λ§Œ, 주석이 ν•„μš”ν•©λ‹ˆλ‹€.

μ—­ν•  검증 둜직이 μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€. ν•˜μ§€λ§Œ 이 쑰건문의 μ˜λ„λ₯Ό λͺ…ν™•νžˆ ν•˜κΈ° μœ„ν•΄ 주석을 μΆ”κ°€ν•˜λŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 주석을 μΆ”κ°€ν•˜λŠ” 것을 μ œμ•ˆν•©λ‹ˆλ‹€:

+  // μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•Šκ±°λ‚˜ ROLE_OWNER κΆŒν•œμ΄ μ—†λŠ” 경우 μƒˆλ‘œμš΄ μ†Œμœ μž 계정을 생성
   if (existUser == null || !existUser.getRole().equals("ROLE_OWNER")) {
src/main/java/com/jangburich/domain/store/domain/service/StoreService.java (3)

32-36: μ‚¬μš©μž 및 μ†Œμœ μž 쑰회 λ‘œμ§μ„ λ©”μ„œλ“œλ‘œ μΆ”μΆœν•˜μ—¬ μ½”λ“œ 쀑볡을 μ€„μ΄μ„Έμš”

μ—¬λŸ¬ λ©”μ„œλ“œμ—μ„œ λ™μΌν•œ μ‚¬μš©μž 및 μ†Œμœ μž 쑰회 둜직이 반볡되고 μžˆμŠ΅λ‹ˆλ‹€. 이 λ‘œμ§μ„ λ³„λ„μ˜ private λ©”μ„œλ“œλ‘œ μΆ”μΆœν•˜λ©΄ μ½”λ“œ 쀑볡을 쀄이고 μœ μ§€λ³΄μˆ˜λ₯Ό μš©μ΄ν•˜κ²Œ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

예λ₯Ό λ“€μ–΄, λ‹€μŒκ³Ό 같이 getAuthenticatedOwner λ©”μ„œλ“œλ₯Ό μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

private Owner getAuthenticatedOwner(CustomOAuthUser customOAuthUser) {
    User user = userRepository.findByProviderId(customOAuthUser.getUserId())
        .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));

    return ownerRepository.findByUser(user)
        .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));
}

그리고 각 λ©”μ„œλ“œμ—μ„œ λ‹€μŒκ³Ό 같이 λ³€κ²½ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

- User user = userRepository.findByProviderId(customOAuthUser.getUserId())
-     .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));
-
- Owner owner = ownerRepository.findByUser(user)
-     .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));
+ Owner owner = getAuthenticatedOwner(customOAuthUser);

Also applies to: 44-48, 121-125


66-68: μ†Œμœ μž 인증 체크 λ‘œμ§μ„ λ©”μ„œλ“œλ‘œ μΆ”μΆœν•˜μ—¬ 쀑볡을 μ œκ±°ν•˜μ„Έμš”

updateStore와 getStoreInfo λ©”μ„œλ“œμ—μ„œ μ†Œμœ μž 인증을 ν™•μΈν•˜λŠ” 둜직이 반볡되고 μžˆμŠ΅λ‹ˆλ‹€. 이 뢀뢄을 λ³„λ„μ˜ λ©”μ„œλ“œλ‘œ μΆ”μΆœν•˜μ—¬ μ½”λ“œ 쀑볡을 쀄이고 μœ μ§€λ³΄μˆ˜λ₯Ό μš©μ΄ν•˜κ²Œ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

예λ₯Ό λ“€μ–΄, λ‹€μŒκ³Ό 같이 validateOwner λ©”μ„œλ“œλ₯Ό μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

private void validateOwner(Store store, CustomOAuthUser customOAuthUser) {
    if (!store.getOwner().getUser().getProviderId().equals(customOAuthUser.getUserId())) {
        throw new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION);
    }
}

그리고 ν•΄λ‹Ή λ©”μ„œλ“œλ“€μ—μ„œ 인증 체크 μ½”λ“œλ₯Ό λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

- if (!store.getOwner().getUser().getProviderId().equals(customOAuthUser.getUserId())) {
-     throw new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION);
- }
+ validateOwner(store, customOAuthUser);

Also applies to: 130-132


74-118: updateStore λ©”μ„œλ“œλ₯Ό λ¦¬νŒ©ν† λ§ν•˜μ—¬ 가독성을 ν–₯μƒμ‹œν‚€μ„Έμš”

updateStore λ©”μ„œλ“œλŠ” λ§Žμ€ if 문으둜 κ΅¬μ„±λ˜μ–΄ μ½”λ“œκ°€ κΈΈκ³  읽기 μ–΄λ €μšΈ 수 μžˆμŠ΅λ‹ˆλ‹€. 이λ₯Ό λ¦¬νŒ©ν† λ§ν•˜μ—¬ 가독성을 높일 수 μžˆμŠ΅λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, μ—…λ°μ΄νŠΈ λ‘œμ§μ„ ν•„λ“œλ³„λ‘œ λ³„λ„μ˜ λ©”μ„œλ“œλ‘œ λΆ„λ¦¬ν•˜κ±°λ‚˜ 맡을 ν™œμš©ν•˜μ—¬ λ™μ μœΌλ‘œ ν•„λ“œλ₯Ό μ—…λ°μ΄νŠΈν•˜λŠ” 방법을 κ³ λ €ν•΄ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 4b95a7a and 2c51360.

πŸ“’ Files selected for processing (8)
  • src/main/java/com/jangburich/domain/oauth/domain/service/OAuthUserService.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/Store.java (3 hunks)
  • src/main/java/com/jangburich/domain/store/domain/StoreAdditionalInfoCreateRequestDTO.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/StoreCreateRequestDTO.java (2 hunks)
  • src/main/java/com/jangburich/domain/store/domain/StoreGetResponseDTO.java (3 hunks)
  • src/main/java/com/jangburich/domain/store/domain/StoreUpdateRequestDTO.java (2 hunks)
  • src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java (3 hunks)
  • src/main/java/com/jangburich/domain/store/domain/service/StoreService.java (2 hunks)
πŸ”‡ Additional comments (10)
src/main/java/com/jangburich/domain/store/domain/StoreCreateRequestDTO.java (1)

3-5: ν•„μš”ν•œ μž„ν¬νŠΈκ°€ μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

μ‹œκ°„κ³Ό μš”μΌμ„ 더 μ •ν™•ν•˜κ²Œ ν‘œν˜„ν•˜κΈ° μœ„ν•œ μ μ ˆν•œ νƒ€μž…λ“€μ΄ μž„ν¬νŠΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/jangburich/domain/store/domain/StoreUpdateRequestDTO.java (2)

3-5: ν•„μš”ν•œ μž„ν¬νŠΈλ¬Έμ΄ λͺ¨λ‘ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μƒˆλ‘œμš΄ νƒ€μž… DayOfWeek, LocalTime, Listλ₯Ό μœ„ν•œ μž„ν¬νŠΈλ¬Έμ΄ 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.


Line range hint 1-31: 전체적인 ꡬ쑰가 κΉ”λ”ν•©λ‹ˆλ‹€.

  • Lombok μ–΄λ…Έν…Œμ΄μ…˜μ„ 적절히 μ‚¬μš©ν•˜μ—¬ λ³΄μΌλŸ¬ν”Œλ ˆμ΄νŠΈ μ½”λ“œλ₯Ό μ€„μ˜€μŠ΅λ‹ˆλ‹€.
  • JPA κ΄€λ ¨ μ–΄λ…Έν…Œμ΄μ…˜λ„ μ˜¬λ°”λ₯΄κ²Œ μ‚¬μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
  • ν•„λ“œλͺ…이 λͺ…ν™•ν•˜κ³  μ΄ν•΄ν•˜κΈ° μ‰½μŠ΅λ‹ˆλ‹€.
src/main/java/com/jangburich/domain/store/domain/StoreGetResponseDTO.java (4)

3-5: ν•„μš”ν•œ μž„ν¬νŠΈκ°€ 잘 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ‹œκ°„κ³Ό μš”μΌ κ΄€λ ¨ 데이터 νƒ€μž… 변경에 λ”°λ₯Έ μ μ ˆν•œ μž„ν¬νŠΈκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.


41-43: μƒμ„±μž λ§€κ°œλ³€μˆ˜ νƒ€μž…μ΄ μ˜¬λ°”λ₯΄κ²Œ μ—…λ°μ΄νŠΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

ν•„λ“œ νƒ€μž… 변경사항이 μƒμ„±μž λ§€κ°œλ³€μˆ˜μ—λ„ μ •ν™•νžˆ λ°˜μ˜λ˜μ—ˆμŠ΅λ‹ˆλ‹€.


34-36: 데이터 νƒ€μž… 변경이 μ μ ˆν•©λ‹ˆλ‹€.

  • dayOfWeekλ₯Ό List<DayOfWeek>둜 λ³€κ²½ν•˜μ—¬ μ—¬λŸ¬ μ˜μ—…μΌμ„ μ €μž₯ν•  수 있게 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
  • openTimeκ³Ό closeTime을 LocalTime으둜 λ³€κ²½ν•˜μ—¬ μ‹œκ°„ 데이터λ₯Ό 더 μ •ν™•ν•˜κ²Œ λ‹€λ£° 수 있게 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

데이터 νƒ€μž… 변경에 λ”°λ₯Έ 영ν–₯을 ν™•μΈν•˜κΈ° μœ„ν•΄ λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•©λ‹ˆλ‹€:

βœ… Verification successful

데이터 νƒ€μž… 변경이 μΌκ΄€λ˜κ²Œ μ μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Store 엔티티와 κ΄€λ ¨ DTOλ“€μ—μ„œ μ˜μ—… μ‹œκ°„κ³Ό μš”μΌ κ΄€λ ¨ ν•„λ“œλ“€μ΄ λͺ¨λ‘ λ™μΌν•œ νƒ€μž…μœΌλ‘œ μΌκ΄€λ˜κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€:

  • List<DayOfWeek> νƒ€μž…μ΄ Store μ—”ν‹°ν‹°(workDays)와 λͺ¨λ“  DTOλ“€(dayOfWeek)μ—μ„œ μ‚¬μš©λ¨
  • LocalTime νƒ€μž…μ΄ Store 엔티티와 λͺ¨λ“  DTOλ“€μ˜ openTime, closeTime ν•„λ“œμ—μ„œ μ‚¬μš©λ¨
  • Store μ—”ν‹°ν‹°μ—μ„œλŠ” μΆ”κ°€λ‘œ @JsonFormat μ–΄λ…Έν…Œμ΄μ…˜μ„ 톡해 μ‹œκ°„ 포맷도 적절히 μ§€μ •λ˜μ–΄ 있음
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Store 엔티티와 κ΄€λ ¨ DTOλ“€μ—μ„œ μ‹œκ°„κ³Ό μš”μΌ κ΄€λ ¨ ν•„λ“œμ˜ νƒ€μž…μ΄ μΌκ΄€λ˜κ²Œ λ³€κ²½λ˜μ—ˆλŠ”μ§€ 확인

# Store μ—”ν‹°ν‹° 확인
rg "class Store" -A 20

# κ΄€λ ¨ DTO ν΄λž˜μŠ€λ“€ 확인
fd -e java -x rg "class.*RequestDTO|class.*ResponseDTO" -A 20 {}

Length of output: 16856


Script:

#!/bin/bash
# Store μ—”ν‹°ν‹°μ—μ„œ μ˜μ—… μ‹œκ°„κ³Ό μš”μΌ κ΄€λ ¨ ν•„λ“œ 확인
rg "class Store" -A 50 src/main/java/com/jangburich/domain/store/domain/Store.java

# Store μ—”ν‹°ν‹°μ˜ λ©”μ„œλ“œμ—μ„œ DayOfWeek와 LocalTime μ‚¬μš© 확인
ast-grep --pattern 'class Store {
  $$$
  private List<DayOfWeek> $_ = $$$;
  $$$
}'

ast-grep --pattern 'class Store {
  $$$
  private LocalTime $_ = $$$;
  $$$
}'

Length of output: 1416


Script:

#!/bin/bash
# Store μ—”ν‹°ν‹°μ˜ 전체 λ‚΄μš© 확인
cat src/main/java/com/jangburich/domain/store/domain/Store.java

# Store μ—”ν‹°ν‹°μ˜ μ˜μ—…μ‹œκ°„ κ΄€λ ¨ ν•„λ“œ 검색
rg "openTime|closeTime|dayOfWeek" src/main/java/com/jangburich/domain/store/domain/Store.java

Length of output: 3641


79-81: of λ©”μ„œλ“œμ˜ 맀핑이 적절히 μˆ˜μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

store.getWorkDays()λ₯Ό μ‚¬μš©ν•˜μ—¬ μ˜μ—…μΌ 정보λ₯Ό κ°€μ Έμ˜€λ„λ‘ λ³€κ²½λœ 것이 μ μ ˆν•©λ‹ˆλ‹€.

Store ν΄λž˜μŠ€μ— getWorkDays λ©”μ„œλ“œκ°€ μ˜¬λ°”λ₯΄κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆλŠ”μ§€ ν™•μΈν•˜κΈ° μœ„ν•΄ λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•©λ‹ˆλ‹€:

βœ… Verification successful

Let me search for the implementation of the getter method for work days in the Store class. The previous search didn't show the complete Store class implementation.


이전 κ²€μƒ‰μ—μ„œ setWorkDays λ©”μ„œλ“œλŠ” λ°œκ²¬ν–ˆμ§€λ§Œ, ν•΄λ‹Ήν•˜λŠ” getter λ©”μ„œλ“œμ™€ ν•„λ“œ 선언을 ν™•μΈν•˜κΈ° μœ„ν•΄ Store 클래슀의 더 λ§Žμ€ 뢀뢄을 μ‚΄νŽ΄λ³΄κ² μŠ΅λ‹ˆλ‹€.


@ElementCollection으둜 work_days ν…Œμ΄λΈ”κ³Ό λ§€ν•‘λœ ν•„λ“œλ₯Ό λ°œκ²¬ν–ˆμŠ΅λ‹ˆλ‹€. 이제 ν•΄λ‹Ή ν•„λ“œμ˜ getter λ©”μ„œλ“œ κ΅¬ν˜„μ„ ν™•μΈν•˜κ² μŠ΅λ‹ˆλ‹€.


ν•„λ“œλŠ” μ‘΄μž¬ν•˜μ§€λ§Œ getter λ©”μ„œλ“œκ°€ λͺ…μ‹œμ μœΌλ‘œ 보이지 μ•ŠμŠ΅λ‹ˆλ‹€. Lombok μ–΄λ…Έν…Œμ΄μ…˜μ„ 톡해 μžλ™ μƒμ„±λ˜μ—ˆμ„ 수 μžˆμœΌλ―€λ‘œ ν™•μΈν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€.


Store 클래슀의 getWorkDays() λ©”μ„œλ“œκ°€ μ˜¬λ°”λ₯΄κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

Store ν΄λž˜μŠ€μ— @Getter μ–΄λ…Έν…Œμ΄μ…˜μ΄ μ μš©λ˜μ–΄ 있고, private List<DayOfWeek> workDays ν•„λ“œκ°€ μ •μ˜λ˜μ–΄ μžˆμ–΄ Lombok에 μ˜ν•΄ getWorkDays() λ©”μ„œλ“œκ°€ μžλ™μœΌλ‘œ μƒμ„±λ©λ‹ˆλ‹€. λ”°λΌμ„œ StoreGetResponseDTOμ—μ„œ store.getWorkDays()λ₯Ό ν˜ΈμΆœν•˜λŠ” 것이 μ μ ˆν•©λ‹ˆλ‹€.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Store ν΄λž˜μŠ€μ—μ„œ getWorkDays λ©”μ„œλ“œ κ΅¬ν˜„ 확인
ast-grep --pattern 'class Store {
  $$$
  getWorkDays() {
    $$$
  }
  $$$
}'

Length of output: 16856


Script:

#!/bin/bash
# Store ν΄λž˜μŠ€μ—μ„œ getWorkDays λ©”μ„œλ“œ κ΅¬ν˜„ 확인
rg "getWorkDays|getDayOfWeek" -A 3 src/main/java/com/jangburich/domain/store/domain/Store.java

Length of output: 353


Script:

#!/bin/bash
# Store 클래슀의 전체 ν•„λ“œμ™€ λ©”μ„œλ“œ 확인
rg "class Store" -A 50 src/main/java/com/jangburich/domain/store/domain/Store.java

Length of output: 1248


Script:

#!/bin/bash
# Store 클래슀의 workDays ν•„λ“œμ™€ getter λ©”μ„œλ“œ 확인
rg "@ElementCollection.*work_days" -A 5 src/main/java/com/jangburich/domain/store/domain/Store.java

# getter λ©”μ„œλ“œ 확인
rg "get.*WorkDays|get.*DayOfWeek" src/main/java/com/jangburich/domain/store/domain/Store.java

Length of output: 310


Script:

#!/bin/bash
# Store 클래슀의 workDays κ΄€λ ¨ λͺ¨λ“  μ½”λ“œ 확인
rg "workDays|dayOfWeek" -B 2 -A 2 src/main/java/com/jangburich/domain/store/domain/Store.java

# Lombok μ–΄λ…Έν…Œμ΄μ…˜ 확인
rg "@Getter|@Data|@Accessors" src/main/java/com/jangburich/domain/store/domain/Store.java

Length of output: 422

src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java (1)

13-13: μƒˆλ‘œμš΄ DTO μž„ν¬νŠΈκ°€ 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μƒˆλ‘œμš΄ κΈ°λŠ₯을 μœ„ν•œ StoreAdditionalInfoCreateRequestDTO μž„ν¬νŠΈκ°€ μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/jangburich/domain/store/domain/Store.java (1)

3-6: ν•„μš”ν•œ import 문이 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ‹œκ°„ 및 μ»¬λ ‰μ…˜ 처리λ₯Ό μœ„ν•œ import 문이 μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/jangburich/domain/oauth/domain/service/OAuthUserService.java (1)

Line range hint 79-109: κΈ°μ‘΄ μ‚¬μš©μžμ— λŒ€ν•œ 영ν–₯을 ν™•μΈν•΄μ£Όμ„Έμš”.

μ—­ν•  검증 둜직이 변경됨에 따라 κΈ°μ‘΄ μ‚¬μš©μžλ“€μ˜ κΆŒν•œ μ „ν™˜ μ‹œλ‚˜λ¦¬μ˜€μ— λŒ€ν•œ 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•˜μ—¬ κΈ°μ‘΄ μ‚¬μš©μžλ“€μ˜ κΆŒν•œ μƒνƒœλ₯Ό ν™•μΈν•΄μ£Όμ„Έμš”:

βœ… Verification successful

κΆŒν•œ μ „ν™˜ 둜직이 μ•ˆμ „ν•˜κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

μ½”λ“œλ² μ΄μŠ€ 뢄석 κ²°κ³Ό, λ‹€μŒκ³Ό 같은 이유둜 κΈ°μ‘΄ μ‚¬μš©μžλ“€μ˜ κΆŒν•œ μ „ν™˜μ΄ μ•ˆμ „ν•˜κ²Œ 처리되고 μžˆμŠ΅λ‹ˆλ‹€:

  • μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•Šκ±°λ‚˜ ROLE_OWNER κΆŒν•œμ΄ μ—†λŠ” κ²½μš°μ—λ§Œ μƒˆλ‘œμš΄ Owner 계정이 μƒμ„±λ©λ‹ˆλ‹€.
  • κΈ°μ‘΄ Owner μ‚¬μš©μžμ˜ 경우 ν”„λ‘œν•„ μ •λ³΄λ§Œ μ—…λ°μ΄νŠΈλ˜λ©° κΆŒν•œμ€ λ³€κ²½λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
  • Owner와 User μ—”ν‹°ν‹° κ°„μ˜ 관계가 λͺ…ν™•ν•˜κ²Œ μ •μ˜λ˜μ–΄ μžˆμ–΄ 데이터 일관성이 보μž₯λ©λ‹ˆλ‹€.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: κΈ°μ‘΄ μ‚¬μš©μžλ“€μ˜ κΆŒν•œ μƒνƒœ 확인

# User μ—”ν‹°ν‹°μ—μ„œ ROLE_OWNER κΆŒν•œμ„ 가진 μ‚¬μš©μž 쑰회
ast-grep --pattern 'class User {
  $$$
  private String role;
  $$$
}'

# Owner 엔티티와 User μ—”ν‹°ν‹°μ˜ 연관관계 확인
ast-grep --pattern 'class Owner {
  $$$
  private User user;
  $$$
}'

Length of output: 144


Script:

#!/bin/bash
# Search for User class implementation
rg -U "class User" -A 20

# Search for Owner class implementation
rg -U "class Owner" -A 20

# Search for role-related methods in User class
rg -U "getRole|setRole" -A 3

# Search for user relationship methods in Owner class
rg -U "getUser|setUser" -A 3

# Search for role-related database operations
rg -U "ROLE_OWNER" -A 3

Length of output: 28244

Comment on lines +7 to +9
@Getter
@Setter
@RequiredArgsConstructor
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Lombok μ–΄λ…Έν…Œμ΄μ…˜ κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

@RequiredArgsConstructorλŠ” final ν•„λ“œλ‚˜ @NonNull이 μ§€μ •λœ ν•„λ“œμ— λŒ€ν•΄μ„œλ§Œ μƒμ„±μžλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€. ν˜„μž¬ ν΄λž˜μŠ€μ—λŠ” ν•΄λ‹Ήλ˜λŠ” ν•„λ“œκ°€ μ—†μœΌλ―€λ‘œ @NoArgsConstructorλ‚˜ @AllArgsConstructorλ₯Ό μ‚¬μš©ν•˜λŠ” 것이 더 μ μ ˆν•  것 κ°™μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

@Getter
@Setter
-@RequiredArgsConstructor
+@AllArgsConstructor
+@NoArgsConstructor
πŸ“ 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.

Suggested change
@Getter
@Setter
@RequiredArgsConstructor
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor

Comment on lines +11 to +14
private Boolean reservationAvailable;
private Long maxReservation;
private Long minPrepayment;
private Long prepaymentDuration;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

ν•„λ“œ μœ νš¨μ„± 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

μ˜ˆμ•½ 및 결제 κ΄€λ ¨ ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검증이 μ—†μŠ΅λ‹ˆλ‹€. 잘λͺ»λœ 데이터가 μž…λ ₯될 수 μžˆλŠ” μœ„ν—˜μ΄ μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 μ œμ•½μ‘°κ±΄ μΆ”κ°€λ₯Ό μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;

public class StoreAdditionalInfoCreateRequestDTO {
-    private Boolean reservationAvailable;
-    private Long maxReservation;
-    private Long minPrepayment;
-    private Long prepaymentDuration;
+    @NotNull(message = "μ˜ˆμ•½ κ°€λŠ₯ μ—¬λΆ€λŠ” ν•„μˆ˜ μž…λ ₯κ°’μž…λ‹ˆλ‹€")
+    private Boolean reservationAvailable;
+    
+    @Min(value = 1, message = "μ΅œλŒ€ μ˜ˆμ•½ κ°€λŠ₯ 인원은 1λͺ… 이상이어야 ν•©λ‹ˆλ‹€")
+    private Long maxReservation;
+    
+    @Min(value = 0, message = "μ΅œμ†Œ μ„ κ²°μ œ κΈˆμ•‘μ€ 0원 이상이어야 ν•©λ‹ˆλ‹€")
+    private Long minPrepayment;
+    
+    @Min(value = 0, message = "μ„ κ²°μ œ 유효 기간은 0λΆ„ 이상이어야 ν•©λ‹ˆλ‹€")
+    private Long prepaymentDuration;
πŸ“ 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.

Suggested change
private Boolean reservationAvailable;
private Long maxReservation;
private Long minPrepayment;
private Long prepaymentDuration;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
public class StoreAdditionalInfoCreateRequestDTO {
@NotNull(message = "μ˜ˆμ•½ κ°€λŠ₯ μ—¬λΆ€λŠ” ν•„μˆ˜ μž…λ ₯κ°’μž…λ‹ˆλ‹€")
private Boolean reservationAvailable;
@Min(value = 1, message = "μ΅œλŒ€ μ˜ˆμ•½ κ°€λŠ₯ 인원은 1λͺ… 이상이어야 ν•©λ‹ˆλ‹€")
private Long maxReservation;
@Min(value = 0, message = "μ΅œμ†Œ μ„ κ²°μ œ κΈˆμ•‘μ€ 0원 이상이어야 ν•©λ‹ˆλ‹€")
private Long minPrepayment;
@Min(value = 0, message = "μ„ κ²°μ œ 유효 기간은 0λΆ„ 이상이어야 ν•©λ‹ˆλ‹€")
private Long prepaymentDuration;

Comment on lines +29 to +31
private List<DayOfWeek> dayOfWeek;
private LocalTime openTime;
private LocalTime closeTime;
Copy link

Choose a reason for hiding this comment

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

πŸ’‘ Codebase verification

μœ νš¨μ„± 검증 둜직 μΆ”κ°€κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

ν˜„μž¬ μ½”λ“œλ² μ΄μŠ€μ—μ„œ StoreUpdateRequestDTO의 μ‹œκ°„κ³Ό μš”μΌ 데이터에 λŒ€ν•œ μœ νš¨μ„± 검증이 λˆ„λ½λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒ μ‚¬ν•­λ“€μ˜ κ΅¬ν˜„μ΄ ν•„μš”ν•©λ‹ˆλ‹€:

  • @NotNull, @Valid λ“±μ˜ Bean Validation μ–΄λ…Έν…Œμ΄μ…˜ μΆ”κ°€
  • dayOfWeek 리슀트의 쀑볡 및 null 체크
  • openTime이 closeTime보닀 이후인 κ²½μš°μ— λŒ€ν•œ λΉ„μ¦ˆλ‹ˆμŠ€ 둜직 검증
πŸ”— Analysis chain

ν•„λ“œ νƒ€μž… 변경이 μ μ ˆν•˜λ‚˜ μœ νš¨μ„± 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

μ‹œκ°„κ³Ό μš”μΌ 데이터λ₯Ό 더 μ μ ˆν•œ νƒ€μž…μœΌλ‘œ λ³€κ²½ν•œ 것은 쒋은 κ°œμ„ μž…λ‹ˆλ‹€. λ‹€λ§Œ λ‹€μŒ 사항듀을 κ³ λ €ν•΄μ£Όμ„Έμš”:

  1. dayOfWeek λ¦¬μŠ€νŠΈκ°€ λΉ„μ–΄μžˆκ±°λ‚˜ μ€‘λ³΅λœ μš”μΌμ΄ μžˆλŠ” 경우 처리
  2. openTime이 closeTime보닀 이후인 경우 처리

Let me gather more information about validation annotations and service layer validation.


Let me try one more search to find validation-related code in the repository structure:


Let me check the StoreService implementation for any validation logic:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: μœ νš¨μ„± 검증 둜직 확인

# Store μ—”ν‹°ν‹°λ‚˜ μ„œλΉ„μŠ€ λ ˆμ΄μ–΄μ—μ„œ μœ νš¨μ„± 검증 확인
rg -A 10 "dayOfWeek|openTime|closeTime.*valid"

# Bean Validation μ–΄λ…Έν…Œμ΄μ…˜ μ‚¬μš© 확인
ast-grep --pattern 'class StoreUpdateRequestDTO {
  $$$
  @NotNull
  $$$
}'

Length of output: 5343


Script:

#!/bin/bash
# Check for validation annotations in StoreUpdateRequestDTO
rg -B 2 -A 2 "@.*null|@Size|@Valid|@Pattern|@Min|@Max" src/main/java/com/jangburich/domain/store/domain/StoreUpdateRequestDTO.java

# Check service layer validation for store times
rg -A 10 "update.*Store|save.*Store" src/main/java/com/jangburich/domain/store/service/

# Check if there's any custom validation for business hours
rg -A 5 "validateBusinessHours|validateDayOfWeek|validate.*Time" 

Length of output: 380


Script:

#!/bin/bash
# Find all service and validator files
fd -e java service
fd -e java validator

# Check for any validation annotations in Store related files
rg -B 2 -A 2 "@.*null|@Size|@Valid|@Pattern|@Min|@Max" $(fd -e java store)

Length of output: 1581


Script:

#!/bin/bash
# Check StoreService implementation
cat src/main/java/com/jangburich/domain/store/domain/service/StoreService.java

# Check StoreController for any validation annotations
cat src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java

Length of output: 9286

Comment on lines +43 to +52
@Operation(summary = "κ°€κ²Œ 좔가정보 μ €μž₯", description = "μ˜ˆμ•½ κ°€λŠ₯ μ—¬λΆ€, μ΅œμ†Œ μ„ κ²°μ œ κΈˆμ•‘, μ„ κ²°μ œ μ‚¬μš© 기간을 μ €μž₯ν•©λ‹ˆλ‹€.")
@PostMapping("/create/additionalInfo")
public ResponseCustom<Message> createAdditionalInfo(Authentication authentication, @RequestBody
StoreAdditionalInfoCreateRequestDTO storeAdditionalInfoCreateRequestDTO) {
CustomOAuthUser customOAuthUser = (CustomOAuthUser)authentication.getPrincipal();
storeService.CreateAdditionalInfo(customOAuthUser, storeAdditionalInfoCreateRequestDTO);
return ResponseCustom.OK(Message.builder()
.message("success")
.build());
}
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

λ©”μ„œλ“œ 넀이밍 μ»¨λ²€μ…˜ 및 μœ νš¨μ„± 검사 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

λ‹€μŒ 사항듀을 κ°œμ„ ν•΄ μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€:

  1. CreateAdditionalInfo λ©”μ„œλ“œλͺ…이 Java 넀이밍 μ»¨λ²€μ…˜μ„ λ”°λ₯΄μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ©”μ„œλ“œλͺ…은 μ†Œλ¬Έμžλ‘œ μ‹œμž‘ν•΄μ•Ό ν•©λ‹ˆλ‹€.
  2. DTO에 μœ νš¨μ„± 검사 μ–΄λ…Έν…Œμ΄μ…˜μ΄ λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

- storeService.CreateAdditionalInfo(customOAuthUser, storeAdditionalInfoCreateRequestDTO);
+ storeService.createAdditionalInfo(customOAuthUser, storeAdditionalInfoCreateRequestDTO);

그리고 DTO ν΄λž˜μŠ€μ— λ‹€μŒκ³Ό 같은 μœ νš¨μ„± 검사λ₯Ό μΆ”κ°€ν•΄ μ£Όμ„Έμš”:

public class StoreAdditionalInfoCreateRequestDTO {
    @NotNull(message = "μ˜ˆμ•½ κ°€λŠ₯ μ—¬λΆ€λŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
    private Boolean reservationAvailable;
    
    @Min(value = 0, message = "μ΅œμ†Œ μ„ κ²°μ œ κΈˆμ•‘μ€ 0 이상이어야 ν•©λ‹ˆλ‹€")
    private Integer minPrepayment;
    
    // 기타 ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검사 μΆ”κ°€
}

private final UserRepository userRepository;

@Transactional
public void CreateStore(CustomOAuthUser customOAuth2User, StoreCreateRequestDTO storeCreateRequestDTO) {
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

λ©”μ„œλ“œ λͺ…λͺ… κ·œμΉ™μ„ 일관성 있게 μ μš©ν•˜μ„Έμš”

Javaμ—μ„œλŠ” λ©”μ„œλ“œ 이름을 μ†Œλ¬Έμžλ‘œ μ‹œμž‘ν•˜λŠ” 카멜 μΌ€μ΄μŠ€λ₯Ό μ‚¬μš©ν•˜λŠ” 것이 κ΄€λ‘€μž…λ‹ˆλ‹€. CreateStore와 CreateAdditionalInfo λ©”μ„œλ“œλ₯Ό 각각 createStore와 createAdditionalInfo둜 λ³€κ²½ν•˜μ—¬ λ‹€λ₯Έ λ©”μ„œλ“œλ“€κ³Ό λͺ…λͺ… κ·œμΉ™μ„ 일관성 있게 μœ μ§€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

Also applies to: 42-43

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.

2 participants