mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-29 01:04:18 -04:00 
			
		
		
		
	initialize food and units
This commit is contained in:
		| @@ -1,34 +1,36 @@ | |||||||
| from mealie.schema.recipe import CreateIngredientUnit | import json | ||||||
|  | from pathlib import Path | ||||||
|  |  | ||||||
| from sqlalchemy.orm.session import Session | from sqlalchemy.orm.session import Session | ||||||
|  |  | ||||||
| from ..data_access_layer import DatabaseAccessLayer | from ..data_access_layer import DatabaseAccessLayer | ||||||
|  |  | ||||||
|  | CWD = Path(__file__).parent | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def get_default_foods(): | ||||||
|  |     with open(CWD.joinpath("resources", "foods", "en-us.json"), "r") as f: | ||||||
|  |         foods = json.loads(f.read()) | ||||||
|  |     return foods | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_default_units(): | def get_default_units(): | ||||||
|     return [ |     with open(CWD.joinpath("resources", "units", "en-us.json"), "r") as f: | ||||||
|         # Volume |         units = json.loads(f.read()) | ||||||
|         CreateIngredientUnit(name="teaspoon", abbreviation="tsp"), |     return units | ||||||
|         CreateIngredientUnit(name="tablespoon", abbreviation="tbsp"), |  | ||||||
|         CreateIngredientUnit(name="fluid ounce", abbreviation="fl oz"), |  | ||||||
|         CreateIngredientUnit(name="cup", abbreviation="cup"), |  | ||||||
|         CreateIngredientUnit(name="pint", abbreviation="pt"), |  | ||||||
|         CreateIngredientUnit(name="quart", abbreviation="qt"), |  | ||||||
|         CreateIngredientUnit(name="gallon", abbreviation="gal"), |  | ||||||
|         CreateIngredientUnit(name="milliliter", abbreviation="ml"), |  | ||||||
|         CreateIngredientUnit(name="liter", abbreviation="l"), |  | ||||||
|         # Mass Weight |  | ||||||
|         CreateIngredientUnit(name="pound", abbreviation="lb"), |  | ||||||
|         CreateIngredientUnit(name="ounce", abbreviation="oz"), |  | ||||||
|         CreateIngredientUnit(name="gram", abbreviation="g"), |  | ||||||
|         CreateIngredientUnit(name="kilogram", abbreviation="kg"), |  | ||||||
|         CreateIngredientUnit(name="milligram", abbreviation="mg"), |  | ||||||
|     ] |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def default_recipe_unit_init(db: DatabaseAccessLayer, session: Session) -> None: | def default_recipe_unit_init(db: DatabaseAccessLayer, session: Session) -> None: | ||||||
|     for unit in get_default_units(): |     for unit in get_default_units(): | ||||||
|         try: |         try: | ||||||
|             db.ingredient_units.create(session, unit) |             db.ingredient_units.create(session, unit) | ||||||
|             print("Ingredient Unit Committed") |             print("Ingredient Unit Created") | ||||||
|  |         except Exception as e: | ||||||
|  |             print(e) | ||||||
|  |  | ||||||
|  |     for food in get_default_foods(): | ||||||
|  |         try: | ||||||
|  |             db.ingredient_foods.create(session, food) | ||||||
|  |             print("Ingredient Food Created") | ||||||
|         except Exception as e: |         except Exception as e: | ||||||
|             print(e) |             print(e) | ||||||
|   | |||||||
							
								
								
									
										914
									
								
								mealie/db/data_initialization/resources/foods/en-us.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										914
									
								
								mealie/db/data_initialization/resources/foods/en-us.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,914 @@ | |||||||
|  | [ | ||||||
|  |     { | ||||||
|  |         "name": "acorn squash", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "alfalfa sprouts", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "anchovies", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "apples", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "artichoke", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "arugula", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "asparagus", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "aubergine", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "avocado", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "bacon", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "baking powder", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "baking soda", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "baking sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "bar sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "basil", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "bell peppers", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "blackberries", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "brassicas ", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "bok choy", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "broccoflower", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "broccoli", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "broccolini", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "broccoli rabe", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "brussels sprouts", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cabbage", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cauliflower", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chinese leaves", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "collard greens", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "kohlrabi", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "bread", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "breadfruit", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "broad beans", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "brown sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "brussels sprouts", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "butter", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "butternut pumpkin", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "butternut squash", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cactus, edible", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "calabrese", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cannabis", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "capsicum", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "caraway", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "carrot", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "castor sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cayenne pepper", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "celeriac", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "celery", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cereal grains", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "rice", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chard", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cheese", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chicory", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chilli peppers", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chinese leaves", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chives", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "chocolate", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cilantro", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cinnamon", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "clarified butter", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "coconut", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "coconut milk", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "coffee", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "confectioners' sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "coriander", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "corn", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "corn syrup", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cottonseed oil", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "courgette", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cream of tartar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cucumber", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cumin", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "daikon", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "dairy products and dairy substitutes", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "eggs", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "ghee", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "milk", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "dandelion", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "demerara sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "dough", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "edible cactus", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "eggplant", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "endive", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fats", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "spek", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fava beans", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fiddlehead", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fish", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "catfish ", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cod", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "salt cod", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "salmon", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "skate", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "stockfish", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "trout", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "tuna", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "five spice powder", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "flour", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "frisee", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fructose", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fruit", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "apple", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "oranges", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pear", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "tomato", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fruit sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "garam masala", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "garlic", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "gem squash", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "ginger", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "giblets", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "grains", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "maize", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sweetcorn", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "teff", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "grape seed oil", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "green onion", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "heart of palm", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "hemp", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "herbs", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "oregano", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "parsley", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "honey", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "horse", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "icing sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "isomalt", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "jackfruit", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "jaggery", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "jams", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "jellies", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "jerusalem artichoke", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "jicama", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "kale", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "kumara", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "leavening agents", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "leek", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "legumes", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "peas", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "beans", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "lentils", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "lemongrass", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "lettuce", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "liver", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "maple syrup", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "meat", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "mortadella", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "mushroom", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "white mushroom", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "mussels", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "nori", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "nutmeg", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "nutritional yeast flakes", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "nuts", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "nanaimo bar mix", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "octopuses", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "oils", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "olive oil", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "okra", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "olive", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "onion family", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "onion", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "scallion", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "shallot", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "spring onion", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "orange blossom water", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "oysters", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "panch puran", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "paprika", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "parsnip", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pepper", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "peppers", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "plantain", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pineapple", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "poppy seeds", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "potatoes", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "poultry", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "powdered sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pumpkin", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pumpkin seeds", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "radish", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "rape", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "raw sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "refined sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "rice flour", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "rock sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "rum", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "salt", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "seafood", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "seeds", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sesame seeds", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sunflower seeds", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "soda", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "soda, baking", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "soybean", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "spaghetti squash", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "spices", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "five spice powder", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "spinach", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "squash family", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "squash", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "zucchini", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "caster sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "granulated sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "superfine sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "turbanado sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "unrefined sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "white sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sweet potato", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sweeteners", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cane sugar", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "tahini", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "tubers", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "potato", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "sunchoke", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "taro", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "yam", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "turnip", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "vanilla", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "vegetables", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "brassicas", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fiddlehead fern", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "ful", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "legumes ", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "tomato ", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "watercress", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "watermelon", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "xanthan gum", | ||||||
|  |         "description": "" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "yeast", | ||||||
|  |         "description": "" | ||||||
|  |     } | ||||||
|  | ] | ||||||
							
								
								
									
										86
									
								
								mealie/db/data_initialization/resources/units/en-us.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								mealie/db/data_initialization/resources/units/en-us.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | |||||||
