feat: Currency symbols enum
This commit is contained in:
parent
f42dcce74b
commit
11d6e41c98
22 changed files with 248 additions and 129 deletions
|
@ -2,6 +2,7 @@ package eu.ztsh.wymiana.util;
|
|||
|
||||
import eu.ztsh.wymiana.data.entity.CurrencyEntity;
|
||||
import eu.ztsh.wymiana.model.Currency;
|
||||
import eu.ztsh.wymiana.model.Symbol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -17,12 +18,12 @@ public class CurrencyMapper {
|
|||
return new CurrencyEntity(pesel, pojo.symbol(), pojo.amount());
|
||||
}
|
||||
|
||||
public static Map<String, Currency> entitiesToPojoMap(List<CurrencyEntity> values) {
|
||||
public static Map<Symbol, Currency> entitiesToPojoMap(List<CurrencyEntity> values) {
|
||||
return values.stream().map(CurrencyMapper::entityToPojo)
|
||||
.collect(Collectors.toMap(Currency::symbol, pojo -> pojo));
|
||||
}
|
||||
|
||||
public static List<CurrencyEntity> pojoMapToEntities(Map<String, Currency> currencies, String pesel) {
|
||||
public static List<CurrencyEntity> pojoMapToEntities(Map<Symbol, Currency> currencies, String pesel) {
|
||||
return currencies.values().stream().map(entry -> pojoToEntity(entry, pesel)).toList();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue