You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
967 B
38 lines
967 B
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Ingest\DocumentHandler;
|
|
|
|
class IngestController extends Controller
|
|
{
|
|
public function store()
|
|
{
|
|
request()->validate([
|
|
'id' => 'required',
|
|
'file_result_type' => 'required|in:md,original',
|
|
'mime_type' => 'required',
|
|
'document' => 'required|file',
|
|
]);
|
|
|
|
try {
|
|
$handler = new DocumentHandler(
|
|
request()->get('id'),
|
|
request()->get('file_result_type'),
|
|
request()->get('mime_type'),
|
|
request()->file('document')
|
|
);
|
|
|
|
$handler->handle();
|
|
|
|
return response()->json(array(
|
|
'status' => 'processing',
|
|
));
|
|
} catch (\Exception $exception) {
|
|
return response()->json([
|
|
'status' => 'error',
|
|
'message' => $exception->getMessage(),
|
|
], 400);
|
|
}
|
|
}
|
|
}
|