Skip to content
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

Checkout multiple of an accessory in one checkout #15114

Merged
merged 27 commits into from
Jul 18, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Jul 18, 2024

This allows the admin to check out multiple accessories at one time, and switches us over to using a form request, which lets us skip past a lot of the yuckier duplication between the API and the UI, confirming that the 1) accessory us valid 2) the user it's being checked out to is valid and 3) there are enough of that particular accessory type to fulfill a checkout - and, of course, adds some additional tests.

Copy link

what-the-diff bot commented Jul 18, 2024

PR Summary

  • Enhanced Accessory Checkout Process
    An update was made to the AccessoryCheckoutController, in which the store method now requires a more specialized AccessoryCheckoutRequest instead of a generic Request object. This enhances data validation process ensuring proper values are passed. The system now also correctly maintains the assigned_to and checkout_qty states for an accessory object, improving how the system keeps track of asset distribution.

  • Updated API Controller and Request Structure for Accessories
    The AccessoriesController for the API got an overhaul with this PR. Now, the various methods (store, show, checkout, and accessory_detail) have updated states for better performance and data integrity. They also accept specialized request objects (AccessoryCheckoutRequest, StoreAccessoryRequest), making the API calls safer with improved data validation.

  • Inclusion of SubstituteBindings Middleware
    The Middleware list under 'api' in Kernel.php will now include SubstituteBindings. This means route model binding will resolve Eloquent models automatically, making coding easier and cleaner.

  • Introduction of Dedicated Request Classes
    New dedicated request classes AccessoryCheckoutRequest and StoreAccessoryRequest have been introduced. These classes provide a layer of data validation for accessory checkouts and store operations, improving data integrity, and making the application safer.

  • Accessory Model Updates for Integrity
    Updates to the Accessory model will provide a more accurate count of checked-out items, improving bookkeeping abilities and reducing manual record keeping.

  • Checkout Notification Enhancements
    The CheckoutAccessoryNotification class now includes detailed checkout quantity information in notifications sent to Slack, Microsoft Teams, and emails. This provides a clear instant overview of checkout operations.

  • UI Refinements
    Made some changes to the checkout.blade.php and checkout-accessory.blade.php views. These changes provide a clearer overview of the total and remaining quantity, and better checkout field visibility. This enhances the user experience and prevents confusion in the checkout process.

  • Route Parameter Adjustment
    The checkout route in accessories.php now uses a more intuitive {accessory} parameter instead of {accessoryID}, making it easier for developers to understand and work with routes.

  • Improved Test Coverage
    The AccessoryCheckoutTest test class received enhancements, making the tests more comprehensive by individually checking for specific error messages. This will aid in quicker diagnosis of any future issues.

@snipe snipe changed the title WIP - Checkout multiple accessories Checkout multiple accessories Jul 18, 2024
@snipe snipe changed the title Checkout multiple accessories Checkout multiple of an accessory in one checkout Jul 18, 2024
@snipe snipe requested review from uberbrady and marcusmoore July 18, 2024 04:22
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I'm loving the route-model binding, loving the form requests, loving how short and simple the controllers are going to look, and LOVE the tests. I threw a couple of small nits in there but they're pretty simple. I know this was a lot of work but this section of the app has needed some love for a while. Thank you for doing it!

app/Models/Accessory.php Outdated Show resolved Hide resolved
app/Http/Requests/StoreAccessoryRequest.php Show resolved Hide resolved
@snipe snipe merged commit 4465aef into develop Jul 18, 2024
8 of 9 checks passed
@snipe snipe deleted the checkout_multiple_accessories branch July 18, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants