Exemplo n.º 1
0
 def test_session_query_daily_eat_assert_equal_true(self):
     session = orm.session
     rows = session.query(DailyEat).filter_by(user_id="test",
                                              food="test",
                                              year=1,
                                              month=1,
                                              date=1).all()
     result = orm.as_list_dict(rows)
     self.assertEqual(result[0]["user_id"], "test")
     self.assertEqual(result[0]["food"], "test")
     self.assertEqual(result[0]["year"], 1)
     self.assertEqual(result[0]["month"], 1)
     self.assertEqual(result[0]["date"], 1)
Exemplo n.º 2
0
def get_user_bodys_by_user_id(user_id):
    bodys = session.query(UserBody).filter_by(user_id=user_id).all()
    list_bodys = orm.as_list_dict(bodys)
    return jsonify(user_bodys=list_bodys)
Exemplo n.º 3
0
def all():
    bodys = session.query(UserBody).all()
    list_bodys = orm.as_list_dict(bodys)
    print(list_bodys)
    return jsonify(user_bodys=list_bodys)
Exemplo n.º 4
0
def get_daily_eat_by_user_id(user_id):
    daily_eats = session.query(DailyEat).filter_by(user_id=user_id).all()
    list_daily_eats = orm.as_list_dict(daily_eats)
    return jsonify(daily_eats=list_daily_eats)
Exemplo n.º 5
0
def all():
    daily_eats = session.query(DailyEat).all()
    list_daily_eats = orm.as_list_dict(daily_eats)
    return jsonify(daily_eats=list_daily_eats)
Exemplo n.º 6
0
def get_user_by_id(id):
    users = session.query(User).filter_by(id=id).all()
    list_users = orm.as_list_dict(users)
    return jsonify(users=list_users)
Exemplo n.º 7
0
def all():
    users = session.query(User).all()
    list_users = orm.as_list_dict(users)
    print(list_users)
    return jsonify(users=list_users)
Exemplo n.º 8
0
 def test_session_query_user_assert_equal_true(self):
     session = orm.session
     rows = session.query(User).filter_by(id="test").all()
     result = orm.as_list_dict(rows)
     self.assertEqual(result[0]["id"], "test")
     self.assertEqual(result[0]["password"], "test")
Exemplo n.º 9
0
def get_food_by_name(name):
    foods = session.query(Food).filter_by(name=name).all()
    list_foods = orm.as_list_dict(foods)
    return jsonify(foods=list_foods)
Exemplo n.º 10
0
def all():
    foods = session.query(Food).all()
    list_foods = orm.as_list_dict(foods)
    return jsonify(foods=list_foods)