-
Notifications
You must be signed in to change notification settings - Fork 1
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
Develop #23
Conversation
Caution Review failedThe pull request is closed. Walkthroughμ΄ λ³κ²½ μ¬νμ Changes
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? πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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
: νλ νμ λ³κ²½μ΄ μ μ νλ, μΆκ°μ μΈ κ°μ μ¬νμ΄ μμ΅λλ€.νμ λ³κ²½μ λ°μ΄ν°μ μ νμ±κ³Ό μμ μ±μ ν₯μμμΌ°μ΅λλ€. λ€λ§ λ€μ μ¬νλ€μ κ³ λ €ν΄μ£ΌμκΈ° λ°λλλ€:
dayOfWeek
리μ€νΈμ λν μ ν¨μ± κ²μ¦μ΄ νμν©λλ€ (μ€λ³΅λ μμΌ, λΉ λ¦¬μ€νΈ λ±).openTime
κ³ΌcloseTime
μ λν λΉμ¦λμ€ κ·μΉ κ²μ¦μ΄ νμν©λλ€ (μ: closeTimeμ΄ openTimeλ³΄λ€ λ¦μ μκ°μΈμ§).- κ° νλμ μ©λμ μ μ½μ¬νμ μ€λͺ νλ 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
π 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
@Getter | ||
@Setter | ||
@RequiredArgsConstructor |
There was a problem hiding this comment.
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.
@Getter | |
@Setter | |
@RequiredArgsConstructor | |
@Getter | |
@Setter | |
@AllArgsConstructor | |
@NoArgsConstructor |
private Boolean reservationAvailable; | ||
private Long maxReservation; | ||
private Long minPrepayment; | ||
private Long prepaymentDuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νλ μ ν¨μ± κ²μ¦μ΄ νμν©λλ€.
μμ½ λ° κ²°μ κ΄λ ¨ νλμ λν μ ν¨μ± κ²μ¦μ΄ μμ΅λλ€. μλͺ»λ λ°μ΄ν°κ° μ λ ₯λ μ μλ μνμ΄ μμ΅λλ€.
λ€μκ³Ό κ°μ μ μ½μ‘°κ±΄ μΆκ°λ₯Ό μ μλ립λλ€:
+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.
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; |
private List<DayOfWeek> dayOfWeek; | ||
private LocalTime openTime; | ||
private LocalTime closeTime; |
There was a problem hiding this comment.
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
νλ νμ λ³κ²½μ΄ μ μ νλ μ ν¨μ± κ²μ¦μ΄ νμν©λλ€.
μκ°κ³Ό μμΌ λ°μ΄ν°λ₯Ό λ μ μ ν νμ μΌλ‘ λ³κ²½ν κ²μ μ’μ κ°μ μ λλ€. λ€λ§ λ€μ μ¬νλ€μ κ³ λ €ν΄μ£ΌμΈμ:
dayOfWeek
리μ€νΈκ° λΉμ΄μκ±°λ μ€λ³΅λ μμΌμ΄ μλ κ²½μ° μ²λ¦¬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
@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()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
λ©μλ λ€μ΄λ° 컨벀μ λ° μ ν¨μ± κ²μ¬ κ°μ μ΄ νμν©λλ€.
λ€μ μ¬νλ€μ κ°μ ν΄ μ£ΌμκΈ° λ°λλλ€:
CreateAdditionalInfo
λ©μλλͺ μ΄ Java λ€μ΄λ° 컨벀μ μ λ°λ₯΄μ§ μμ΅λλ€. λ©μλλͺ μ μλ¬Έμλ‘ μμν΄μΌ ν©λλ€.- 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) { |
There was a problem hiding this comment.
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
[feat] PRμ λ±λ‘νλ€.
μμ λ΄μ©
μ£Όμμ¬ν
Summary by CodeRabbit
μλ‘μ΄ κΈ°λ₯
λ³κ²½ μ¬ν