From 5959b692deb8bc23294916eb632cec82f7571017 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Sun, 19 Sep 2021 15:04:53 +0200 Subject: [PATCH] Change order saving endpoint and remove position property --- app/Http/Controllers/TwoFAccountController.php | 1 - app/Http/Resources/TwoFAccountReadResource.php | 1 - routes/api.php | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Http/Controllers/TwoFAccountController.php b/app/Http/Controllers/TwoFAccountController.php index 5215a062..c403fb8e 100644 --- a/app/Http/Controllers/TwoFAccountController.php +++ b/app/Http/Controllers/TwoFAccountController.php @@ -44,7 +44,6 @@ class TwoFAccountController extends Controller */ public function index(Request $request) { - $request->merge(['withPosition' => true]); $request->merge(['hideSecret' => true]); return TwoFAccountReadResource::collection(TwoFAccount::ordered()->get()); diff --git a/app/Http/Resources/TwoFAccountReadResource.php b/app/Http/Resources/TwoFAccountReadResource.php index 6e7860cc..83872d46 100644 --- a/app/Http/Resources/TwoFAccountReadResource.php +++ b/app/Http/Resources/TwoFAccountReadResource.php @@ -16,7 +16,6 @@ class TwoFAccountReadResource extends TwoFAccountStoreResource [ 'id' => $this->id, 'group_id' => $this->group_id, - 'position' => $this->when($request->input('withPosition'), $this->order_column), ], parent::toArray($request) ); diff --git a/routes/api.php b/routes/api.php index c377fe50..22d15599 100644 --- a/routes/api.php +++ b/routes/api.php @@ -37,7 +37,7 @@ Route::group(['middleware' => 'auth:api'], function() { }); Route::delete('twofaccounts/batch', 'TwoFAccountController@batchDestroy'); - Route::patch('twofaccounts/sort-order', 'TwoFAccountController@reorder'); + Route::post('twofaccounts/reorder', 'TwoFAccountController@reorder'); Route::post('twofaccounts/preview', 'TwoFAccountController@preview'); Route::get('twofaccounts/{twofaccount}/qrcode', 'QrCodeController@show'); Route::get('twofaccounts/count', 'TwoFAccountController@count');