Skip to content

Commit

Permalink
feat: support for the new features field
Browse files Browse the repository at this point in the history
Allowing control of Product display
  • Loading branch information
joamag committed Jul 5, 2021
1 parent 9ac8281 commit ae1f60e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

*
* Support for `features` in the `Product` model

### Changed

Expand Down
23 changes: 20 additions & 3 deletions src/budy/models/product.py
Expand Up @@ -212,15 +212,30 @@ class Product(base.BudyBase):
thumbnail_url = appier.field(
index = "hashed",
meta = "image_url",
description = "Thumbnail URL"
description = "Thumbnail URL",
observations = """The URL to the thumbnail image (low resolution)
to be used in listing contexts"""
)

characteristics = appier.field(
type = list
type = list,
observations = """The sequence of characteristics that
define the product under unstructured language"""
)

features = appier.field(
type = dict,
observations = """Dictionary that maps a set of optional
features with their corresponding configuration, for example
the `initials` feature can be associated with the rules
that control those same initials"""
)

labels = appier.field(
type = list
type = list,
observations = """Set of simple tag labels that define the
product behavior, this value is a calculated one based on
the labels provided by the complete set of collections"""
)

brand_s = appier.field(
Expand Down Expand Up @@ -363,6 +378,7 @@ def token_names(cls):
("brand.name", True),
("season.name", True),
("characteristics", False),
("features", False),
("colors.name", True),
("categories.name", True),
("collections.name", True),
Expand Down Expand Up @@ -475,6 +491,7 @@ def from_omni(
product.order = order
product.discountable = discountable
product.characteristics = metadata.get("characteristics", [])
product.features = metadata.get("features", {})
product.colors = colors
product.categories = categories
product.collections = collections
Expand Down

0 comments on commit ae1f60e

Please sign in to comment.