-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from tukcomCD2024/backend/feature/84-realtime…
…-current Backend/feature/84 realtime current
- Loading branch information
Showing
10 changed files
with
205 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
backend/src/main/java/com/isp/backend/domain/country/dto/response/ExchangeRateResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.isp.backend.domain.country.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
public class ExchangeRateResponse { | ||
private String baseCurrency; | ||
private String targetCurrency; | ||
private BigDecimal rate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/com/isp/backend/domain/country/mapper/ExchangeRateMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.isp.backend.domain.country.mapper; | ||
|
||
import com.isp.backend.domain.country.dto.response.ExchangeRateResponse; | ||
import com.isp.backend.domain.country.entity.ExchangeRate; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class ExchangeRateMapper { | ||
|
||
public ExchangeRateResponse convertToDto(ExchangeRate exchangeRate) { | ||
ExchangeRateResponse dto = new ExchangeRateResponse(); | ||
dto.setBaseCurrency(exchangeRate.getBaseCurrency()); | ||
dto.setTargetCurrency(exchangeRate.getTargetCurrency()); | ||
dto.setRate(BigDecimal.valueOf(exchangeRate.getRate())); | ||
return dto; | ||
} | ||
|
||
} |
8 changes: 0 additions & 8 deletions
8
backend/src/main/java/com/isp/backend/domain/country/repository/ExchageRateRespository.java
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
backend/src/main/java/com/isp/backend/domain/country/repository/ExchangeRateRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.isp.backend.domain.country.repository; | ||
|
||
import com.isp.backend.domain.country.entity.ExchangeRate; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ExchangeRateRepository extends JpaRepository<ExchangeRate, Long> { | ||
ExchangeRate findByBaseCurrencyAndTargetCurrency(String baseCurrency, String targetCurrency); | ||
|
||
} |
136 changes: 98 additions & 38 deletions
136
backend/src/main/java/com/isp/backend/domain/country/service/ExchangeRateService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...src/main/java/com/isp/backend/global/exception/openApi/ExchangeRateIsFailedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.isp.backend.global.exception.openApi; | ||
|
||
import com.isp.backend.global.exception.CustomException; | ||
import com.isp.backend.global.exception.ErrorCode; | ||
|
||
public class ExchangeRateIsFailedException extends CustomException { | ||
|
||
public ExchangeRateIsFailedException() { | ||
super(ErrorCode.EXCHANGE_RATE_IS_FAILED); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...main/java/com/isp/backend/global/exception/openApi/ExchangeRateSearchFailedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.isp.backend.global.exception.openApi; | ||
|
||
import com.isp.backend.global.exception.CustomException; | ||
import com.isp.backend.global.exception.ErrorCode; | ||
|
||
public class ExchangeRateSearchFailedException extends CustomException { | ||
|
||
public ExchangeRateSearchFailedException() { | ||
super(ErrorCode.EXCHANGE_RATE_SEARCH_FAILED); | ||
} | ||
|
||
} |