def update_shippers(): cn_db = db_ship.shippers(con_db) data = request.json ship1 = ship.shippers(data['shipper_id'], data['company_name'], data['phone']) rs = cn_db.update(ship1) return jsonify({'message': rs}), 200
def insert_shippers(): cn_db = db_ship.shippers(con_db) data = request.json ship1 = ship.shippers(1, data['company_name'], data['phone']) rs = cn_db.insert(ship1) return jsonify({'message': rs}), 200
def one_shippers(shipper_id): c = ship.shippers(shipper_id=shipper_id) rs = db_ship.shippers(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_shippers(shipper_id): cn_db = db_ship.shippers(con_db) rs = cn_db.delete(shipper_id) return jsonify({'message': rs}), 200
def all_shippers(): result = db_ship.shippers(con_db).get_all() return jsonify({'data': result}), 200