-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50ce07a
commit f144428
Showing
23 changed files
with
123 additions
and
143 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...rc/main/java/hanglog/expense/Expense.java → .../java/hanglog/expense/domain/Expense.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
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/hanglog/expense/domain/repository/CurrencyRepository.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,11 @@ | ||
package hanglog.expense.domain.repository; | ||
|
||
import hanglog.expense.domain.Currency; | ||
import java.time.LocalDate; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface CurrencyRepository extends JpaRepository<Currency, Long> { | ||
|
||
Optional<Currency> findCurrenciesBySearchDate(final LocalDate searchDate); | ||
} |
4 changes: 2 additions & 2 deletions
4
...expense/repository/ExpenseRepository.java → .../domain/repository/ExpenseRepository.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
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/hanglog/expense/domain/type/CurrencyCodeType.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,39 @@ | ||
package hanglog.expense.domain.type; | ||
|
||
import static hanglog.global.exception.ExceptionCode.INVALID_CURRENCY; | ||
|
||
import hanglog.expense.domain.Currency; | ||
import hanglog.global.exception.InvalidDomainException; | ||
import java.util.Arrays; | ||
import java.util.function.Function; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum CurrencyCodeType { | ||
|
||
USD("usd", Currency::getUsd), | ||
EUR("eur", Currency::getEur), | ||
GBP("gbp", Currency::getGbp), | ||
JPY("jpy", Currency::getUnitRateOfJpy), | ||
CNY("cny", Currency::getCny), | ||
CHF("chf", Currency::getChf), | ||
SGD("sgd", Currency::getSgd), | ||
THB("thb", Currency::getThb), | ||
HKD("hkd", Currency::getHkd), | ||
KRW("krw", Currency::getKrw); | ||
|
||
private final String code; | ||
private final Function<Currency, Double> getRate; | ||
|
||
CurrencyCodeType(final String code, final Function<Currency, Double> getRate) { | ||
this.code = code; | ||
this.getRate = getRate; | ||
} | ||
|
||
public static double mappingCurrency(final String currency, final Currency currencies) { | ||
return Arrays.stream(values()) | ||
.filter(value -> value.code.equals(currency.toLowerCase())) | ||
.findAny().orElseThrow(() -> new InvalidDomainException(INVALID_CURRENCY)) | ||
.getRate.apply(currencies); | ||
} | ||
} |
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
21 changes: 0 additions & 21 deletions
21
backend/src/main/java/hanglog/expense/dto/response/CategoryInExpenseResponse.java
This file was deleted.
Oops, something went wrong.
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
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
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
11 changes: 0 additions & 11 deletions
11
backend/src/main/java/hanglog/expense/repository/CurrenciesRepository.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.