Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
2217fc5
♻️ Refactor: Validation Currency 추가
usingjun Mar 20, 2025
6361372
♻️ Refactor: walletdto validation 추가
usingjun Mar 20, 2025
c1d64cc
♻️ Refactor: WalletController valid 추가
usingjun Mar 20, 2025
185640c
♻️ Refactor: Wallet ErrorCode Lock 관련 추가
usingjun Mar 20, 2025
96848b6
♻️Refactor: wallet 구조 변경
usingjun Mar 20, 2025
423ca81
♻️Refactor: wallet 거래내역 엔티티 생성
usingjun Mar 20, 2025
5a98ec5
✨ Feature: wallet 거래내역 repository 생성
usingjun Mar 20, 2025
daf5ada
✨ Feature: wallet 거래내역 service, controller 수정
usingjun Mar 20, 2025
775fc8f
🎨 Style: 전반적인 로그, 주석 수정
usingjun Mar 20, 2025
df40228
🔥 Remove: 불필요한 파일 삭제
usingjun Mar 20, 2025
8f6f307
♻️ Refactor: Wallet 코드 리팩토링
usingjun Mar 20, 2025
f7fb5f0
♻️ Refactor: WalletService 단 예외처리 수정
usingjun Mar 20, 2025
d01257f
♻️ Refactor: wallet LockRepository 단 예외처리 수정
usingjun Mar 20, 2025
6da500c
♻️ Refactor: wallet dto schema 달기 & fromEntity 추가
usingjun Mar 20, 2025
df04280
♻️ Refactor: WalletController 수정
usingjun Mar 20, 2025
1b65b06
♻️ Refactor: Common.Constants에 토큰값 설정
usingjun Mar 20, 2025
ead8c78
🔧 BugFix: 패키지 import 수정
usingjun Mar 20, 2025
d190f8e
🗑️ Chore: RabbitMQ
usingjun Mar 20, 2025
6e0a7b0
🚚 Rename: 패키지 구조 변경
usingjun Mar 20, 2025
f138203
🚚 Rename: 패키지 구조 변경
usingjun Mar 20, 2025
20ca03a
♻️ Refactor: Factory 패턴을 활용한 동적 주입
usingjun Mar 20, 2025
092a9c4
:sparkles: Feature: RabbitMQConfig 설정
usingjun Mar 21, 2025
52cfd18
:sparkles: Feature: 거래내역 저장 비동기 처리
usingjun Mar 21, 2025
4a6cf47
:sparkles: Feature: 거래내역 저장 producer, consumer
usingjun Mar 21, 2025
a584de3
:sparkles: Feature: 거래내역 저장 dto
usingjun Mar 21, 2025
2dc1f11
♻️ Refactor: 거래내역 엔티티 수정
usingjun Mar 21, 2025
1f8a8ba
♻️ Refactor: Repository @Param 적용
usingjun Mar 23, 2025
193ce29
♻️ Refactor: WalletTest @DisplayName 적용 및 NamedLock 부분 수정
usingjun Mar 23, 2025
82cb96f
♻️ Refactor: NamedLock pg_advisory_lock으로 재수정
usingjun Mar 23, 2025
eabbd08
:sparkles: Feature: RabbitMQConfig json Converter 설정
usingjun Mar 23, 2025
83d35e9
:wrench: BugFix: transaction column 충돌 수정
usingjun Mar 23, 2025
8ac2534
:sparkles: Feature: transaction 초기 테스트
usingjun Mar 23, 2025
ff8f727
:sparkles: Feature: RabbitMQ constants 추가
usingjun Mar 23, 2025
f130440
:sparkles: Feature: nullable 수정
usingjun Mar 23, 2025
7ae808e
:sparkles: Feature: RabbitMQConfig retry 설정 추가
usingjun Mar 23, 2025
aef5da3
:sparkles: Feature: 슬랙 테스트
usingjun Mar 23, 2025
7e8b5c6
:sparkles: Feature: transaction 예외처리
usingjun Mar 23, 2025
150c61b
:sparkles: Feature: 재사용 로직 및 slack 전송 로직
usingjun Mar 23, 2025
324ca70
♻️ Refactor: 트랜잭션 테스트 코드 리팩토링
usingjun Mar 23, 2025
20f616a
♻️ Refactor: 인출 예외처리 한번 더 적용
usingjun Mar 25, 2025
acabeee
🎨 Style: 코드 포맷팅 수정
usingjun Mar 25, 2025
f9489d4
♻️ Refactor: 거래내역 조회 쿼리 수정
usingjun Mar 25, 2025
810ce13
:sparkles: Feature: 거래내역 테스트
usingjun Mar 25, 2025
c5d0697
🚚 Rename: 패키지 구조 변경
usingjun Mar 26, 2025
30e9ef9
🔧 Fix: 버그 수정
usingjun Mar 26, 2025
c89f73a
🚚 Rename: 패키지 구조 변경
usingjun Mar 26, 2025
8a382b4
🔧 Fix: 버그 수정
usingjun Mar 26, 2025
cce8e3a
✨ Feat: transaction page dto
usingjun Mar 26, 2025
1b6b941
✨ Feat: transaction page repository
usingjun Mar 26, 2025
7b2f65c
✨ Feat: transaction page service
usingjun Mar 26, 2025
44d3258
🚚 Rename: 패키지 구조 변경
usingjun Mar 26, 2025
3e8777c
♻️ Refactor: dto 수정 및 swagger-ui 적용
usingjun Mar 26, 2025
6aedc12
🚚 Rename: 패키지 구조 변경
usingjun Mar 26, 2025
d8350f3
♻️ Refactor: dto 수정 및 swagger-ui 적용
usingjun Mar 26, 2025
1e72e00
♻️ Refactor: @Transactional 수정
usingjun Mar 29, 2025
26c190e
♻️ Refactor: Test환경 도커로 변경
usingjun Mar 29, 2025
d1a0fe1
♻️ Refactor: Test환경 도커로 변경
usingjun Mar 29, 2025
f40c074
♻️ Refactor: Optional로 타입 변경 & readUser() 메서드 오버로딩
usingjun Mar 29, 2025
3ca67c2
♻️ Refactor: RabbitMQ 큐에 들어갈 수 있는 최대 메시지 수를 제한
usingjun Mar 29, 2025
9d6cc8f
♻️ Refactor: 단위 @Mock테스트로 변경
usingjun Mar 29, 2025
5436ae9
♻️ Refactor: 통합 시나리오테스트로 변경
usingjun Mar 29, 2025
00d5b62
♻️ Refactor: @MockBean deprecated 대체
usingjun Mar 29, 2025
e4ef8f2
♻️ Refactor: Lock 부분 @Transactional 추가
usingjun Mar 29, 2025
caf39ab
♻️ Refactor: 송금 시 상대방 이름, 전화번호로 송금
usingjun Mar 29, 2025
b2bd843
♻️ Refactor: @MockBean 사용
usingjun Mar 29, 2025
e365e64
♻️ Refactor: dto null 처리, namedLock으로 변경
usingjun Mar 30, 2025
7e0d23a
♻️ Refactor: docker-compose rabbitmq 포트 수정
usingjun Mar 30, 2025
775f767
병합 충돌 해결 및 리팩토링 경로 정리 완료
usingjun Mar 31, 2025
edc3939
병합 충돌 해결 및 리팩토링 경로 정리 완료
usingjun Mar 31, 2025
c451eb1
:wrench: BugFix : merge하면서 생긴 문제
usingjun Apr 1, 2025
0958b8e
♻️ Refactor: CustomUserDetails로 저장하는 방식으로 변경
usingjun Apr 3, 2025
d21c02b
♻️ Refactor: CustomUserDetails로 저장하는 방식으로 변경
usingjun Apr 3, 2025
7544e38
♻️ Refactor: CustomUserDetails로 Controller단에 적용
usingjun Apr 3, 2025
9d16aef
Merge branch 'develop' into Refactor/JIRA-kan-67-지갑-거래내역-관리-new
usingjun Apr 3, 2025
af375e3
🔧 Fix: 버그 수정
usingjun Apr 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // JUnit 플랫폼 런처 (테스트 실행 환경 제공)
testImplementation "org.testcontainers:testcontainers:1.19.2" // Docker 기반 통합 테스트 지원 (Testcontainers 기본 라이브러리)
testImplementation "org.testcontainers:junit-jupiter:1.19.2" // JUnit 5(Testcontainers 연동) 지원
testImplementation 'org.testcontainers:postgresql:1.19.2'

