Merge pull request #11417 from ntbutler-nbcs/master

[Feature] - Add checkoutByTag API endpoint for assets
This commit is contained in:
snipe 2022-06-29 05:03:01 -07:00 committed by GitHub
commit 5af6330398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 6 deletions

View file

@ -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

View file

@ -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',
);

View file

@ -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,