API Support for Price Lists and Price List Items#30
Open
JustShah wants to merge 6 commits into
Open
Conversation
4f039e0 to
e741a9d
Compare
Added APIs to create, update, read and destroy price lists and price list items, price list items accepts nested attribute for price which creates and updates only which are related to the price list.
- Added preferences for `:price_list_attributes`, `:price_attributes`, and `:price_list_item_attributes` in API configuration. - This allows for better control over which attributes are permitted in API requests and responses.
- Added Jbuilder partial `_price_list_item.json.jbuilder` for rendering individual price list items. - Created `index.json.jbuilder` to render a list of price list items and price lists with pagination. - Created `show.json.jbuilder` to render a single price list item and price list. - Added Jbuilder partial `_price_list.json.jbuilder` for rendering individual price lists.
Added nested routes for `price_list_items` under `price_lists` in the API routes. This allows for better organization and access to price list items related to specific price lists.
- Added validations to `Spree::PriceListItem` for currency and country consistency. - Implemented callbacks to set default currency and country based on the associated price list.
- Added `:price_attributes`, `:price_list_attributes`, and `:price_list_item_attributes` to permitted attributes. - This ensures that these attributes can be safely handled in API requests.
de53cc2 to
6d7c62f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This update introduces comprehensive API support for managing price lists and their associated prices in the Solidus store.
Key Changes:
Created API Endpoints
price_listsand nestedprice_list_items.Nested Price Attribute Handling
price_list_itemsnow acceptprice_attributesvia nested attributes for seamless creation/updating of prices tied to the correct price list.Validation Enhancements
Spree::PriceListItemto ensure that the currency and country ISO match those of the associated price list.currencyandcountry_isofrom the price list if not provided explicitly.Permitted Attributes Updates
:price_attributes,:price_list_attributes, and:price_list_item_attributes.API Configuration
Jbuilder Views