mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #11417 from ntbutler-nbcs/master
[Feature] - Add checkoutByTag API endpoint for assets
This commit is contained in:
commit
5af6330398
|
@ -746,7 +746,21 @@ class AssetsController extends Controller
|
|||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checkout an asset by its tag.
|
||||
*
|
||||
* @author [N. Butler]
|
||||
* @param string $tag
|
||||
* @since [v6.0.5]
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function checkoutByTag(AssetCheckoutRequest $request, $tag)
|
||||
{
|
||||
if ($asset = Asset::where('asset_tag', $tag)->first()) {
|
||||
return $this->checkout($request, $asset->id);
|
||||
}
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkout an asset
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
return array (
|
||||
'app_version' => 'v6.0.5',
|
||||
'full_app_version' => 'v6.0.5 - build 8230-g393c32558',
|
||||
'build_version' => '8230',
|
||||
'full_app_version' => 'v6.0.5 - build 8229-g94e723a88',
|
||||
'build_version' => '8229',
|
||||
'prerelease_version' => '',
|
||||
'hash_version' => 'g393c32558',
|
||||
'full_hash' => 'v6.0.5-102-g393c32558',
|
||||
'branch' => 'master',
|
||||
'hash_version' => 'g94e723a88',
|
||||
'full_hash' => 'v6.0.5-101-g94e723a88',
|
||||
'branch' => 'develop',
|
||||
);
|
|
@ -462,6 +462,13 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
|
|||
)->name('api.assets.show.bytag')
|
||||
->where('any', '.*');
|
||||
|
||||
Route::post('bytag/{any}/checkout',
|
||||
[
|
||||
Api\AssetsController::class,
|
||||
'checkoutByTag'
|
||||
]
|
||||
)->name('api.assets.checkout.bytag');
|
||||
|
||||
Route::get('byserial/{any}',
|
||||
[
|
||||
Api\AssetsController::class,
|
||||
|
|
Loading…
Reference in a new issue