Conversation
4b1c572 to
d526726
Compare
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
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.