|  | [ | ||||||
|  |     { | ||||||
|  |         "name": "teaspoon", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "tsp" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "tablespoon", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "tbsp" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "cup", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "cup" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "fluid ounce", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "fl oz" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pint", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "pt" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "quart", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "qt" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "gallon", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "gal" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "milliliter", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "ml" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "liter", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "l" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "pound", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "lb" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "ounce", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "oz" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "gram", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "g" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "kilogram", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "kg" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "milligram", | ||||||
|  |         "description": "", | ||||||
|  |         "fraction": true, | ||||||
|  |         "abbreviation": "mg" | ||||||
|  |     } | ||||||
|  | ] | ||||||
| @@ -5,7 +5,7 @@ from mealie.db.data_initialization.init_units_foods import default_recipe_unit_i | |||||||
| from mealie.db.database import db | from mealie.db.database import db | ||||||
| from mealie.db.db_setup import create_session, engine | from mealie.db.db_setup import create_session, engine | ||||||
| from mealie.db.models._model_base import SqlAlchemyBase | from mealie.db.models._model_base import SqlAlchemyBase | ||||||
| from mealie.schema.admin import SiteSettings, SiteTheme | from mealie.schema.admin import SiteSettings | ||||||
| from mealie.services.events import create_general_event | from mealie.services.events import create_general_event | ||||||
| from sqlalchemy.orm import Session | from sqlalchemy.orm import Session | ||||||
|  |  | ||||||
| @@ -24,35 +24,12 @@ def init_db(session: Session = None) -> None: | |||||||
|     if not session: |     if not session: | ||||||
|         session = create_session() |         session = create_session() | ||||||
|  |  | ||||||
|  |     with session: | ||||||
|         default_group_init(session) |         default_group_init(session) | ||||||
|         default_settings_init(session) |         default_settings_init(session) | ||||||
|     default_theme_init(session) |  | ||||||
|         default_user_init(session) |         default_user_init(session) | ||||||
|  |  | ||||||
|         default_recipe_unit_init(db, session) |         default_recipe_unit_init(db, session) | ||||||
|  |  | ||||||
|     session.close() |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def default_theme_init(session: Session): |  | ||||||
|     default_themes = [ |  | ||||||
|         SiteTheme().dict(), |  | ||||||
|         { |  | ||||||
|             "name": "Dark", |  | ||||||
|             "colors": { |  | ||||||
|                 "primary": "#424242", |  | ||||||
|                 "accent": "#455A64", |  | ||||||
|                 "secondary": "#00796B", |  | ||||||
|                 "success": "#43A047", |  | ||||||
|                 "info": "#1976D2", |  | ||||||
|                 "warning": "#FF6F00", |  | ||||||
|                 "error": "#EF5350", |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     ] |  | ||||||
|     for theme in default_themes: |  | ||||||
|         db.themes.create(session, theme) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def default_settings_init(session: Session): | def default_settings_init(session: Session): | ||||||
|     document = db.settings.create(session, SiteSettings().dict()) |     document = db.settings.create(session, SiteSettings().dict()) | ||||||
| @@ -68,6 +45,7 @@ def default_group_init(session: Session): | |||||||
| def default_user_init(session: Session): | def default_user_init(session: Session): | ||||||
|     default_user = { |     default_user = { | ||||||
|         "full_name": "Change Me", |         "full_name": "Change Me", | ||||||
|  |         "username": "admin", | ||||||
|         "email": settings.DEFAULT_EMAIL, |         "email": settings.DEFAULT_EMAIL, | ||||||
|         "password": get_password_hash(settings.DEFAULT_PASSWORD), |         "password": get_password_hash(settings.DEFAULT_PASSWORD), | ||||||
|         "group": settings.DEFAULT_GROUP, |         "group": settings.DEFAULT_GROUP, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user