From 67e9b7795a927fd702deb6b76876efe6ef832787 Mon Sep 17 00:00:00 2001 From: Nathan Butler Date: Wed, 29 Jun 2022 16:11:57 +1000 Subject: [PATCH 1/4] Added asset checkoutByTag API endpoint --- app/Http/Controllers/Api/AssetsController.php | 16 +++++++++++++++- routes/api.php | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index d4e7a7a8b2..1f3a7a56d7 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -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::with('assetstatus')->with('assignedTo')->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 diff --git a/routes/api.php b/routes/api.php index 29af435687..faabaa28e4 100644 --- a/routes/api.php +++ b/routes/api.php @@ -441,6 +441,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, From e28e7e37b8f8cb908719da445fef706101ba3995 Mon Sep 17 00:00:00 2001 From: Nathan Butler Date: Wed, 29 Jun 2022 17:49:50 +1000 Subject: [PATCH 2/4] Removed unneeded checks when searching for asset --- app/Http/Controllers/Api/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 1f3a7a56d7..ebb19159dd 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -756,7 +756,7 @@ class AssetsController extends Controller */ public function checkoutByTag(AssetCheckoutRequest $request, $tag) { - if ($asset = Asset::with('assetstatus')->with('assignedTo')->where('asset_tag', $tag)->first()) { + 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); From 6531657ee0f65ed087fe8cb3d6fc418a3662382f Mon Sep 17 00:00:00 2001 From: Nathan Butler Date: Wed, 29 Jun 2022 18:00:15 +1000 Subject: [PATCH 3/4] Revert version to dev for pull request --- config/version.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/version.php b/config/version.php index f5fc4bb380..fd17b0c4cc 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ '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', ); \ No newline at end of file From f8fd87b896ade15db32bc544af387df8edab5956 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 29 Jun 2022 05:03:56 -0700 Subject: [PATCH 4/4] Add @ntbutler-nbcs as a contributor --- .all-contributorsrc | 9 +++++++++ README.md | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0a3b0e93b3..0008cebb7d 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2628,6 +2628,15 @@ "avatar_url": "https://avatars.githubusercontent.com/u/1294403?v=4", "profile": "https://github.com/denzfarid", "contributions": [] + }, + { + "login": "ntbutler-nbcs", + "name": "ntbutler-nbcs", + "avatar_url": "https://avatars.githubusercontent.com/u/94018771?v=4", + "profile": "https://github.com/ntbutler-nbcs", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index 331bae8f30..7c6af8770d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![Build Status](https://app.chipperci.com/projects/0e5f8979-31eb-4ee6-9abf-050b76ab0383/status/master) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeitapp.svg?style=social)](https://twitter.com/snipeitapp) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade) -[![All Contributors](https://img.shields.io/badge/all_contributors-289-orange.svg?style=flat-square)](#contributors) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk) [![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev) +[![All Contributors](https://img.shields.io/badge/all_contributors-290-orange.svg?style=flat-square)](#contributors) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk) [![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev) ## Snipe-IT - Open Source Asset Management System @@ -132,7 +132,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken | [
Toreg87](https://github.com/Toreg87)
[💻](https://github.com/snipe/snipe-it/commits?author=Toreg87 "Code") | [
Matthew Nickson](https://github.com/Computroniks)
[💻](https://github.com/snipe/snipe-it/commits?author=Computroniks "Code") | [
Jethro Nederhof](https://jethron.id.au)
[💻](https://github.com/snipe/snipe-it/commits?author=jethron "Code") | [
Oskar Stenberg](https://github.com/01ste02)
[💻](https://github.com/snipe/snipe-it/commits?author=01ste02 "Code") | [
Robert-Azelis](https://github.com/Robert-Azelis)
[💻](https://github.com/snipe/snipe-it/commits?author=Robert-Azelis "Code") | [
Alexander William Smith](https://github.com/alwism)
[💻](https://github.com/snipe/snipe-it/commits?author=alwism "Code") | [
LEITWERK AG](https://www.leitwerk.de/)
[💻](https://github.com/snipe/snipe-it/commits?author=leitwerk-ag "Code") | | [
Adam](http://www.aboutcher.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=adamboutcher "Code") | [
Ian](https://snksrv.com)
[💻](https://github.com/snipe/snipe-it/commits?author=sneak-it "Code") | [
Shao Yu-Lung (Allen)](http://blog.bestlong.idv.tw/)
[💻](https://github.com/snipe/snipe-it/commits?author=bestlong "Code") | [
Haxatron](https://github.com/Haxatron)
[💻](https://github.com/snipe/snipe-it/commits?author=Haxatron "Code") | [
PlaneNuts](https://github.com/PlaneNuts)
[💻](https://github.com/snipe/snipe-it/commits?author=PlaneNuts "Code") | [
Bradley Coudriet](http://bjcpgd.cias.rit.edu)
[💻](https://github.com/snipe/snipe-it/commits?author=exula "Code") | [
Dalton Durst](https://daltondur.st)
[💻](https://github.com/snipe/snipe-it/commits?author=UniversalSuperBox "Code") | | [
Alex Janes](https://adagiohealth.org)
[💻](https://github.com/snipe/snipe-it/commits?author=adagioajanes "Code") | [
Nuraeil](https://github.com/nuraeil)
[💻](https://github.com/snipe/snipe-it/commits?author=nuraeil "Code") | [
TenOfTens](https://github.com/TenOfTens)
[💻](https://github.com/snipe/snipe-it/commits?author=TenOfTens "Code") | [
waffle](https://ditisjens.be/)
[💻](https://github.com/snipe/snipe-it/commits?author=insert-waffle "Code") | [
Yevhenii Huzii](https://github.com/QveenSi)
[💻](https://github.com/snipe/snipe-it/commits?author=QveenSi "Code") | [
Achmad Fienan Rahardianto](https://github.com/veenone)
[💻](https://github.com/snipe/snipe-it/commits?author=veenone "Code") | [
Yevhenii Huzii](https://github.com/QveenSi)
[💻](https://github.com/snipe/snipe-it/commits?author=QveenSi "Code") | -| [
Christian Weirich](https://github.com/chrisweirich)
[💻](https://github.com/snipe/snipe-it/commits?author=chrisweirich "Code") | [
denzfarid](https://github.com/denzfarid)
| +| [
Christian Weirich](https://github.com/chrisweirich)
[💻](https://github.com/snipe/snipe-it/commits?author=chrisweirich "Code") | [
denzfarid](https://github.com/denzfarid)
| [
ntbutler-nbcs](https://github.com/ntbutler-nbcs)
[💻](https://github.com/snipe/snipe-it/commits?author=ntbutler-nbcs "Code") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!