Skip to content

feat(Products): New API endpoints to update/add Product Opener products and images#1012

Merged
raphodn merged 4 commits intomainfrom
ttalex/off-add-product-improvements
Oct 3, 2025
Merged

feat(Products): New API endpoints to update/add Product Opener products and images#1012
raphodn merged 4 commits intomainfrom
ttalex/off-add-product-improvements

Conversation

@TTalex
Copy link
Copy Markdown
Collaborator

@TTalex TTalex commented Sep 23, 2025

What

Comment thread open_prices/api/products/views.py Outdated
@action(
detail=False, methods=["PATCH", "POST"], url_path=r"off_update/(?P<code>.+)"
)
def update_off_product(self, request: Request, code):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Something tells me there should be a serializer somewhere here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

later ^^

Comment thread open_prices/api/products/views.py Outdated
Comment thread open_prices/common/openfoodfacts.py Outdated
flavor=flavor,
version=APIVersion.v2,
environment=Environment.org,
environment=Environment[os.getenv("ENVIRONMENT")],
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Could be a different PR, but this is quite useful when testing with products in OFF staging.

Copy link
Copy Markdown
Member

@raphodn raphodn Oct 3, 2025

Choose a reason for hiding this comment

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

moved it to a seperate commit : 89c6899

Comment thread open_prices/common/openfoodfacts.py Outdated
)


def update_off_product(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Called update, but can also create :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

renamed to create_or_update_product_in_off 😁

Comment thread open_prices/common/openfoodfacts.py Outdated
Comment thread open_prices/common/openfoodfacts.py Outdated
Comment thread open_prices/common/openfoodfacts.py Outdated

form_data = {}

form_data["user_id"] = (None, settings.OFF_DEFAULT_USER)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What if the setting isn't set ?

@TTalex
Copy link
Copy Markdown
Collaborator Author

TTalex commented Sep 25, 2025

Add a comment with the original user: (OpenPrices) username

Comment thread open_prices/api/products/filters.py Outdated
@TTalex TTalex marked this pull request as ready for review September 28, 2025 17:34
@raphodn raphodn force-pushed the ttalex/off-add-product-improvements branch 4 times, most recently from b247f29 to 712093e Compare October 2, 2025 20:35
@raphodn raphodn force-pushed the ttalex/off-add-product-improvements branch from 712093e to 7f2b79f Compare October 2, 2025 20:45
@raphodn raphodn force-pushed the ttalex/off-add-product-improvements branch from 7f2b79f to a7ab8cf Compare October 2, 2025 20:47
@github-project-automation github-project-automation Bot moved this from Backlog to Ready in 💸 Open Prices Oct 2, 2025
@raphodn raphodn changed the title feat(Product): APIs to update/add Product Opener products and images feat(Products): New API endpoints to update/add Product Opener products and images Oct 3, 2025
@raphodn raphodn merged commit 6851f91 into main Oct 3, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Mecanism to add new products to Product Opener

3 participants