simonoppowa / OpenNutriTracker

🍴 OpenNutriTracker is a free and open source calorie tracker with a focus on simplicity and privacy.
https://simonoppowa.github.io/OpenNutriTracker-Website/
GNU General Public License v3.0
371 stars 54 forks source link

feat: importing meals via CSV + local barcode search #122

Open dd-dreams opened 3 weeks ago

dd-dreams commented 3 weeks ago

This PR enables users to add meals via a CSV file. It adds a new button in the settings page "Import CSV" - when pressed, the user selects a file from the file picker, afterwards if the file is valid, all the meals present there will be added to the database under "Products".

The CSV format should have the following columns (not necessarily in the same order of keys):

name,protein,total_sugars,saturated_fat,total_fat,food_energy,carbohydrates,fiber,barcode

These names are necessary for the import to work.

This PR also adds a new field to the database: "barcode" for searching locally with barcodes.

Please suggest any changes if needed.