@require_POST
@require_uth_domain
@login_or_basic
def vscan_upload(request, domain, **kwargs):

    scanner_serial = request.POST.get('scanner_serial', None)
    scan_id = request.POST.get('scan_id', None)

    response_code = None

    if not (scanner_serial and scan_id):
        response_data = {}
        response_data['result'] = 'failed'
        response_data['message'] = 'Missing required parameters'
        response_code = 500
    else:
        upload = VscanUpload(
            scanner_serial=scanner_serial,
            scan_id=scan_id,
        )
        upload.save()

        put_request_files_in_doc(request, upload)

        async_find_and_attach.delay(upload._id)

        response_data = {}
        response_data['result'] = 'success'
        response_data['message'] = ''

    return HttpResponse(
        json.dumps(response_data),
        content_type="application/json",
        status=response_code or 200
    )
Regression test for #16039: migrate with --database option.
dataset/ETHPy150Open dimagi/commcare-hq/custom/uth/views.py/vscan_upload--crossover with--dataset/ETHPy150Open django/django/tests/multiple_database/tests.py/MigrateTestCase.test_migrate_to_other_database