def update_categories(): cn_db = db_cate.categories(con_db) data = request.json cate1 = cate.categories(data['category_id'], data['category_name'], data['description'], data['picture']) rs = cn_db.update(cate1) return jsonify({'message': rs}), 200
def one_categories(cate_id): c = cate.categories(category_id=cate_id) rs = db_cate.categories(con_db).get_by_id(c) if rs[1] != 200: return jsonify({'message': rs[0]}), rs[1] return jsonify({'message': rs[0].to_json()}), 200
def delete_categories(cate_id): cn_db = db_cate.categories(con_db) result = cn_db.delete(cate_id) return jsonify({'message': result}), 200
def all_categories(): result = db_cate.categories(con_db).get_all() return jsonify({'data': result}), 200