Example #1
0
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"
        })
Example #2
0
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())
Example #3
0
def login():
    return response({"sessionToken": uuid.uuid4()})
Example #4
0
def search_data_types(search_text = ""):
    search_result =  DataType.search_data_types(search_text)
    return response(search_result)
Example #5
0
def data_types():
    result = DataType.get_all_data_types()
    return response(result)