-
Notifications
You must be signed in to change notification settings - Fork 0
Product more properties #27
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
Conversation
4b1c572 to
d526726
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request significantly expands the Product struct to include a comprehensive set of nutritional properties. The PR removes the previous complex structure with _value, _unit, _serving, and truncate tags, replacing it with a simpler two-field pattern (base and _100g variants) for each nutrient.
Changes:
- Replaced the old Nutriments structure with an expanded list of ~180 nutritional properties (90 pairs of base + _100g fields)
- Replaced the old NutrimentsEstimated structure with the same expanded set of properties
- Updated Swagger documentation files (swagger.yaml, swagger.json, docs.go) to reflect the new schema
- Removed fields: _value, _unit, _serving variants, truncate BSON option, nova-group fields, and fruits-vegetables-legumes-estimate fields
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/database/product/product.go | Expanded Nutriments and NutrimentsEstimated structs with comprehensive nutritional properties using a simplified two-field pattern (base and _100g) |
| docs/swagger.yaml | Updated API documentation to reflect new Product schema fields |
| docs/swagger.json | Updated API documentation (JSON format) to reflect new Product schema fields |
| docs/docs.go | Updated embedded API documentation to reflect new Product schema fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| StearicAcid100g float64 `json:"stearic-acid_100g" bson:"stearic-acid_100g"` | ||
| StearicAcid float64 `json:"stearic-acid" bson:"stearic-acid"` | ||
| ArachidicAcid100g float64 `json:"arachidic-acid_100g" bson:"arachidic-acid_100g"` | ||
| ArachidicAcid float64 `json:"arachidic-acid" bson:"arachidonic-acid"` |
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BSON tag for ArachidicAcid is "arachidonic-acid" but the JSON tag is "arachidic-acid". These should match. Arachidic acid and arachidonic acid are two different fatty acids. Based on the field name and the JSON tag, this should be "arachidic-acid" in both places. This mismatch will cause data to be stored under the wrong field name in the database.
| ArachidicAcid float64 `json:"arachidic-acid" bson:"arachidonic-acid"` | |
| ArachidicAcid float64 `json:"arachidic-acid" bson:"arachidic-acid"` |
| StearicAcid100g float64 `json:"stearic-acid_100g" bson:"stearic-acid_100g"` | ||
| StearicAcid float64 `json:"stearic-acid" bson:"stearic-acid"` | ||
| ArachidicAcid100g float64 `json:"arachidic-acid_100g" bson:"arachidic-acid_100g"` | ||
| ArachidicAcid float64 `json:"arachidic-acid" bson:"arachidonic-acid"` |
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BSON tag for ArachidicAcid is "arachidonic-acid" but the JSON tag is "arachidic-acid". These should match. Arachidic acid and arachidonic acid are two different fatty acids. Based on the field name and the JSON tag, this should be "arachidic-acid" in both places. This mismatch will cause data to be stored under the wrong field name in the database.
| ArachidicAcid float64 `json:"arachidic-acid" bson:"arachidonic-acid"` | |
| ArachidicAcid float64 `json:"arachidic-acid" bson:"arachidic-acid"` |
No description provided.