// 데이터베이스
runtimeOnly 'com.h2database:h2' // 인메모리 데이터베이스a H2 (테스트 및 개발 환경용)
Expand All @@ -67,6 +68,11 @@ dependencies {
// AWS
implementation 'software.amazon.awssdk:kms:2.20.0' // AWS KMS 의존성

// RabbitMQ
implementation 'org.springframework.boot:spring-boot-starter-amqp'
testImplementation 'org.springframework.amqp:spring-rabbit-test'
testImplementation 'org.testcontainers:rabbitmq'

// 기타
compileOnly 'org.projectlombok:lombok' // Lombok (Getter, Setter, Constructor 자동 생성)
annotationProcessor 'org.projectlombok:lombok' // Lombok 사용을 위한 어노테이션 프로세서
Expand Down
19 changes: 18 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ services:
environment:
- INFLUXDB_DB=k6

rabbitmq:
image: rabbitmq:3.12-management
container_name: rabbitmq
restart: always
networks:
- monitoring
ports:
- "5672:5672"
- "15673:15672"
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
healthcheck:
test: [ "CMD", "rabbitmq-diagnostics", "-q", "ping" ]
interval: 10s
timeout: 10s
retries: 5

# 🔹 Grafana (InfluxDB 데이터 시각화)
grafana:
image: grafana/grafana:9.3.8
Expand Down Expand Up @@ -96,7 +114,6 @@ services:
ports:
- "9090:8080"
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres-db:5432/xchangepass
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import bumblebee.xchangepass.domain.card.dto.response.DetailedCardInfoResponse;
import bumblebee.xchangepass.domain.card.service.CardService;
import bumblebee.xchangepass.global.error.ErrorCode;
import bumblebee.xchangepass.global.security.jwt.JwtUtil;
import bumblebee.xchangepass.global.security.jwt.CustomUserDetails;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
Expand All @@ -17,6 +17,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand All @@ -40,8 +41,8 @@ public class CardController {
})
@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/physical")
public void generatePhysicalCard(Authentication authentication) {
cardService.generatePhysicalCard(JwtUtil.getLoginId(authentication));
public void generatePhysicalCard(@AuthenticationPrincipal CustomUserDetails user) {
cardService.generatePhysicalCard(user.getUserId());
}

@Operation(summary = "카드 상태 변경", description = "현재 로그인한 사용자의 카드 상태를 변경합니다.")
Expand All @@ -56,9 +57,9 @@ public void generatePhysicalCard(Authentication authentication) {
})
@ResponseStatus(HttpStatus.NO_CONTENT)
@PutMapping("/status")
public void changeCardStatus(Authentication authentication,
public void changeCardStatus(@AuthenticationPrincipal CustomUserDetails user,
@RequestBody @Valid ChangeCardStatusRequest request) {
cardService.changeCardStatus(JwtUtil.getLoginId(authentication), request);
cardService.changeCardStatus(user.getUserId(), request);
}

@Operation(summary = "보유 카드 목록 조회", description = "현재 로그인한 사용자의 보유 카드 목록을 조회합니다.")
Expand All @@ -73,8 +74,8 @@ public void changeCardStatus(Authentication authentication,
})
@ResponseStatus(HttpStatus.OK)
@GetMapping
public List<BasicCardInfoResponse> getBasicCardInfo(Authentication authentication) {
return cardService.getBasicCardInfo(JwtUtil.getLoginId(authentication));
public List<BasicCardInfoResponse> getBasicCardInfo(@AuthenticationPrincipal CustomUserDetails user) {
return cardService.getBasicCardInfo(user.getUserId());
}

@Operation(summary = "카드 상세 정보 조회", description = "특정 카드의 상세 정보를 조회합니다.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bumblebee.xchangepass.domain.card.entity;

import bumblebee.xchangepass.domain.wallet.entity.Wallet;
import bumblebee.xchangepass.domain.wallet.wallet.entity.Wallet;
import bumblebee.xchangepass.global.common.EncryptionData;
import jakarta.persistence.*;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import bumblebee.xchangepass.domain.card.repository.CardRepository;
import bumblebee.xchangepass.domain.user.entity.User;
import bumblebee.xchangepass.domain.user.repository.UserRepository;
import bumblebee.xchangepass.domain.wallet.entity.Wallet;
import bumblebee.xchangepass.domain.wallet.wallet.entity.Wallet;
import bumblebee.xchangepass.global.error.ErrorCode;
import bumblebee.xchangepass.global.exception.CommonException;
import bumblebee.xchangepass.global.security.crypto.AESEncryption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import bumblebee.xchangepass.domain.exchangeTransaction.dto.request.ExchangeRequestDTO;
import bumblebee.xchangepass.domain.exchangeTransaction.dto.response.ExchangeResponseDTO;
import bumblebee.xchangepass.domain.exchangeTransaction.service.ExchangeTransactionService;
import bumblebee.xchangepass.global.security.jwt.JwtUtil;
import bumblebee.xchangepass.global.security.jwt.CustomUserDetails;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
Expand All @@ -14,6 +14,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.ErrorResponse;
import org.springframework.web.bind.annotation.*;

Expand Down Expand Up @@ -42,8 +43,8 @@ public class ExchangeTransactionController {
})
@ResponseStatus(HttpStatus.OK)
@PostMapping("/create")
public ExchangeResponseDTO createTransaction(@RequestBody ExchangeRequestDTO request, Authentication authentication) {
return exchangeService.createTransaction(request, JwtUtil.getLoginId(authentication));
public ExchangeResponseDTO createTransaction(@RequestBody ExchangeRequestDTO request, @AuthenticationPrincipal CustomUserDetails user) {
return exchangeService.createTransaction(request, user.getUserId());
}


Expand All @@ -65,7 +66,7 @@ public ExchangeResponseDTO createTransaction(@RequestBody ExchangeRequestDTO req
})
@ResponseStatus(HttpStatus.OK)
@PostMapping("/execute")
public ExchangeResponseDTO executeTransaction(@RequestParam Long transactionId, Authentication authentication) {
return exchangeService.executeTransaction(transactionId, JwtUtil.getLoginId(authentication));
public ExchangeResponseDTO executeTransaction(@RequestParam Long transactionId, @AuthenticationPrincipal CustomUserDetails user) {
return exchangeService.executeTransaction(transactionId, user.getUserId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import bumblebee.xchangepass.domain.exchangeTransaction.repository.ExchangeTransactionRepository;
import bumblebee.xchangepass.domain.user.entity.User;
import bumblebee.xchangepass.domain.user.repository.UserRepository;
import bumblebee.xchangepass.domain.wallet.dto.request.WalletInOutRequest;
import bumblebee.xchangepass.domain.wallet.entity.Wallet;
import bumblebee.xchangepass.domain.wallet.service.WalletService;
import bumblebee.xchangepass.domain.walletBalance.entity.WalletBalance;
import bumblebee.xchangepass.domain.walletBalance.repository.WalletBalanceRepository;
import bumblebee.xchangepass.domain.walletBalance.service.WalletBalanceService;
import bumblebee.xchangepass.domain.wallet.balance.entity.WalletBalance;
import bumblebee.xchangepass.domain.wallet.balance.repository.WalletBalanceRepository;
import bumblebee.xchangepass.domain.wallet.balance.service.WalletBalanceService;
import bumblebee.xchangepass.domain.wallet.wallet.dto.request.WalletInOutRequest;
import bumblebee.xchangepass.domain.wallet.wallet.entity.Wallet;
import bumblebee.xchangepass.domain.wallet.wallet.service.WalletService;
import bumblebee.xchangepass.global.error.ErrorCode;
import bumblebee.xchangepass.global.exception.CommonException;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -110,14 +110,14 @@ public ExchangeResponseDTO executeTransaction(Long transactionId, Long userId) {

if (fromBalance.getBalance().compareTo(amount) < 0) {
WalletInOutRequest chargeRequest = WalletInOutRequest.builder()
.userId(userId)
// .userId(userId)
.fromCurrency(Currency.getInstance(fromCurrency))
.toCurrency(Currency.getInstance(fromCurrency))
.amount(amount)
.chargeDatetime(LocalDateTime.now())
.build();

walletService.charge(chargeRequest);
// walletService.charge(chargeRequest);
}

WalletBalance toBalance = getOrCreateBalance(wallet, toCurrency);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bumblebee.xchangepass.domain.refresh;
package bumblebee.xchangepass.domain.refresh.controller;

import bumblebee.xchangepass.domain.refresh.dto.RefreshTokenRequest;
import bumblebee.xchangepass.domain.refresh.service.RefreshTokenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
Expand Down Expand Up @@ -43,7 +44,6 @@ public class RefreshTokenController {
@ResponseStatus(HttpStatus.OK)
@PostMapping("/token-refresh")
public void tokenRefresh(@RequestBody @Valid RefreshTokenRequest request) {
// token 재발급
refreshTokenService.refreshToken(request.refreshToken());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bumblebee.xchangepass.domain.refresh;
package bumblebee.xchangepass.domain.refresh.entity;

import bumblebee.xchangepass.global.error.ErrorCode;
import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package bumblebee.xchangepass.domain.refresh;
package bumblebee.xchangepass.domain.refresh.repository;

import bumblebee.xchangepass.global.error.ErrorCode;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;

import java.util.Set;
import java.util.concurrent.TimeUnit;

import static bumblebee.xchangepass.global.common.Constants.REFRESH_TOKEN_TTL;

@Repository
@RequiredArgsConstructor
public class RefreshTokenRepository {

private final RedisTemplate<String, Object> jsonRedisTemplate;

private static final Long REFRESH_TOKEN_TTL = 24 * 60 * 60L; // 24시간 (초 단위)

/**
* Refresh Token 저장 (사용자당 하나만 유지, 기존 토큰 자동 삭제)
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bumblebee.xchangepass.domain.refresh;
package bumblebee.xchangepass.domain.refresh.service;

import bumblebee.xchangepass.domain.refresh.repository.RefreshTokenRepository;
import bumblebee.xchangepass.global.error.ErrorCode;
import bumblebee.xchangepass.global.security.jwt.JwtProvider;
import bumblebee.xchangepass.domain.refresh.dto.RefreshTokenResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import bumblebee.xchangepass.domain.user.dto.request.UserUpdateRequest;
import bumblebee.xchangepass.domain.user.dto.response.UserResponse;
import bumblebee.xchangepass.domain.user.service.UserService;
import bumblebee.xchangepass.global.security.jwt.JwtUtil;
import bumblebee.xchangepass.domain.user.service.UserRegisterService;
import bumblebee.xchangepass.global.security.jwt.CustomUserDetails;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
Expand All @@ -17,6 +17,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.ErrorResponse;
import org.springframework.web.bind.annotation.*;

Expand Down Expand Up @@ -64,8 +65,8 @@ public void signup(@RequestBody @Valid UserRegisterRequest request) {
})
@ResponseStatus(HttpStatus.OK)
@GetMapping
public UserResponse read(Authentication authentication){
return userService.readUser(JwtUtil.getLoginId(authentication));
public UserResponse read(@AuthenticationPrincipal CustomUserDetails user){
return userService.readUser(user.getUserId());
}


Expand All @@ -87,9 +88,9 @@ public UserResponse read(Authentication authentication){
})
@ResponseStatus(HttpStatus.NO_CONTENT)
@PutMapping
public void update(Authentication authentication,
public void update(@AuthenticationPrincipal CustomUserDetails user,
@RequestBody @Valid UserUpdateRequest request) {
userService.updateUser(JwtUtil.getLoginId(authentication), request);
userService.updateUser(user.getUserId(), request);
}


Expand All @@ -104,7 +105,7 @@ public void update(Authentication authentication,
})
@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping
public void softDeleteUser(Authentication authentication) {
userService.softDeleteUser(JwtUtil.getLoginId(authentication));
public void softDeleteUser(@AuthenticationPrincipal CustomUserDetails user) {
userService.softDeleteUser(user.getUserId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import bumblebee.xchangepass.domain.exchangeTransaction.entitiy.ExchangeTransaction;
import bumblebee.xchangepass.domain.user.entity.value.*;
import bumblebee.xchangepass.domain.wallet.entity.Wallet;
import bumblebee.xchangepass.domain.wallet.wallet.entity.Wallet;
import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import bumblebee.xchangepass.global.security.jwt.JwtProvider;
import bumblebee.xchangepass.domain.user.login.dto.request.LoginRequest;
import bumblebee.xchangepass.domain.user.login.dto.response.LoginResponse;
import bumblebee.xchangepass.domain.refresh.RefreshTokenRepository;
import bumblebee.xchangepass.domain.refresh.repository.RefreshTokenRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
Expand All @@ -26,7 +26,6 @@ public class LoginService{

@Transactional
public LoginResponse login(final LoginRequest request) {
System.out.println("loginRequestDTO = " + request);
// 사용자 정보 조회
UserLoginResponse userInfo = userService.readUserByUserEmail(request.userEmail());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public interface UserRepository extends JpaRepository<User, Long>, UserRepositoryCustom {

@Query(value = "SELECT m FROM User m WHERE m.userEmail.value=:email")
Optional<User> findByUserEmail(String email);
Optional<User> findByUserEmail(@Param("email") String email);

@Modifying
@Query(value = """
Expand All @@ -29,5 +29,13 @@ public interface UserRepository extends JpaRepository<User, Long>, UserRepositor
FROM User u
WHERE u.userId = :userId
""")
Optional<User> findByUserId(Long userId);
Optional<User> findByUserId(@Param("userId") Long userId);

@Query(value = """
SELECT u
FROM User u
WHERE u.userName.value = :userName and u.userPhoneNumber.value=:userPhoneNumber
""")
Optional<User> findByUserId(@Param("userName") String userName, @Param("userPhoneNumber") String userPhoneNumber);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import bumblebee.xchangepass.domain.user.dto.request.UserRegisterRequest;
import bumblebee.xchangepass.domain.user.entity.User;
import bumblebee.xchangepass.domain.user.repository.UserRepository;
import bumblebee.xchangepass.domain.user.service.NicknameGenerator;
import bumblebee.xchangepass.domain.wallet.service.WalletService;
import bumblebee.xchangepass.domain.wallet.wallet.service.impl.WalletServiceImpl;
import bumblebee.xchangepass.domain.wallet.wallet.service.impl.lock.PessimisticLockWalletService;
import bumblebee.xchangepass.global.error.ErrorCode;
import bumblebee.xchangepass.global.exception.CommonException;
import bumblebee.xchangepass.global.util.DuplicateKeyExceptionHandler;
Expand All @@ -20,7 +20,7 @@ public class UserRegisterService {

private final UserRepository userRepository;
private final NicknameGenerator nicknameGenerator;
private final WalletService walletService;
private final WalletServiceImpl walletService;
private final BCryptPasswordEncoder bCryptPasswordEncoder;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public UserResponse readUser(Long userId) {
return new UserResponse(user);
}

public User readUser(String userName, String userPhoneNumber) {
return userRepository.findByUserId(userName, userPhoneNumber)
.orElseThrow(ErrorCode.USER_NOT_FOUND::commonException);
}

/**
* ✅ 사용자 정보 수정
*/
Expand Down Expand Up @@ -74,10 +79,8 @@ public void deleteUserBatch(LocalDateTime thirtyDaysAgo) {
}

public UserLoginResponse readUserByUserId(String userId) {
System.out.println("userId = " + userId);
User user = userRepository.findByUserId(Long.parseLong(userId))
.orElseThrow(ErrorCode.USER_NOT_FOUND::commonException);
System.out.println("user = " + user.toString());
return UserLoginResponse.fromEntity(user);
}

Expand Down
Loading