Beispiel #1
0
def add_income(amount, description):
    income = IncomeSchema().load({
        'amount': amount,
        'description': description
    })
    db.session.add(income.data)
    db.session.commit()
Beispiel #2
0
def get_incomes():
    schema = IncomeSchema(many=True)
    incomes = schema.dump(Income.query.all())
    return incomes.data
Beispiel #3
0
def get_incomes():
  schema = IncomeSchema(many=True)
  incomes = schema.dump(
    filter(lambda t: t.type == TransactionType.INCOME, transactions)
  )
  return jsonify(incomes.data)
Beispiel #4
0
def add_income():
  income = IncomeSchema().load(request.get_json())
  transactions.append(income.data)
  return '', 204
Beispiel #5
0
def add_income():
    income = IncomeSchema().load(request.get_json())
    transactions.append(income)
    return jsonify({"updated": "true"})