Beispiel #1
0
def update_producto(producto_id):
    producto = Producto.find_or_fail(producto_id)
    producto.update(**request.get_json())
    return jsonify(producto)
Beispiel #2
0
def category_with_diseases(id):
	return jsonify(
		db.table('diseases').where('category_id', id).get()
		)
Beispiel #3
0
def category():
    category = db.table('categories').get()
    return jsonify(category), 200
Beispiel #4
0
def update_payment(id):
    db.table('user_orders').where('id', id).update({'purchased': 1})
    return jsonify({'message': 'success'}), 200
Beispiel #5
0
def update_categories(id):
	if request.is_json:
		return jsonify(db.table('categories').where('id', id).update(request.get_json()))
	else:
		return jsonify({"ERR": "You must hAve JSON"})
def create_message(user_id):
    user = User.find_or_fail(user_id)

    return jsonify(user.messages().create(**request.get_json()))
def create_user():
    user = User.create(**request.get_json())

    return jsonify(user)
Beispiel #8
0
def single(id):
    return jsonify(db.table('diseases').where('id',id).first())
Beispiel #9
0
def disease_treatment(id):
    d = db.table('diseases').where('id',id).first()
    return jsonify(
    	d
	)
Beispiel #10
0
def index():
    if request.is_json:
        disease = db.table('diseases').insert(request.get_json())
        return jsonify(disease),201
    else:
        return jsonify({"ERR": "You must hAve JSON"})
Beispiel #11
0
def update_disease(id):
    if request.is_json:
        disease =  db.table('diseases').where('id',id).update(request.get_json())
        return jsonify(disease)
    else:
        return jsonify({"ERR": "You must hAve JSON"})
Beispiel #12
0
def about_app():
    return jsonify(db.select("select text,contact from about limit 1")[0])
Beispiel #13
0
def disease():
    sql = "SELECT * , (select categories.name from categories where categories.id = diseases.category_id) as category FROM diseases"
    alt = db.select(sql)
    disease =  db.table('diseases').get()
    return jsonify(alt)
Beispiel #14
0
def delete_producto(producto_id):
    producto = Producto.find_or_fail(producto_id)
    producto.delete()
    return jsonify(producto)
def get_all_users():
    users = User.all()

    return jsonify(users)
Beispiel #16
0
def disease_tests(id):
    d = db.table('blood_tests').select('name','variable').where('disease_id',id).get()
    return jsonify(
		d.serialize()
	)
def update_user(user_id):
    user = User.find_or_fail(user_id)
    user.update(**request.get_json())

    return jsonify(user)
Beispiel #18
0
def categories_indicators(id):
    d = db.table('indicators').select('id','name','variable','description','default_unit').where('categories_id',id).get()
    return jsonify(
		d.serialize()
	)
def get_user_followers(user_id):
    user = User.find_or_fail(user_id)

    return jsonify(user.followers)
Beispiel #20
0
def remove_indicators(id):
    d = db.table('indicators').where('id',id).delete()
    return jsonify({'message':'deleted'}),200
Beispiel #21
0
def get_recent_diagnosis(id):
    sql = "SELECT * FROM user_orders WHERE user_id = {} order by id desc limit 1"
    y = db.select(sql.format(id))
    return jsonify(y), 200
def update_message(message_id):
    message = Message.find_or_fail(message_id)
    message.update(**request.get_json())

    return jsonify(message)
Beispiel #23
0
def set_categories():
	if request.is_json:
		category = db.table('categories').insert(request.get_json())
		return jsonify(category)
	else:
		return jsonify({"ERR": "You must hAve JSON"})
def delete_message(message_id):
    message = Message.find_or_fail(message_id)
    message.delete()

    return jsonify({"result": "message deleted"})
Beispiel #25
0
def single_category(id):
	return jsonify(db.table('categories').where('id', id).first())
def get_message(message_id):
    message = Message.find_or_fail(message_id)

    return jsonify(message)
Beispiel #27
0
def test_api():
    sql = "CALL all_diseases_info()";
    return jsonify(db.select(sql)),200
def get_user(user_id):
    user = User.find_or_fail(user_id)

    return jsonify(user)
Beispiel #29
0
def get_user_messages(user_id):
    user = User.find_or_fail(user_id)
    return jsonify(user.messages)
Beispiel #30
0
def get_producto(producto_id):
    producto = Producto.find(producto_id)
    return jsonify(producto)