preparing tagging of transactions
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -9,6 +9,7 @@ import static de.srsoftware.umbrella.core.Util.mapValues;
|
||||
import static de.srsoftware.umbrella.core.constants.Path.*;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.invalidField;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.missingField;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import de.srsoftware.configuration.Configuration;
|
||||
@@ -28,6 +29,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class AccountingModule extends BaseHandler implements AccountingService {
|
||||
@@ -179,6 +182,8 @@ public class AccountingModule extends BaseHandler implements AccountingService {
|
||||
|
||||
var transaction = accountDb.save(new Transaction(accountId,dateTime,source,destination,amount.doubleValue(),purpose));
|
||||
|
||||
var tags = json.has(Field.TAGS) && json.get(Field.TAGS) instanceof JSONArray t ? t : null;
|
||||
if (tags != null) LOG.log(WARNING, "Tagging transactions not implemented!");
|
||||
return sendContent(ex,newAccount != null ? newAccount : transaction);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class SqliteDb extends BaseDb implements AccountDb {
|
||||
public List<Transaction> loadTransactions(Account account) {
|
||||
try {
|
||||
var list = new ArrayList<Transaction>();
|
||||
var rs = select(ALL).from(TABLE_TRANSACTIONS).where(Field.ACCOUNT,equal(account.id())).exec(db);
|
||||
var rs = select(ALL).from(TABLE_TRANSACTIONS).where(Field.ACCOUNT,equal(account.id())).sort(Field.TIMESTAMP).exec(db);
|
||||
while (rs.next()) list.add(Transaction.of(rs));
|
||||
rs.close();
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user