Adds get all transactions operation
This commit is contained in:
parent
dd724b6c28
commit
1a774e3769
@ -6,6 +6,7 @@ from enum import Enum, auto
|
||||
|
||||
class Operation(Enum):
|
||||
Init = auto()
|
||||
Transactions = auto()
|
||||
Parse = auto()
|
||||
Download = auto()
|
||||
Categorize = auto()
|
||||
|
||||
@ -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}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user