def delete_account(): if request.method == 'POST': user_id = request.form['user_id'] UserHandler.delete_account(user_id) return jsonify({'success': True}) else: return jsonify({'fail': True})
def delete_id(): if request.method == 'POST': photo_id = request.form['photo_id'] UserHandler.delete_id(photo_id) return jsonify(({'photo_id': int(photo_id)})) else: return jsonify({'fail': True})
def view_all(): if request.method == 'POST': user_id = request.form['user_id'] photos = list(UserHandler.get_all_photos(user_id)) return jsonify({'photos': photos}) else: return jsonify({'fail': True})
def get_user(): if request.method == 'POST': email = request.form['email'] user = UserHandler().get_user(email) return jsonify({'user': user}) else: return jsonify({'fail': True})
def edit_phone(): if request.method == 'POST': email, phone = request.form['email'], request.form['phone'] user = UserHandler().edit_user_phone(email, phone) return jsonify({'user': user}) else: return jsonify({'fail': True})
def get_user_by_id(): if request.method == 'POST': user_id = request.form['user_id'] user = UserHandler().get_user_by_id(user_id) return jsonify({'user': user}) else: return jsonify({'fail': True})
def change_profile_photo(): if request.method == 'POST': email = request.form['email'] photo = request.files['photo'] user = UserHandler().change_profile_photo(email, photo) return jsonify({'user': user}) else: return jsonify({'fail': True})