-
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 #36
Develop #36
Conversation
Walkthroughμ΄ ν 리νμ€νΈμμλ Changes
Possibly related PRs
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: 12
π§Ή Outside diff range and nitpick comments (11)
src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java (2)
3-3
: μ¬μ©νμ§ μλ import λ¬Έμ΄ μμ΅λλ€.
Team
ν΄λμ€λ₯Ό import νκ³ μμΌλ μ½λ λ΄μμ μ¬μ©λμ§ μκ³ μμ΅λλ€.λ€μκ³Ό κ°μ΄ μμ ν΄μ£ΌμΈμ:
-import com.jangburich.domain.team.domain.Team;
17-24
: @QueryProjection μμ±μμ μ ν¨μ± κ²μ¦μ΄ νμν©λλ€.λ°μ΄ν°λ² μ΄μ€μμ μ‘°νν κ²°κ³Όλ₯Ό 맀νν λ null 체ν¬λ μ ν¨μ± κ²μ¦μ΄ μμ΅λλ€.
λ€μκ³Ό κ°μ΄ κ°μ ν΄λ³΄μΈμ:
@QueryProjection public StoreTeamResponseDTO(Long id, Integer point, Long teamId, String teamName, Long storeId) { + if (id == null || teamId == null || storeId == null) { + throw new IllegalArgumentException("νμ ID κ°μ΄ λλ½λμμ΅λλ€"); + } + if (teamName == null || teamName.trim().isEmpty()) { + throw new IllegalArgumentException("ν μ΄λ¦μ νμμ λλ€"); + } this.id = id; this.point = point; this.teamId = teamId; this.teamName = teamName; this.storeId = storeId; }src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java (2)
7-13
: λ μ½λ ν΄λμ€ μ€κ³κ° μ λμμ΅λλ€.λΆλ³ λ°μ΄ν°λ₯Ό μν λ μ½λ μ¬μ©μ΄ μ μ νλ©°, νλλ€μ λͺ λͺ μ΄ λͺ νν©λλ€. νμ§λ§ νλμ λν μ ν¨μ± κ²μ¦μ΄ μμ΅λλ€.
λ€μκ³Ό κ°μ κ²μ¦ λ‘μ§ μΆκ°λ₯Ό κ³ λ €ν΄λ³΄μΈμ:
@Builder public record TeamChargeHistoryResponse( Long id, String transactionId, Integer paymentAmount, PaymentChargeStatus paymentChargeStatus ) { + public TeamChargeHistoryResponse { + if (paymentAmount != null && paymentAmount < 0) { + throw new IllegalArgumentException("κ²°μ κΈμ‘μ μμμΌ μ μμ΅λλ€."); + } + if (transactionId != null && transactionId.isBlank()) { + throw new IllegalArgumentException("κ±°λ IDλ λΉμ΄μμ μ μμ΅λλ€."); + } + }
14-21
: QueryProjection μμ±μκ° μ μ ν ꡬνλμμ΅λλ€.QueryDSL νλ‘μ μ μ μν μμ±μκ° μ ꡬνλμ΄ μμ΅λλ€. νμ§λ§ Javadoc λ¬Έμνκ° λλ½λμ΄ μμ΅λλ€.
λ€μκ³Ό κ°μ΄ Javadocμ μΆκ°νλ κ²μ μΆμ²λ립λλ€:
+ /** + * QueryDSL νλ‘μ μ μ μν μμ±μμ λλ€. + * + * @param id ν μΆ©μ λ΄μ ID + * @param transactionId κ±°λ ID + * @param paymentAmount κ²°μ κΈμ‘ + * @param paymentChargeStatus κ²°μ μν + */ @QueryProjection public TeamChargeHistoryResponse(Long id, String transactionId, Integer paymentAmount, PaymentChargeStatus paymentChargeStatus) {src/main/java/com/jangburich/domain/store/domain/dto/response/PaymentGroupDetailResponse.java (1)
15-15
: ν΄λμ€ λ¬Έμνκ° νμν©λλ€ν΄λμ€μ λͺ©μ κ³Ό μ¬μ©λ²μ λν λ¬Έμνκ° μμ΅λλ€.
λ€μκ³Ό κ°μ΄ Javadocμ μΆκ°νλ κ²μ μΆμ²λ립λλ€:
+/** + * κ²°μ κ·Έλ£Ήμ μμΈ μ 보λ₯Ό λ΄λ μλ΅ DTOμ λλ€. + * <p> + * μ΄ ν΄λμ€λ ν μ 보, ν¬μΈνΈ μ 보, νμ₯ μ 보 λ° κ²°μ λ΄μμ ν¬ν¨ν©λλ€. + * λͺ¨λ νλλ λΆλ³μ΄λ©°, κ°μ²΄ μμ±μ {@link #create} ν©ν 리 λ©μλλ₯Ό ν΅ν΄μλ§ κ°λ₯ν©λλ€. + */ public class PaymentGroupDetailResponse {src/main/java/com/jangburich/domain/store/domain/StoreTeam.java (1)
40-41
: ν¬μΈνΈ νλμ λν λ¬Έμνκ° νμν©λλ€.
remainPoint
νλμ μ©λμpoint
νλμμ μ°¨μ΄μ μ λͺ νν νκΈ° μν΄ Javadoc λ¬Έμνλ₯Ό μΆκ°ν΄ μ£ΌμΈμ.+/** + * μ¬μ© κ°λ₯ν μμ¬ ν¬μΈνΈλ₯Ό λνλ λλ€. + * pointλ μ΄ μ 립λ ν¬μΈνΈλ₯Ό, remainPointλ μ€μ μ¬μ© κ°λ₯ν ν¬μΈνΈλ₯Ό μΆμ ν©λλ€. + */ @Column(name = "remain_point") private Integer remainPoint;src/main/java/com/jangburich/domain/payment/application/KakaopayService.java (1)
Line range hint
126-127
: μμΈ μ²λ¦¬ κ°μ νμ
TeamChargeHistory
λ₯Ό μ°Ύμ§ λͺ»νμ λ λ°μνλ rawNullPointerException
μ μ μ ν 컀μ€ν μμΈλ‘ λ체λμ΄μΌ ν©λλ€. μ΄λ λ€μκ³Ό κ°μ μ΄μ λ‘ μ€μν©λλ€:
- λͺ νν μλ¬ λ©μμ§ μ 곡
- μΌκ΄λ μμΈ μ²λ¦¬ ν¨ν΄ μ μ§
- λλ²κΉ μ©μ΄μ± ν₯μ
λ€μκ³Ό κ°μ΄ μμ μ μ μν©λλ€:
- .orElseThrow(() -> new NullPointerException()); + .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.TEAM_CHARGE_HISTORY_NOT_FOUND));ErrorCodeμ μ μ ν μμλ₯Ό μΆκ°ν΄μ£ΌμΈμ:
TEAM_CHARGE_HISTORY_NOT_FOUND("κ²°μ λ΄μμ μ°Ύμ μ μμ΅λλ€.")src/main/java/com/jangburich/domain/store/domain/service/StoreService.java (4)
156-167
:userId
λμAuthentication
κ°μ²΄ μ¬μ©μ κΆμ₯λ립λλ€.
getPaymentGroup
λ©μλμμλString userId
λ₯Ό νλΌλ―Έν°λ‘ λ°κ³ μμ΅λλ€. λ€λ₯Έ λ©μλλ€(searchByCategory
,searchStores
)μμλAuthentication
κ°μ²΄λ₯Ό λ°μAuthenticationParser
λ₯Ό ν΅ν΄userId
λ₯Ό μΆμΆνκ³ μμ΅λλ€. μΌκ΄μ±μ μν΄Authentication
κ°μ²΄λ₯Ό λ°μ μ²λ¦¬νλ κ²μ μΆμ²ν©λλ€.
190-213
: μ€λ³΅ μ½λμ 리ν©ν λ§μ μ μν©λλ€.
getPaymentGroupDetail
λ©μλμμUser
,Owner
,Store
λ₯Ό μ‘°ννλ λ‘μ§μ΄ μμ ꡬνλ λ©μλλ€κ³Ό μ€λ³΅λ©λλ€. ν΄λΉ λΆλΆμ λ³λμ κ³΅ν΅ λ©μλλ‘ μΆμΆνμ¬ μ½λ μ€λ³΅μ μ€μ΄κ³ μ μ§λ³΄μμ±μ λμΌ μ μμ΅λλ€.
209-210
: λ³μ λͺ μΉμ λ λͺ ννκ² λ³κ²½ν΄μ£ΌμΈμ.
chargeHistoryRepositoryAllByTeam
λ³μλͺ μ λ€μ κΈΈκ³ μλ―Έ μ λ¬μ΄ μ΄λ €μΈ μ μμ΅λλ€.teamChargeHistories
μ κ°μ΄ λ³΄λ€ μ§κ΄μ μΈ μ΄λ¦μΌλ‘ λ³κ²½νλ©΄ μ½λλ₯Ό μ΄ν΄νκΈ° μ½μ΅λλ€.
νΈλμμ μ΄λ Έν μ΄μ μ μ©μ΄ νμν λ©μλκ° μμ΅λλ€.
λ°μ΄ν° λ³κ²½ μμ μ λΆμν κ²°κ³Ό, λ€μκ³Ό κ°μ΄ νΈλμμ μ΄λ Έν μ΄μ μ μμ ν΄μΌ ν©λλ€:
createAdditionalInfo
λ©μλ: μ¬λ¬set
μμ κ³Όsave
μμ μ΄ ν¬ν¨λμ΄ μμΌλ―λ‘@Transactional
μ΄λ Έν μ΄μ μ΄ νμν©λλ€.createStore
,updateStore
λ©μλ: νμ¬ μ¬λ°λ₯΄κ²@Transactional
μ΄ μ μ©λμ΄ μμ΅λλ€.- λλ¨Έμ§ μ‘°ν λ©μλλ€(
getStoreInfo
,getPaymentGroup
,searchByCategory
,searchStores
,getPaymentGroupDetail
): μ½κΈ° μ μ© νΈλμμ μΌλ‘ μ²λ¦¬νλ κ²μ΄ μ’μ΅λλ€.@Transactional(readOnly = true)
μ μ©μ κΆμ₯ν©λλ€.π Analysis chain
Line range hint
50-213
: νΈλμμ λ²μλ₯Ό μ¬κ²ν ν΄μ£ΌμΈμ.μΌλΆ λ©μλμλ§
@Transactional
μ΄λ Έν μ΄μ μ΄ μ μ©λμ΄ μμ΅λλ€. λ°μ΄ν° λ³κ²½μ΄ μλ μ‘°ν λ©μλμμλ νμν κ²½μ° νΈλμμ μ μ μ©νκ±°λ, λΆνμν κ³³μμλ μ κ±°νμ¬ νΈλμμ κ²½κ³λ₯Ό λͺ νν μ€μ νλ κ²μ΄ μ’μ΅λλ€.λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ κ° λ©μλμ νΈλμμ μ΄λ Έν μ΄μ μ μ© μ¬λΆλ₯Ό νμΈν μ μμ΅λλ€:
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: `@Transactional` μ΄λ Έν μ΄μ μ΄ μ¬λ°λ₯΄κ² μ μ©λμλμ§ νμΈν©λλ€. # Test: λ©μλλ³λ‘ `@Transactional` μ¬μ© μ¬λΆλ₯Ό νμΈν©λλ€. ast-grep --pattern $'@Transactional\n$_\npublic $_($_) {\n$$$}' src/main/java/com/jangburich/domain/store/domain/service/StoreService.javaLength of output: 136
Script:
#!/bin/bash # Let's try a different approach to check the methods and their transaction annotations # First, let's see all public methods in the service echo "=== All public methods ===" rg "public.*\{" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java # Then, let's check which ones have @Transactional echo -e "\n=== Methods with @Transactional ===" rg -B1 "public.*\{" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java | grep -B1 "public" # Let's also check if there are any repository save/update operations echo -e "\n=== Repository operations ===" rg "repository\.(save|update|delete)" src/main/java/com/jangburich/domain/store/domain/service/StoreService.javaLength of output: 1602
Script:
#!/bin/bash # Let's check for repository operations with a broader pattern and look for data modifications echo "=== Repository save operations ===" rg "storeRepository\.save" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java -B1 -A1 echo -e "\n=== Store modifications ===" rg "store\.set" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java -B1 -A1 # Let's also check for any other repository methods that might modify data echo -e "\n=== All repository method calls ===" rg "Repository\." src/main/java/com/jangburich/domain/store/domain/service/StoreService.javaLength of output: 4569
π Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
π Files selected for processing (9)
src/main/java/com/jangburich/domain/payment/application/KakaopayService.java
(1 hunks)src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java
(1 hunks)src/main/java/com/jangburich/domain/payment/domain/repository/TeamChargeHistoryRepository.java
(1 hunks)src/main/java/com/jangburich/domain/store/domain/StoreTeam.java
(1 hunks)src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java
(1 hunks)src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java
(3 hunks)src/main/java/com/jangburich/domain/store/domain/dto/response/PaymentGroupDetailResponse.java
(1 hunks)src/main/java/com/jangburich/domain/store/domain/repository/StoreTeamRepository.java
(1 hunks)src/main/java/com/jangburich/domain/store/domain/service/StoreService.java
(4 hunks)
π Additional comments (9)
src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java (2)
1-6
: ν¨ν€μ§ ꡬ쑰μ μν¬νΈκ° μ μ ν©λλ€.
νμν μ΄λ Έν μ΄μ λ€λ§ μν¬νΈλμ΄ μμ΄ κΉλν©λλ€.
1-22
: PaymentChargeStatus μ΄κ±°ν μμ‘΄μ± νμΈμ΄ νμν©λλ€.
PaymentChargeStatus μ΄κ±°νμ΄ μ¬λ°λ₯΄κ² μ μλμ΄ μλμ§ νμΈμ΄ νμν©λλ€.
β Verification successful
The shell script results show that PaymentChargeStatus
is properly defined as an enum in src/main/java/com/jangburich/domain/payment/domain/PaymentChargeStatus.java
with valid states (PENDING, COMPLETED, CANCELLED, REFUNDED). The enum is correctly used in TeamChargeHistory
, TeamChargeHistoryResponse
, and KakaopayService
. Let me provide the final response in Korean:
PaymentChargeStatus μ΄κ±°νμ΄ μ¬λ°λ₯΄κ² μ μλμ΄ μκ³ μ μ νκ² μ¬μ©λκ³ μμ΅λλ€.
PaymentChargeStatus
μ΄κ±°νμ λ€μκ³Ό κ°μ΄ κ²°μ μνλ₯Ό λͺ
ννκ² μ μνκ³ μμ΅λλ€:
- PENDING (λκΈ°)
- COMPLETED (μλ£)
- CANCELLED (μ·¨μ)
- REFUNDED (νλΆ)
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# PaymentChargeStatus μ΄κ±°ν μ μλ₯Ό νμΈ
ast-grep --pattern 'enum PaymentChargeStatus {
$$$
}'
# PaymentChargeStatus μ¬μ©μ² νμΈ
rg -A 5 'PaymentChargeStatus'
Length of output: 5742
src/main/java/com/jangburich/domain/store/domain/repository/StoreTeamRepository.java (1)
5-6
: νμ΄μ§λ€μ΄μ
ꡬνμ΄ μ μ ν μΆκ°λμμ΅λλ€.
Spring Data JPAμ νμ΄μ§λ€μ΄μ κΈ°λ₯μ νμ©ν ꡬνμ΄ μ λμ΄μμ΅λλ€.
Also applies to: 16-16
src/main/java/com/jangburich/domain/payment/domain/repository/TeamChargeHistoryRepository.java (2)
4-10
: νμν import λ¬Έμ΄ μ μΆκ°λμμ΅λλ€.
νμ΄μ§λ€μ΄μ ꡬνμ μν Spring Data κ΄λ ¨ ν΄λμ€λ€κ³Ό λλ©μΈ ν΄λμ€λ€μ΄ μ μ ν import λμμ΅λλ€.
18-18
: μν°ν°μ μλ΅ DTO κ°μ 맀ν κ²μ¦μ΄ νμν©λλ€.
findAllByTeam
λ©μλκ° TeamChargeHistory
μν°ν° λμ TeamChargeHistoryResponse
λ₯Ό μ§μ λ°ννκ³ μμ΅λλ€. μ΄λ μΌλ°μ μΈ ν¨ν΄μ μλλλ€.
λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ λ§€ν ꡬνμ νμΈνκ² μ΅λλ€:
μ μμ¬ν:
- μλΉμ€ κ³μΈ΅μμ μν°ν°λ₯Ό DTOλ‘ λ³ννλ κ²μ΄ λ μ’μ λ°©λ²μΌ μ μμ΅λλ€.
- λλ
@Query
μ΄λ Έν μ΄μ μ μ¬μ©νμ¬ λͺ μμ μΈ λ§€νμ μ μν μ μμ΅λλ€.
β Verification successful
QueryDSLμ μ¬μ©ν μ μ ν 맀νμ΄ κ΅¬νλμ΄ μμ΅λλ€.
TeamChargeHistoryResponse
λ μ½λμ @QueryProjection
μ΄λ
Έν
μ΄μ
μ΄ μ μ©λμ΄ μμ΄ QueryDSLμ ν΅ν μν°ν°-DTO 맀νμ΄ μ¬λ°λ₯΄κ² ꡬνλμ΄ μμ΅λλ€. μ΄λ μ±λ₯κ³Ό μ μ§λ³΄μμ± μΈ‘λ©΄μμ μ’μ μ κ·Ό λ°©μμ
λλ€.
@QueryProjection
μ μ¬μ©νμ¬ μν°ν°μμ DTOλ‘μ μ§μ 맀νμ΄ κ°λ₯- νμν νλλ§ μ νμ μΌλ‘ μ‘°νν μ μμ΄ μ±λ₯μ μ΄μ μ‘΄μ¬
- μ»΄νμΌ μμ μ νμ μμ μ± λ³΄μ₯
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# TeamChargeHistoryResponse ν΄λμ€μμ 맀ν κ΄λ ¨ μ½λ νμΈ
ast-grep --pattern 'record TeamChargeHistoryResponse($$$) {
$$$
}'
# 맀ν ꡬνμ΄ μλμ§ νμΈ
rg -A 5 "TeamChargeHistory.*TeamChargeHistoryResponse"
Length of output: 127
Script:
#!/bin/bash
# 1. TeamChargeHistoryResponse ν΄λμ€ νμΌ μ°ΎκΈ°
fd TeamChargeHistoryResponse
# 2. TeamChargeHistory μν°ν° ν΄λμ€ μ°ΎκΈ°
fd TeamChargeHistory
# 3. Repository ν΄λμ€μμ κ΄λ ¨ 쿼리λ 맀ν νμΈ
rg -A 5 "@Query.*TeamChargeHistoryResponse"
# 4. νλ‘μ νΈ λ΄μ λͺ¨λ TeamChargeHistoryResponse μ¬μ© κ²μ
rg "TeamChargeHistoryResponse"
Length of output: 1914
Script:
#!/bin/bash
# TeamChargeHistoryResponse λ μ½λμ ꡬν νμΈ
cat src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java
# TeamChargeHistory μν°ν° ꡬν νμΈ
cat src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistory.java
# Repository ꡬν체 νμΈ
fd -e java "TeamChargeHistoryRepositoryImpl"
Length of output: 2566
src/main/java/com/jangburich/domain/store/domain/StoreTeam.java (1)
60-60
: μ΄κΈ° remainPoint μ€μ μ΄ μ μ ν΄ λ³΄μ
λλ€.
μλ‘μ΄ StoreTeam μμ± μ remainPointλ₯Ό pointμ λμΌνκ² μ€μ νλ κ²μ΄ λ Όλ¦¬μ μ λλ€.
src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java (2)
17-30
: μλ‘μ΄ μμ‘΄μ± μΆκ°κ° μ μ ν©λλ€!
κ²°μ κ·Έλ£Ή κΈ°λ₯ ꡬνμ μν μλ‘μ΄ DTO ν΄λμ€λ€κ³Ό μΈμ¦ νμ μ νΈλ¦¬ν°μ μΆκ°κ° μ λμ΄μμ΅λλ€.
103-118
: κ²°μ κ·Έλ£Ή κ΄λ ¨ μλν¬μΈνΈ ꡬνμ΄ μ λμμ΅λλ€!
- Swagger λ¬Έμνκ° μ λμ΄μμ΅λλ€.
AuthenticationParser
λ₯Ό νμ©ν μΈμ¦ μ²λ¦¬κ° κΉλν©λλ€.- νμ΄μ§λ€μ΄μ μ΄ μ μ νκ² κ΅¬νλμ΄ μμ΅λλ€.
src/main/java/com/jangburich/domain/payment/application/KakaopayService.java (1)
133-134
:
ν¬μΈνΈ μΆκ° λ‘μ§ κ²ν νμ
λμΌν κΈμ‘(paymentAmount
)μ΄ addPoint
μ addRemainPoint
λ λ©μλμ λͺ¨λ μ λ¬λκ³ μμ΅λλ€. μ΄λ μλλ λμμΈμ§ νμΈμ΄ νμν©λλ€.
- λ λ©μλμ μ°¨μ΄μ κ³Ό κ°κ°μ μ©λμ λν λ¬Έμνκ° νμν©λλ€.
- λμΌν κΈμ‘μ λ λ² μΆκ°νλ κ²μ΄ λ§λμ§ κ²μ¦μ΄ νμν©λλ€.
β Verification successful
ν¬μΈνΈ κ΄λ¦¬ λ‘μ§μ΄ μλλ μ€κ³μμ νμΈ
StoreTeam μν°ν°μ ꡬνμ νμΈν κ²°κ³Ό, point
μ remainPoint
λ μλ‘ λ€λ₯Έ λͺ©μ μ κ°μ§ λ³λμ νλμ
λλ€:
point
: λμ μΆ©μ ν¬μΈνΈλ₯Ό κ΄λ¦¬remainPoint
: μ€μ μ¬μ© κ°λ₯ν μμ¬ ν¬μΈνΈλ₯Ό κ΄λ¦¬
λ°λΌμ μΆ©μ μ λ νλλ₯Ό λͺ¨λ μ¦κ°μν€λ νμ¬ κ΅¬νμ μ¬λ°λ₯Έ μ€κ³μ λλ€. λ€λ§ μλ κ°μ μ¬νμ μ μλ립λλ€:
- κ° νλμ λ©μλμ μ©λλ₯Ό λͺ νν νλ μ£Όμ μΆκ° νμ
- λ©μλλͺ
μ λ λͺ
ννκ² λ³κ²½ κ²ν (μ:
addPoint
βaddTotalPoint
)
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# StoreTeam ν΄λμ€μμ addPointμ addRemainPoint λ©μλμ ꡬνμ νμΈ
ast-grep --pattern $'class StoreTeam {
$$$
addPoint($_) {
$$$
}
$$$
addRemainPoint($_) {
$$$
}
$$$
}'
Length of output: 124
Script:
#!/bin/bash
# Search for StoreTeam class implementation
rg -U "class StoreTeam[\s\S]*?}" -A 10
# Search for addPoint and addRemainPoint method calls or references
rg "addPoint|addRemainPoint" -A 2 -B 2
Length of output: 4418
public record StoreTeamResponseDTO( | ||
Long id, | ||
Integer point, | ||
Long teamId, | ||
String teamName, | ||
Long storeId | ||
|
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
νλ νμ κ³Ό μ ν¨μ± κ²μ¦μ κ°μ ν΄μ£ΌμΈμ.
Long
νμ μ ID νλλ€μ nullμ΄ λ μ μμΌλ―λ‘ μ ν¨μ± κ²μ¦μ΄ νμν©λλ€.point
νλλ κΈμ‘μ λ€λ£¨λ κ²μΌλ‘ 보μ΄λλ°,Integer
λμBigDecimal
μ΄λMoney
νμ μ¬μ©μ κ³ λ €ν΄λ³΄μΈμ.- νλμ λν μ€λͺ μ£Όμμ΄ μμ΄ κ° νλμ μ©λλ₯Ό νμ νκΈ° μ΄λ ΅μ΅λλ€.
λ€μκ³Ό κ°μ΄ κ°μ ν΄λ³΄μΈμ:
+import jakarta.validation.constraints.NotNull;
+import java.math.BigDecimal;
@Builder
public record StoreTeamResponseDTO(
+ @NotNull(message = "idλ νμμ
λλ€")
Long id,
- Integer point,
+ BigDecimal point,
+ @NotNull(message = "teamIdλ νμμ
λλ€")
Long teamId,
+ @NotNull(message = "teamNameμ νμμ
λλ€")
String teamName,
+ @NotNull(message = "storeIdλ νμμ
λλ€")
Long storeId
)
π 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.
public record StoreTeamResponseDTO( | |
Long id, | |
Integer point, | |
Long teamId, | |
String teamName, | |
Long storeId | |
import jakarta.validation.constraints.NotNull; | |
import java.math.BigDecimal; | |
public record StoreTeamResponseDTO( | |
@NotNull(message = "idλ νμμ λλ€") | |
Long id, | |
BigDecimal point, | |
@NotNull(message = "teamIdλ νμμ λλ€") | |
Long teamId, | |
@NotNull(message = "teamNameμ νμμ λλ€") | |
String teamName, | |
@NotNull(message = "storeIdλ νμμ λλ€") | |
Long storeId |
|
||
public interface StoreTeamRepository extends JpaRepository<StoreTeam, Long> { | ||
Optional<StoreTeam> findByStoreIdAndTeamId(Long store_id, Long team_id); | ||
|
||
Page<StoreTeamResponseDTO> findAllByStore(Store store, Pageable pageable); |
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
DTO 맀ν ꡬνμ΄ λλ½λμ΄ μμ΅λλ€.
StoreTeamRepository
μμ Page<StoreTeamResponseDTO>
λ₯Ό λ°ννλ λ©μλκ° μ μΈλμ΄ μμ§λ§, μ€μ 맀ν ꡬνμ΄ νμΈλμ§ μμ΅λλ€. λ€μ μμ
μ΄ νμν©λλ€:
StoreTeamRepositoryImpl
ν΄λμ€λ₯Ό μμ±νμ¬ QueryDSL λλ JPQLμ μ¬μ©ν 맀ν ꡬνμ΄ νμν©λλ€.- λλ
@Query
μ΄λ Έν μ΄μ μ μ¬μ©νμ¬ μΈν°νμ΄μ€μ μ§μ 맀ν 쿼리λ₯Ό μμ±ν΄μΌ ν©λλ€.
맀ν μ λ€μ νλλ€μ΄ μ¬λ°λ₯΄κ² λ³νλμ΄μΌ ν©λλ€:
- StoreTeamμ id β StoreTeamResponseDTOμ id
- StoreTeamμ point β StoreTeamResponseDTOμ point
- Teamμ id β StoreTeamResponseDTOμ teamId
- Teamμ name β StoreTeamResponseDTOμ teamName
- Storeμ id β StoreTeamResponseDTOμ storeId
π Analysis chain
DTO λ³ν ꡬν νμΈμ΄ νμν©λλ€.
StoreTeamResponseDTO
λ‘μ μλ 맀νμ΄ μ λλ‘ λμνλμ§ νμΈμ΄ νμν©λλ€.
λ€μ μ€ν¬λ¦½νΈλ‘ DTO 맀ν ꡬνμ νμΈν΄λ³΄κ² μ΅λλ€:
Let me gather more information about the DTO mapping implementation.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: DTO 맀ν ꡬν νμΈ
# StoreTeamResponseDTO ν΄λμ€μ ꡬ쑰 νμΈ
ast-grep --pattern 'record StoreTeamResponseDTO($$$)'
# 맀ν κ΄λ ¨ μ€μ μ΄λ ꡬν νμΈ
rg -g '*.java' -A 5 'StoreTeamResponseDTO'
Length of output: 5626
Script:
#!/bin/bash
# StoreTeam μν°ν°μ 맀ν ꡬν νμΈ
rg -g '*.java' -A 10 'class StoreTeam'
# StoreTeamRepository ꡬν체 νμΈ
fd -e java StoreTeamRepository
Length of output: 1116
Script:
#!/bin/bash
# StoreTeamRepository ꡬν체 νμΈ (QueryDSL λλ JPQL ꡬν)
rg -g '*.java' -A 15 'class StoreTeamRepositoryImpl'
# Team μν°ν° ꡬ쑰 νμΈ
rg -g '*.java' -A 10 'class Team'
# StoreTeam μν°ν°μ λλ¨Έμ§ νλ νμΈ
rg -g '*.java' -C 20 'class StoreTeam'
Length of output: 9799
@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
DTOμ λΆλ³μ± κ°μ μ΄ νμν©λλ€
μλ΅ DTOλ λΆλ³ κ°μ²΄λ‘ μ€κ³νλ κ²μ΄ μ’μ΅λλ€. νμ¬ κ΅¬μ‘°μμλ μΈλΆμμ setterλ₯Ό ν΅ν΄ κ°μ λ³κ²½ν μ μμ΄ μμ νμ§ μμ΅λλ€.
λ€μκ³Ό κ°μ΄ μμ νλ κ²μ μΆμ²λ립λλ€:
@Getter
-@Setter
-@RequiredArgsConstructor
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
π 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 | |
@AllArgsConstructor(access = AccessLevel.PRIVATE) | |
@RequiredArgsConstructor |
public static PaymentGroupDetailResponse create(String teamName, Integer point, Integer remainPoint, | ||
User teamLeader, Page<TeamChargeHistoryResponse> historyResponses) { | ||
PaymentGroupDetailResponse paymentGroupDetailResponse = new PaymentGroupDetailResponse(); | ||
paymentGroupDetailResponse.setTeamName(teamName); | ||
paymentGroupDetailResponse.setPoint(point); | ||
paymentGroupDetailResponse.setRemainPoint(remainPoint); | ||
paymentGroupDetailResponse.setTeamLeaderName(teamLeader.getNickname()); | ||
paymentGroupDetailResponse.setTeamLeaderPhoneNum(teamLeader.getPhoneNumber()); | ||
paymentGroupDetailResponse.setHistoryResponses(historyResponses); | ||
return paymentGroupDetailResponse; | ||
} |
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
ν©ν 리 λ©μλμ μμ μ± κ°μ μ΄ νμν©λλ€
μ λ ₯ νλΌλ―Έν°μ λν μ ν¨μ± κ²μ¦μ΄ μμΌλ©°, User κ°μ²΄κ° nullμΌ κ²½μ° NullPointerExceptionμ΄ λ°μν μ μμ΅λλ€.
λ€μκ³Ό κ°μ΄ μμ νλ κ²μ μΆμ²λ립λλ€:
public static PaymentGroupDetailResponse create(String teamName, Integer point, Integer remainPoint,
User teamLeader, Page<TeamChargeHistoryResponse> historyResponses) {
+ Objects.requireNonNull(teamLeader, "νμ₯ μ 보λ νμμ
λλ€");
+ Objects.requireNonNull(historyResponses, "νμ€ν 리 μ 보λ νμμ
λλ€");
+
+ if (teamName == null || teamName.trim().isEmpty()) {
+ throw new IllegalArgumentException("ν μ΄λ¦μ νμμ
λλ€");
+ }
+ if (point == null || point < 0) {
+ throw new IllegalArgumentException("μ ν¨νμ§ μμ ν¬μΈνΈμ
λλ€");
+ }
+ if (remainPoint == null || remainPoint < 0) {
+ throw new IllegalArgumentException("μ ν¨νμ§ μμ μμ¬ ν¬μΈνΈμ
λλ€");
+ }
- PaymentGroupDetailResponse paymentGroupDetailResponse = new PaymentGroupDetailResponse();
- paymentGroupDetailResponse.setTeamName(teamName);
- paymentGroupDetailResponse.setPoint(point);
- paymentGroupDetailResponse.setRemainPoint(remainPoint);
- paymentGroupDetailResponse.setTeamLeaderName(teamLeader.getNickname());
- paymentGroupDetailResponse.setTeamLeaderPhoneNum(teamLeader.getPhoneNumber());
- paymentGroupDetailResponse.setHistoryResponses(historyResponses);
- return paymentGroupDetailResponse;
+ return new PaymentGroupDetailResponse(
+ teamName,
+ point,
+ remainPoint,
+ teamLeader.getNickname(),
+ teamLeader.getPhoneNumber(),
+ historyResponses
+ );
}
Committable suggestion skipped: line range outside the PR's diff.
private String teamName; | ||
private Integer point; | ||
private Integer remainPoint; | ||
private String teamLeaderName; | ||
private String teamLeaderPhoneNum; | ||
private Page<TeamChargeHistoryResponse> historyResponses; |
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
νλ μ ν¨μ± κ²μ¦μ΄ νμν©λλ€
ν¬μΈνΈ κ°κ³Ό νμ νλμ λν μ ν¨μ± κ²μ¦μ΄ μμ΅λλ€.
λ€μκ³Ό κ°μ΄ κ²μ¦ μ΄λ Έν μ΄μ μ μΆκ°νλ κ²μ μΆμ²λ립λλ€:
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.PositiveOrZero;
public class PaymentGroupDetailResponse {
- private String teamName;
- private Integer point;
- private Integer remainPoint;
- private String teamLeaderName;
- private String teamLeaderPhoneNum;
+ @NotBlank(message = "ν μ΄λ¦μ νμμ
λλ€")
+ private final String teamName;
+ @NotNull(message = "ν¬μΈνΈλ νμμ
λλ€")
+ @PositiveOrZero(message = "ν¬μΈνΈλ 0 μ΄μμ΄μ΄μΌ ν©λλ€")
+ private final Integer point;
+ @NotNull(message = "μμ¬ ν¬μΈνΈλ νμμ
λλ€")
+ @PositiveOrZero(message = "μμ¬ ν¬μΈνΈλ 0 μ΄μμ΄μ΄μΌ ν©λλ€")
+ private final Integer remainPoint;
+ @NotBlank(message = "νμ₯ μ΄λ¦μ νμμ
λλ€")
+ private final String teamLeaderName;
+ @NotBlank(message = "νμ₯ μ νλ²νΈλ νμμ
λλ€")
+ private final String teamLeaderPhoneNum;
π 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 String teamName; | |
private Integer point; | |
private Integer remainPoint; | |
private String teamLeaderName; | |
private String teamLeaderPhoneNum; | |
private Page<TeamChargeHistoryResponse> historyResponses; | |
import javax.validation.constraints.NotNull; | |
import javax.validation.constraints.NotBlank; | |
import javax.validation.constraints.PositiveOrZero; | |
public class PaymentGroupDetailResponse { | |
@NotBlank(message = "ν μ΄λ¦μ νμμ λλ€") | |
private final String teamName; | |
@NotNull(message = "ν¬μΈνΈλ νμμ λλ€") | |
@PositiveOrZero(message = "ν¬μΈνΈλ 0 μ΄μμ΄μ΄μΌ ν©λλ€") | |
private final Integer point; | |
@NotNull(message = "μμ¬ ν¬μΈνΈλ νμμ λλ€") | |
@PositiveOrZero(message = "μμ¬ ν¬μΈνΈλ 0 μ΄μμ΄μ΄μΌ ν©λλ€") | |
private final Integer remainPoint; | |
@NotBlank(message = "νμ₯ μ΄λ¦μ νμμ λλ€") | |
private final String teamLeaderName; | |
@NotBlank(message = "νμ₯ μ νλ²νΈλ νμμ λλ€") | |
private final String teamLeaderPhoneNum; | |
private Page<TeamChargeHistoryResponse> historyResponses; |
public void subRemainPoint(Integer point) { | ||
this.remainPoint -= point; | ||
} |
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.
μμ¬ ν¬μΈνΈκ° μμκ° λμ§ μλλ‘ κ²μ¦μ΄ νμν©λλ€.
subRemainPoint
λ©μλμμ μ°¨κ° ν μμ¬ ν¬μΈνΈκ° 0λ³΄λ€ μμμ§μ§ μλλ‘ κ²μ¦ λ‘μ§μ μΆκ°ν΄μΌ ν©λλ€.
public void subRemainPoint(Integer point) {
+ if (this.remainPoint < point) {
+ throw new IllegalArgumentException("μμ¬ ν¬μΈνΈκ° λΆμ‘±ν©λλ€. νμ¬ μμ¬ ν¬μΈνΈ: " + this.remainPoint + ", μ°¨κ° μμ² ν¬μΈνΈ: " + point);
+ }
this.remainPoint -= point;
}
π 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.
public void subRemainPoint(Integer point) { | |
this.remainPoint -= point; | |
} | |
public void subRemainPoint(Integer point) { | |
if (this.remainPoint < point) { | |
throw new IllegalArgumentException("μμ¬ ν¬μΈνΈκ° λΆμ‘±ν©λλ€. νμ¬ μμ¬ ν¬μΈνΈ: " + this.remainPoint + ", μ°¨κ° μμ² ν¬μΈνΈ: " + point); | |
} | |
this.remainPoint -= point; | |
} |
storeService.createStore(customOAuth2User, storeCreateRequestDTO); | ||
return ResponseCustom.OK(Message.builder().message("success").build()); | ||
} | ||
|
||
@Operation(summary = "κ°κ² μΆκ°μ 보 μ μ₯", description = "μμ½ κ°λ₯ μ¬λΆ, μ΅μ μ κ²°μ κΈμ‘, μ κ²°μ μ¬μ© κΈ°κ°μ μ μ₯ν©λλ€.") | ||
@PostMapping("/create/additionalInfo") | ||
public ResponseCustom<Message> createAdditionalInfo(Authentication authentication, @RequestBody | ||
StoreAdditionalInfoCreateRequestDTO storeAdditionalInfoCreateRequestDTO) { | ||
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()); | ||
storeService.createAdditionalInfo(customOAuthUser, storeAdditionalInfoCreateRequestDTO); | ||
return ResponseCustom.OK(Message.builder().message("success").build()); | ||
} | ||
|
||
@Operation(summary = "κ°κ² μ 보 μμ ", description = "κ°κ² μ 보λ₯Ό μμ ν©λλ€.") | ||
@PatchMapping("/{storeId}/update") | ||
public ResponseCustom<Message> updateStore(Authentication authentication, @PathVariable Long storeId, @RequestBody | ||
StoreUpdateRequestDTO storeUpdateRequestDTO) { | ||
public ResponseCustom<Message> updateStore(Authentication authentication, @PathVariable Long storeId, | ||
@RequestBody StoreUpdateRequestDTO storeUpdateRequestDTO) { | ||
CustomOAuthUser principal = (CustomOAuthUser)authentication.getPrincipal(); | ||
storeService.updateStore(principal, storeId, storeUpdateRequestDTO); | ||
return ResponseCustom.OK(Message.builder() | ||
.message("success") | ||
.build()); | ||
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
μΈμ¦ μ²λ¦¬ λ°©μμ ν΅μΌνκ° νμν©λλ€.
μ€ν μ΄ κ΄λ¦¬ μλν¬μΈνΈλ€μμ CustomOAuthUser
μΊμ€ν
λ°©μμ΄ λ°λ³΅λκ³ μμ΅λλ€. AuthenticationParser
λ₯Ό νμ©νμ¬ μ½λ μ€λ³΅μ μ κ±°νκ³ μΌκ΄λ λ°©μμΌλ‘ μ²λ¦¬νλ κ²μ΄ μ’κ² μ΅λλ€.
λ€μκ³Ό κ°μ΄ μμ μ μ μλ립λλ€:
public ResponseCustom<Message> createStore(Authentication authentication,
@RequestBody StoreCreateRequestDTO storeCreateRequestDTO) {
- CustomOAuthUser customOAuth2User = (CustomOAuthUser)authentication.getPrincipal();
- storeService.createStore(customOAuth2User, storeCreateRequestDTO);
+ storeService.createStore(AuthenticationParser.parseUserId(authentication), storeCreateRequestDTO);
return ResponseCustom.OK(Message.builder().message("success").build());
}
Committable suggestion skipped: line range outside the PR's diff.
Authentication authentication, | ||
@RequestParam(required = false, defaultValue = "3") Integer searchRadius, | ||
@RequestParam(required = false, defaultValue = "ALL") Category category, | ||
@ModelAttribute StoreSearchCondition storeSearchCondition, | ||
Pageable pageable | ||
) { | ||
return ResponseCustom.OK(storeService.searchByCategory(authentication, searchRadius, category, storeSearchCondition, pageable)); | ||
return ResponseCustom.OK( | ||
storeService.searchByCategory(authentication, searchRadius, category, storeSearchCondition, pageable)); | ||
} | ||
|
||
@Operation(summary = "맀μ₯ μ°ΎκΈ°(κ²μ)", description = "κ²μμ΄μ 맀μ₯ μ νμ λ§λ 맀μ₯μ κ²μν©λλ€.") | ||
@GetMapping("/search") | ||
public ResponseCustom<Page<SearchStoresResponse>> searchStores( | ||
Authentication authentication, | ||
@RequestParam(required = false, defaultValue = "") String keyword, | ||
@ModelAttribute StoreSearchConditionWithType storeSearchConditionWithType, | ||
Pageable pageable | ||
Authentication authentication, | ||
@RequestParam(required = false, defaultValue = "") String keyword, | ||
@ModelAttribute StoreSearchConditionWithType storeSearchConditionWithType, | ||
Pageable pageable | ||
) { | ||
return ResponseCustom.OK(storeService.searchStores(authentication, keyword, storeSearchConditionWithType, pageable)); | ||
return ResponseCustom.OK( | ||
storeService.searchStores(authentication, keyword, storeSearchConditionWithType, pageable)); |
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
μΈμ¦ μ²λ¦¬ λ‘μ§ κ°μ μ΄ νμν©λλ€.
κ²μ μλν¬μΈνΈλ€μ μΈμ¦ μ²λ¦¬κ° μΌκ΄μ±μ΄ μμ΅λλ€. AuthenticationParser
λ₯Ό μ¬μ©νμ¬ μΈμ¦ μ²λ¦¬λ₯Ό ν΅μΌνλ κ²μ΄ μ’κ² μ΅λλ€.
λ€μκ³Ό κ°μ΄ μμ μ μ μλ립λλ€:
public ResponseCustom<Page<SearchStoresResponse>> searchByCategory(
Authentication authentication,
@RequestParam(required = false, defaultValue = "3") Integer searchRadius,
@RequestParam(required = false, defaultValue = "ALL") Category category,
@ModelAttribute StoreSearchCondition storeSearchCondition,
Pageable pageable
) {
return ResponseCustom.OK(
- storeService.searchByCategory(authentication, searchRadius, category, storeSearchCondition, pageable));
+ storeService.searchByCategory(AuthenticationParser.parseUserId(authentication), searchRadius, category, storeSearchCondition, pageable));
}
Committable suggestion skipped: line range outside the PR's diff.
User user = userRepository.findByProviderId(userId) | ||
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); | ||
|
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.
μμΈ μ²λ¦¬ λ° μλ¬ μ½λμ λͺ νμ±μ κ°μ ν΄μ£ΌμΈμ.
νμ¬ μ¬λ¬ κ³³μμ DefaultNullPointerException
μ μ¬μ©νκ³ μμ΅λλ€. νμ§λ§ μ΄ μμΈλ μ€μ λ ν¬μΈν° μμΈμ νΌλλ μ μμΌλ―λ‘, λ³΄λ€ μλ―Έκ° λͺ
νν 컀μ€ν
μμΈλ₯Ό μμ±νμ¬ μ¬μ©νλ κ²μ΄ μ’μ΅λλ€. λν ErrorCode.INVALID_AUTHENTICATION
κ³Ό ErrorCode.INVALID_PARAMETER
λ₯Ό μν©μ λ§κ² μΌκ΄λκ² μ¬μ©νκ³ μλμ§ νμΈμ΄ νμν©λλ€.
Also applies to: 195-199, 201-202, 204-205, 207-208
public Page<StoreTeamResponseDTO> getPaymentGroup(String userId, Pageable pageable) { | ||
User user = userRepository.findByProviderId(userId) | ||
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); | ||
|
||
Owner owner = ownerRepository.findByUser(user) | ||
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); | ||
|
||
Store store = storeRepository.findByOwner(owner) | ||
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); | ||
|
||
return storeTeamRepository.findAllByStore(store, pageable); | ||
} |
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
μλ¬ μ²λ¦¬ λ‘μ§μ ν΅μΌμ±μ νμΈν΄μ£ΌμΈμ.
getPaymentGroup
μ getPaymentGroupDetail
λ©μλμμ μλ¬ λ°μ μ λμΌν μλ¬ μ½λμ μμΈλ₯Ό λμ§κ³ μμ΅λλ€. μλ¬ μμΈμ λ°λΌ μ μ ν μλ¬ μ½λλ₯Ό μ¬μ©νκ³ , ν΄λΌμ΄μΈνΈκ° μμΈμ νμ
ν μ μλλ‘ μμΈν μμΈ μ²λ¦¬λ₯Ό κΆμ₯ν©λλ€.
Also applies to: 190-213
[feat] PRμ λ±λ‘νλ€.
μμ λ΄μ©
μ£Όμμ¬ν
Summary by CodeRabbit
μλ‘μ΄ κΈ°λ₯
TeamChargeHistoryResponse
λ°StoreTeamResponseDTO
μΆκ°.λ²κ·Έ μμ
λ¬Έμν