def perform_task(task_id): if 'file' not in request.files: raise NoFilePartFoundError() file = request.files['file'] if file.filename == "": raise NoFileNameFoundError() if not is_file_allowed(file.filename): raise FileFormatNotAllowedError() archive_location = path.join(app.config["TEMP_UPLOAD_PATH"], file.filename) file.save(archive_location) upload_id, num_left = UploadTask.add_upload(task_id, archive_location, None) if num_left == 0: return response({ "uploadId": upload_id, "numLeft": num_left, "status": "completed" }) else: return response({ "uploadId": upload_id, "numLeft": num_left, "status": "incomplete" })
def tasks(): if request.method == "POST": task_info = request.json task_id = UploadTask.create_upload_task(task_info["deviceId"], task_info["deviceType"], task_info["fileNum"], task_info["manualUploader"]) return response({"taskId": task_id}) return response(UploadTask.get_all_tasks())
def login(): return response({"sessionToken": uuid.uuid4()})
def search_data_types(search_text = ""): search_result = DataType.search_data_types(search_text) return response(search_result)
def data_types(): result = DataType.get_all_data_types() return response(result)