-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] - Add checkoutByTag API endpoint for assets #11417
Conversation
💖 Thanks for this pull request! 💖 We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
*/ | ||
public function checkoutByTag(AssetCheckoutRequest $request, $tag) | ||
{ | ||
if ($asset = Asset::with('assetstatus')->with('assignedTo')->where('asset_tag', $tag)->first()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need the with('assetstatus')->with('assignedTo')
stuff? The checkout()
method already tries to determine if we can check the item out or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely - my bad, I did remove it but at one point, but must have added it back when I was working on my own checkinByTag function (before I found there already was one). Changes applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes requested
Congrats on merging your first pull request! 🎉🎉🎉 |
Description
Seeing as asset tags are unique, it should be safe to, and would be useful to be able to call the API and check out an asset using it's asset tag. We have each asset tagged with a barcode, and have an internally developed mobile app to quickly scan user ID cards, then the asset tag.
This extra endpoint means we no longer need to run a separate API call to look up the asset to get it's internal snipe ID first.
This uses essentially the same code from the GET /hardware/bytag/:asset_tag endpoint, and if the asset is found, calls the existing checkout function.
Type of change
Please delete options that are not relevant.
NOTE - there seems to be an undocumented new API endpoint for checkinByTag, which should be updated too.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: