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

[DFC API] add image to product #11756

Merged

Conversation

rioug
Copy link
Collaborator

@rioug rioug commented Nov 3, 2023

ℹ️ This is a funded feature :

  • All Global work to be tracked in Clockify 11242 Discovery Endpoints - including testing, code review etc
  • Aus devs to track in 11242 Task within Macdoch Regen Discovery

What? Why?

As explained on the issue, we don't think DFC can make image available on supplied product in a timely manner. So we work around that by adding a ofn specific identifier "ofn:image". It will eventually be replace by "dfc_b:image" in the DFC connector.
This is read only, we don't support adding a product with an image

What should we test?

  • specs only

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • [] User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

@rioug rioug self-assigned this Nov 3, 2023
@rioug rioug added the technical changes only These pull requests do not contain user facing changes and are grouped in release notes label Nov 3, 2023
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

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

Nice work!

I would try to keep the docs reproducible but otherwise it's all good.

engines/dfc_provider/spec/spec_helper.rb Outdated Show resolved Hide resolved
@@ -14,6 +14,7 @@ def self.supplied_product(variant)
productType: product_type,
quantity: QuantitativeValueBuilder.quantity(variant),
spree_product_id: variant.product.id,
image_url: variant.product&.image&.url(:product)
Copy link
Member

Choose a reason for hiding this comment

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

On production, this will directly link to AWS S3. And in order to do that for variants, it will process the image first. That shouldn't be a problem because all images should be processed already. Just flagging it here in case there's some performance issue later.

swagger/dfc.yaml Outdated
@@ -343,11 +343,12 @@ paths:
dfc-b:usageOrStorageCondition: ''
dfc-b:totalTheoreticalStock: 0.0
ofn:spree_product_id: 90000
ofn:image: http://test.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBZzBCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--cec5b9e04720cada9134f6757e3dd8156aeccbf0/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFId2FRSHciLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--a8632e6a563a139dfae774530b275266f6aef5f5/logo-white.png
Copy link
Member

Choose a reason for hiding this comment

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

This value may change every time we generate the documentation. In other specs, I replaced variable values with a fixed value so that we don't see random changes.

Comment on lines -350 to +351
dfc-b:stockLimitation: 0
dfc-b:stockLimitation: 5
Copy link
Member

Choose a reason for hiding this comment

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

I guess that's due to the different factory used?

@dacook dacook self-requested a review November 8, 2023 02:48
Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

Looks good, thought it seems worth checking if the FileHelper commit can be removed as per Maikel's comment.
That should be easy to try. Trying...

@dacook dacook force-pushed the 11712_DFC_add_image_to_product branch from 94aae11 to f76bdf0 Compare November 8, 2023 02:58
@mkllnk mkllnk merged commit 4e52fc2 into openfoodfoundation:master Nov 8, 2023
49 of 50 checks passed
@mkllnk mkllnk added the api changes These pull requests change the API and can break integrations label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api changes These pull requests change the API and can break integrations technical changes only These pull requests do not contain user facing changes and are grouped in release notes
Projects
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

Get Product image on DFC Product Connector
3 participants