diff --git a/pfbudget/common/types.py b/pfbudget/common/types.py index 0fe3efe..d999009 100644 --- a/pfbudget/common/types.py +++ b/pfbudget/common/types.py @@ -6,6 +6,7 @@ from enum import Enum, auto class Operation(Enum): Init = auto() + Transactions = auto() Parse = auto() Download = auto() Categorize = auto() diff --git a/pfbudget/core/manager.py b/pfbudget/core/manager.py index 227a8f4..9435e90 100644 --- a/pfbudget/core/manager.py +++ b/pfbudget/core/manager.py @@ -34,14 +34,23 @@ class Manager: self._db = db self._verbosity = verbosity - def action(self, op: Operation, params: list): + def action(self, op: Operation, params=None): if self._verbosity > 0: print(f"op={op}, params={params}") + if params is None: + params = [] + match (op): case Operation.Init: pass + case Operation.Transactions: + with self.db.session() as session: + transactions = session.get(Transaction) + ret = [t.format for t in transactions] + return ret + case Operation.Parse: # Adapter for the parse_data method. Can be refactored. args = {"bank": params[1], "creditcard": params[2], "category": None}