Beispiel #1
0
def add_expense(amount, description):
    expense = ExpenseSchema().load(amount=amount, description=description)
    db.session.add(expense.data)
    db.session.commit()
Beispiel #2
0
def get_expenses():
    schema = ExpenseSchema(many=True)
    expenses = schema.dump(Expense.query.all())
    return expenses.data
Beispiel #3
0
def get_expenses():
  schema = ExpenseSchema(many=True)
  expenses = schema.dump(
    filter(lambda t: t.type == TransactionType.EXPENSE, transactions)
  )
  return jsonify(expenses.data)
Beispiel #4
0
def add_expense():
  expense = ExpenseSchema().load(request.get_json())
  transactions.append(expense.data)
  return '', 204
Beispiel #5
0
def add_expense():
    expense = ExpenseSchema().load(request.get_json())
    transactions.append(expense)
    return jsonify({"updated": "true"})