feat(item): expose recipeId, rawIngredient, and ingredients#57
Open
arunderwood wants to merge 1 commit intokevdliu:masterfrom
Open
feat(item): expose recipeId, rawIngredient, and ingredients#57arunderwood wants to merge 1 commit intokevdliu:masterfrom
arunderwood wants to merge 1 commit intokevdliu:masterfrom
Conversation
Items added from recipes carry recipe-origin data in the protobuf response but the Item class did not surface it. This adds read-only access to recipeId, rawIngredient, and the ingredients array which tracks multiple recipe sources for merged grocery items.
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.
Summary
recipeId,rawIngredient, andingredientson theItemclassListItemdefinition but were not surfaced by the JS classrecipeIdandrawIngredientidentify the recipe an item was added fromingredientsis an array tracking multiple recipe sources when items are merged (each entry hasrecipeId,recipeName,eventId,eventDate)identifieranduserIdMotivation
The AnyList UI shows which recipe an item was added from, but this data was inaccessible through the package. The protobuf layer already deserializes these fields — they just needed to be wired up in the
Itemconstructor, getters,toJSON(), and_encode().Changes
lib/item.js: Added constructor initialization, read-only getters with throwing setters, JSDoc@propertytags, and serialization support in bothtoJSON()and_encode()lib/index.js: Fixed pre-existing lint error (missing blank line)Test plan
xolinter passesdocumentation buildsucceeds (via pre-commit hook)recipeIdandrawIngredientvalues