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):
|
class Operation(Enum):
|
||||||
Init = auto()
|
Init = auto()
|
||||||
|
Transactions = auto()
|
||||||
Parse = auto()
|
Parse = auto()
|
||||||
Download = auto()
|
Download = auto()
|
||||||
Categorize = auto()
|
Categorize = auto()
|
||||||
|
|||||||
@ -34,14 +34,23 @@ class Manager:
|
|||||||
self._db = db
|
self._db = db
|
||||||
self._verbosity = verbosity
|
self._verbosity = verbosity
|
||||||
|
|
||||||
def action(self, op: Operation, params: list):
|
def action(self, op: Operation, params=None):
|
||||||
if self._verbosity > 0:
|
if self._verbosity > 0:
|
||||||
print(f"op={op}, params={params}")
|
print(f"op={op}, params={params}")
|
||||||
|
|
||||||
|
if params is None:
|
||||||
|
params = []
|
||||||
|
|
||||||
match (op):
|
match (op):
|
||||||
case Operation.Init:
|
case Operation.Init:
|
||||||
pass
|
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:
|
case Operation.Parse:
|
||||||
# Adapter for the parse_data method. Can be refactored.
|
# Adapter for the parse_data method. Can be refactored.
|
||||||
args = {"bank": params[1], "creditcard": params[2], "category": None}
|
args = {"bank": params[1], "creditcard": params[2], "category": None}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user