Skip to content

Commit

Permalink
[FIX] update-color 파라미터 값 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
csb9427 committed Aug 27, 2024
1 parent 65737b9 commit 5d7e9b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public ResponseEntity<SuccessResponse<AccountResponse>> inquireAccount(

@PatchMapping("/update-color")
public ResponseEntity<SuccessResponse<AccountResponse>> updateCustomColor(
@RequestParam String accountNumber,
@AuthenticationPrincipal MemberPrincipal memberPrincipal,
@RequestBody ColorUpdateRequest request) {
AccountResponse response = accountService.updateAccountColor(accountNumber, request.getNewColor());
AccountResponse response = accountService.updateAccountColor(memberPrincipal.getMemberId(), request.getNewColor());
return ResponseEntity.ok(SuccessResponse.ok(response));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import java.util.Optional;

public interface AccountRepository extends JpaRepository<Account, Long> {
Optional<Account> findByAccountNumber(String bankbookNumber);

// memberId로 Account 조회
@Query("SELECT b FROM Account b WHERE b.member.memberId = :memberId")
Optional<Account> findByMemberId(@Param("memberId")Long memberId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ public AccountResponse inquireAccount(Long memberId, String userKey) throws Json
}

// 커스텀 색상 업데이트
public AccountResponse updateAccountColor(String accountNumber, String newColor) {
Optional<Account> optionalAccount = accountRepository.findByAccountNumber(accountNumber);
public AccountResponse updateAccountColor(Long memberId, String newColor) {

Optional<Account> optionalAccount = accountRepository.findByMemberId(memberId);

if (!optionalAccount.isPresent()) {
throw new RuntimeException("해당 계좌 번호를 가진 계좌를 찾을 수 없습니다.");
Expand Down

0 comments on commit 5d7e9b4

Please sign in to comment.