-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently MapRewire returns both the original map and the new map. This means we need to create boilerplate to be able to use MapRewire in a pipeline:
def changeset(variant, params) do
variant
|> normalize_data()
|> cast(
params,
~w(shopify_id title price weight compare_at_price requires_shipping sku available image_id option1 option2 option3)
)
end
defp normalize_data(data) do
[_old, new] = data <~> @transforms
new
end
To reduce the amount of boilerplate needed to use MapRewire we should consider creating a normalize_data function that can be used in a typical changeset:
def changeset(variant, params) do
variant
|> normalize_data(params, @transforms)
|> cast(
params,
~w(shopify_id title price weight compare_at_price requires_shipping sku available image_id option1 option2 option3)
)
end
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request