Reverted work on revisions

Improved linkage of drawings and image manager.
Updated image updates to create new versions.
This commit is contained in:
Dan Brown
2018-05-20 16:40:30 +01:00
parent 6cdb943916
commit 0c9c1e4c6b
10 changed files with 33 additions and 277 deletions

View File

@ -164,32 +164,6 @@ class ImageController extends Controller
return response()->json($image);
}
/**
* Replace the data content of a drawing.
* @param string $id
* @param Request $request
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function updateDrawing(string $id, Request $request)
{
$this->validate($request, [
'image' => 'required|string'
]);
$this->checkPermission('image-create-all');
$imageBase64Data = $request->get('image');
$image = $this->imageRepo->getById($id);
$this->checkOwnablePermission('image-update', $image);
try {
$image = $this->imageRepo->updateDrawing($image, $imageBase64Data);
} catch (ImageUploadException $e) {
return response($e->getMessage(), 500);
}
return response()->json($image);
}
/**
* Get the content of an image based64 encoded.
* @param $id
@ -257,22 +231,11 @@ class ImageController extends Controller
return response()->json($pageSearch);
}
/**
* Get the revisions for an image.
* @param $id
* @return \Illuminate\Http\JsonResponse
*/
public function getRevisions($id)
{
$image = $this->imageRepo->getById($id);
$revisions = $image->revisions()->orderBy('id', 'desc')->get();
return response()->json($revisions);
}
/**
* Deletes an image and all thumbnail/image files
* @param int $id
* @return \Illuminate\Http\JsonResponse
* @throws \Exception
*/
public function destroy($id)
{