def total_wallets(): period = get_period() total = WalletService.total_wallets(period) return jsonify({'total': total})
def get_transactions(): return serialize(TransactionService.get_transactions(get_period()), TransactionSerializer)
def add_wallet(): name = request.args.get('name') amount = int(request.args.get('amount')) period = get_period() wallet = WalletService.add_wallet(name, amount, period) return serialize(wallet, WalletSerializer)
def get_wallet_names(): period = get_period() wallet_names = WalletService.get_wallet_names(period) return jsonify(wallet_names)
def get_wallets(): period = get_period() return serialize(WalletService.get_wallets(period), WalletSerializer)
def total_budgets(): period = get_period() total = BudgetService.total_budgets(period.year, period.month) return jsonify({'total': total})
def add_budget(): name = request.args.get('name') amount = int(request.args.get('amount')) period = get_period() budget = BudgetService.add_budget(name, amount, period.year, period.month) return serialize(budget, BudgetSerializer)
def get_budget_names(): period = get_period() budget_names = BudgetService.get_budget_names(period.year, period.month) return jsonify(budget_names)
def get_budgets(): period = get_period() return serialize(BudgetService.get_budgets(period.year, period.month), BudgetSerializer)