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