Spaces:
Running
on
Zero
Running
on
Zero
File size: 764 Bytes
63f6011 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from src.models.transaction import Transaction
from src.repositories.transaction_repository import TransactionRepository
class TransactionService:
def __init__(self, transaction_repository: TransactionRepository):
self.transaction_repository = transaction_repository
def create_transaction(self, account_id: int, amount: float, type: str) -> Transaction:
# Create a new transaction for the account
transaction = Transaction(id=1, account_id=account_id, amount=amount, type=type) # Replace with actual ID generation
self.transaction_repository.save(transaction)
return transaction
def get_transactions(self, account_id: int) -> list[Transaction]:
return self.transaction_repository.get_all(account_id) |