mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
final cleanup
This commit is contained in:
parent
1340c01632
commit
53e1c107e1
12 changed files with 68 additions and 44 deletions
|
@ -16,27 +16,38 @@ Don't forget to [join the Discord](https://discord.gg/R6QDyJgbD2)!
|
||||||
|
|
||||||
# Todo's
|
# Todo's
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
- [ ] V0.1.0 Release Notes
|
||||||
|
- [ ] Nextcloud Migration How To
|
||||||
|
- [ ] New Docker Setup with Sqlite
|
||||||
|
- [ ] New Roadmap / Milestones
|
||||||
|
|
||||||
Frontend
|
Frontend
|
||||||
- [x] .Vue file reorganized into something that makes sense
|
- [ ] Prep / Cook / Total Time Indicator + Editor
|
||||||
|
- [ ] No Meal Today Page instead of Null
|
||||||
- [ ] Recipe Print Page
|
- [ ] Recipe Print Page
|
||||||
- [x] Catch 400 / bad response on create from URL
|
|
||||||
- [ ] Recipe Editor Data Validation Client Side
|
- [ ] Recipe Editor Data Validation Client Side
|
||||||
- [x] Favicon
|
|
||||||
- [x] Rename Window
|
|
||||||
- [x] Add version indicator and notification for new version available
|
|
||||||
- [ ] Enhanced Search Functionality
|
|
||||||
- [ ] Organize Home Page my Category, ideally user selectable.
|
- [ ] Organize Home Page my Category, ideally user selectable.
|
||||||
|
- [ ] Advanced Search Page, draft started
|
||||||
|
- [ ] Search Bar Re-design
|
||||||
|
- [ ] Replace Backups card with something like Home Assistant
|
||||||
|
- [ ] Replace import card with something like Home Assistant
|
||||||
|
- [ ] Select which imports to do
|
||||||
|
|
||||||
Backend
|
Backend
|
||||||
- [x] Add Debug folder for writing the last pulled recipe data to.
|
- [ ] Database Import
|
||||||
- [x] Recipe Editor Data Validation Server Side
|
- [x] Recipes
|
||||||
- [ ] Normalize Recipe data on scrape
|
- [x] Images
|
||||||
|
- [ ] Meal Plans
|
||||||
|
- [ ] Settings
|
||||||
|
- [ ] Themes
|
||||||
|
- [ ] Remove Print / Debug Code
|
||||||
- [ ] Support how to Sections and how to steps
|
- [ ] Support how to Sections and how to steps
|
||||||
- [ ] Export Markdown on Auto backups
|
|
||||||
- [ ] Recipe request by category/tags
|
- [ ] Recipe request by category/tags
|
||||||
- [ ] Add Additional Migrations, See mealie/services/migrations/chowdown.py for examples of how to do this.
|
|
||||||
- [ ] Open Eats [See Issue #4](https://github.com/hay-kot/mealie/issues/4)
|
|
||||||
- [ ] NextCloud [See Issue #14](https://github.com/hay-kot/mealie/issues/14)
|
SQL
|
||||||
|
- [ ] Setup Database Migrations
|
||||||
|
|
||||||
# Draft Changelog
|
# Draft Changelog
|
||||||
## v0.0.2
|
## v0.0.2
|
||||||
|
|
|
@ -37,4 +37,3 @@ if __name__ == "__main__":
|
||||||
data = json.dumps(theme)
|
data = json.dumps(theme)
|
||||||
response = requests.post(POST_URL, data)
|
response = requests.post(POST_URL, data)
|
||||||
response = requests.get(GET_URL)
|
response = requests.get(GET_URL)
|
||||||
print(response.text)
|
|
||||||
|
|
|
@ -3,21 +3,13 @@ from fastapi import FastAPI
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
import utils.startup as startup
|
import utils.startup as startup
|
||||||
from routes import (
|
from routes import (backup_routes, meal_routes, migration_routes,
|
||||||
backup_routes,
|
recipe_routes, setting_routes, static_routes, user_routes)
|
||||||
meal_routes,
|
|
||||||
migration_routes,
|
|
||||||
recipe_routes,
|
|
||||||
setting_routes,
|
|
||||||
static_routes,
|
|
||||||
user_routes,
|
|
||||||
)
|
|
||||||
from settings import PORT, PRODUCTION, WEB_PATH, docs_url, redoc_url
|
from settings import PORT, PRODUCTION, WEB_PATH, docs_url, redoc_url
|
||||||
from utils.api_docs import generate_api_docs
|
from utils.api_docs import generate_api_docs
|
||||||
from utils.logger import logger
|
from utils.logger import logger
|
||||||
|
|
||||||
startup.pre_start()
|
startup.pre_start()
|
||||||
# start_scheduler()
|
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="Mealie",
|
title="Mealie",
|
||||||
|
|
Binary file not shown.
|
@ -146,7 +146,6 @@ class BaseDocument:
|
||||||
return BaseDocument._unpack_mongo(new_document)
|
return BaseDocument._unpack_mongo(new_document)
|
||||||
elif USE_SQL:
|
elif USE_SQL:
|
||||||
session = self.create_session()
|
session = self.create_session()
|
||||||
print(document)
|
|
||||||
new_document = self.sql_model(**document)
|
new_document = self.sql_model(**document)
|
||||||
session.add(new_document)
|
session.add(new_document)
|
||||||
return_data = new_document.dict()
|
return_data = new_document.dict()
|
||||||
|
@ -161,7 +160,6 @@ class BaseDocument:
|
||||||
session, entry = self._query_one(match_value=match_value)
|
session, entry = self._query_one(match_value=match_value)
|
||||||
entry.update(session=session, **new_data)
|
entry.update(session=session, **new_data)
|
||||||
return_data = entry.dict()
|
return_data = entry.dict()
|
||||||
print(entry)
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
session.close()
|
session.close()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from db.sql.meal_models import *
|
from db.sql.meal_models import *
|
||||||
from db.sql.recipe_models import *
|
from db.sql.recipe_models import *
|
||||||
from db.sql.settings_models import *
|
from db.sql.settings_models import *
|
||||||
from db.sql.settings_models import SiteSettingsModel
|
from db.sql.theme_models import *
|
||||||
|
|
|
@ -5,6 +5,7 @@ from typing import List
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
import sqlalchemy.orm as orm
|
import sqlalchemy.orm as orm
|
||||||
from db.sql.model_base import BaseMixins, SqlAlchemyBase
|
from db.sql.model_base import BaseMixins, SqlAlchemyBase
|
||||||
|
from sqlalchemy.ext.orderinglist import ordering_list
|
||||||
|
|
||||||
|
|
||||||
class ApiExtras(SqlAlchemyBase):
|
class ApiExtras(SqlAlchemyBase):
|
||||||
|
@ -56,6 +57,7 @@ class Note(SqlAlchemyBase):
|
||||||
class RecipeIngredient(SqlAlchemyBase):
|
class RecipeIngredient(SqlAlchemyBase):
|
||||||
__tablename__ = "recipes_ingredients"
|
__tablename__ = "recipes_ingredients"
|
||||||
id = sa.Column(sa.Integer, primary_key=True)
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
position = sa.Column(sa.Integer)
|
||||||
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
|
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
|
||||||
ingredient = sa.Column(sa.String)
|
ingredient = sa.Column(sa.String)
|
||||||
|
|
||||||
|
@ -70,6 +72,7 @@ class RecipeInstruction(SqlAlchemyBase):
|
||||||
__tablename__ = "recipe_instructions"
|
__tablename__ = "recipe_instructions"
|
||||||
id = sa.Column(sa.Integer, primary_key=True)
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
|
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
|
||||||
|
position = sa.Column(sa.Integer)
|
||||||
type = sa.Column(sa.String, default="")
|
type = sa.Column(sa.String, default="")
|
||||||
text = sa.Column(sa.String)
|
text = sa.Column(sa.String)
|
||||||
|
|
||||||
|
@ -81,19 +84,31 @@ class RecipeInstruction(SqlAlchemyBase):
|
||||||
|
|
||||||
class RecipeModel(SqlAlchemyBase, BaseMixins):
|
class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
__tablename__ = "recipes"
|
__tablename__ = "recipes"
|
||||||
|
# Database Specific
|
||||||
id = sa.Column(sa.Integer, primary_key=True)
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
|
||||||
|
# General Recipe Properties
|
||||||
name = sa.Column(sa.String)
|
name = sa.Column(sa.String)
|
||||||
description = sa.Column(sa.String)
|
description = sa.Column(sa.String)
|
||||||
image = sa.Column(sa.String)
|
image = sa.Column(sa.String)
|
||||||
recipeYield = sa.Column(sa.String)
|
recipeYield = sa.Column(sa.String)
|
||||||
recipeIngredient: List[RecipeIngredient] = orm.relationship(
|
recipeIngredient: List[RecipeIngredient] = orm.relationship(
|
||||||
"RecipeIngredient", cascade="all, delete"
|
"RecipeIngredient",
|
||||||
|
cascade="all, delete",
|
||||||
|
order_by="RecipeIngredient.position",
|
||||||
|
collection_class=ordering_list("position"),
|
||||||
)
|
)
|
||||||
recipeInstructions: List[RecipeInstruction] = orm.relationship(
|
recipeInstructions: List[RecipeInstruction] = orm.relationship(
|
||||||
"RecipeInstruction",
|
"RecipeInstruction",
|
||||||
cascade="all, delete",
|
cascade="all, delete",
|
||||||
|
order_by="RecipeInstruction.position",
|
||||||
|
collection_class=ordering_list("position"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# How to Properties
|
||||||
totalTime = sa.Column(sa.String)
|
totalTime = sa.Column(sa.String)
|
||||||
|
prepTime = sa.Column(sa.String)
|
||||||
|
performTime = sa.Column(sa.String)
|
||||||
|
|
||||||
# Mealie Specific
|
# Mealie Specific
|
||||||
slug = sa.Column(sa.String, index=True, unique=True)
|
slug = sa.Column(sa.String, index=True, unique=True)
|
||||||
|
@ -123,6 +138,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
recipeIngredient: List[str] = None,
|
recipeIngredient: List[str] = None,
|
||||||
recipeInstructions: List[dict] = None,
|
recipeInstructions: List[dict] = None,
|
||||||
totalTime: str = None,
|
totalTime: str = None,
|
||||||
|
prepTime: str = None,
|
||||||
|
performTime: str = None,
|
||||||
slug: str = None,
|
slug: str = None,
|
||||||
categories: List[str] = None,
|
categories: List[str] = None,
|
||||||
tags: List[str] = None,
|
tags: List[str] = None,
|
||||||
|
@ -144,6 +161,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
for instruc in recipeInstructions
|
for instruc in recipeInstructions
|
||||||
]
|
]
|
||||||
self.totalTime = totalTime
|
self.totalTime = totalTime
|
||||||
|
self.prepTime = prepTime
|
||||||
|
self.performTime = performTime
|
||||||
|
|
||||||
# Mealie Specific
|
# Mealie Specific
|
||||||
self.slug = slug
|
self.slug = slug
|
||||||
|
@ -165,6 +184,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
recipeIngredient: List[str] = None,
|
recipeIngredient: List[str] = None,
|
||||||
recipeInstructions: List[dict] = None,
|
recipeInstructions: List[dict] = None,
|
||||||
totalTime: str = None,
|
totalTime: str = None,
|
||||||
|
prepTime: str = None,
|
||||||
|
performTime: str = None,
|
||||||
slug: str = None,
|
slug: str = None,
|
||||||
categories: List[str] = None,
|
categories: List[str] = None,
|
||||||
tags: List[str] = None,
|
tags: List[str] = None,
|
||||||
|
@ -175,11 +196,6 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
extras: dict = None,
|
extras: dict = None,
|
||||||
):
|
):
|
||||||
"""Updated a database entry by removing nested rows and rebuilds the row through the __init__ functions"""
|
"""Updated a database entry by removing nested rows and rebuilds the row through the __init__ functions"""
|
||||||
self.name = name
|
|
||||||
self.description = description
|
|
||||||
self.image = image
|
|
||||||
self.recipeYield = recipeYield
|
|
||||||
|
|
||||||
list_of_tables = [RecipeIngredient, RecipeInstruction, Category, Tag, ApiExtras]
|
list_of_tables = [RecipeIngredient, RecipeInstruction, Category, Tag, ApiExtras]
|
||||||
RecipeModel._sql_remove_list(session, list_of_tables, self.id)
|
RecipeModel._sql_remove_list(session, list_of_tables, self.id)
|
||||||
|
|
||||||
|
@ -191,6 +207,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
recipeIngredient=recipeIngredient,
|
recipeIngredient=recipeIngredient,
|
||||||
recipeInstructions=recipeInstructions,
|
recipeInstructions=recipeInstructions,
|
||||||
totalTime=totalTime,
|
totalTime=totalTime,
|
||||||
|
prepTime=prepTime,
|
||||||
|
performTime=performTime,
|
||||||
slug=slug,
|
slug=slug,
|
||||||
categories=categories,
|
categories=categories,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
@ -210,6 +228,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||||
"recipeIngredient": [x.to_str() for x in self.recipeIngredient],
|
"recipeIngredient": [x.to_str() for x in self.recipeIngredient],
|
||||||
"recipeInstructions": [x.dict() for x in self.recipeInstructions],
|
"recipeInstructions": [x.dict() for x in self.recipeInstructions],
|
||||||
"totalTime": self.totalTime,
|
"totalTime": self.totalTime,
|
||||||
|
"prepTime": self.prepTime,
|
||||||
|
"performTime": self.performTime,
|
||||||
# Mealie
|
# Mealie
|
||||||
"slug": self.slug,
|
"slug": self.slug,
|
||||||
"categories": [x.to_str() for x in self.categories],
|
"categories": [x.to_str() for x in self.categories],
|
||||||
|
|
|
@ -32,7 +32,7 @@ def update_settings(data: SiteSettings):
|
||||||
# status_code=400, detail=SnackResponse.error("Unable to Save Settings")
|
# status_code=400, detail=SnackResponse.error("Unable to Save Settings")
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# scheduler.reschedule_webhooks()
|
scheduler.reschedule_webhooks()
|
||||||
return SnackResponse.success("Settings Updated")
|
return SnackResponse.success("Settings Updated")
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,11 +81,11 @@ def update_theme(theme_name: str, data: SiteTheme):
|
||||||
def delete_theme(theme_name: str):
|
def delete_theme(theme_name: str):
|
||||||
""" Deletes theme from the database """
|
""" Deletes theme from the database """
|
||||||
SiteTheme.delete_theme(theme_name)
|
SiteTheme.delete_theme(theme_name)
|
||||||
try:
|
# try:
|
||||||
SiteTheme.delete_theme(theme_name)
|
# SiteTheme.delete_theme(theme_name)
|
||||||
except:
|
# except:
|
||||||
raise HTTPException(
|
# raise HTTPException(
|
||||||
status_code=400, detail=SnackResponse.error("Unable to Delete Theme")
|
# status_code=400, detail=SnackResponse.error("Unable to Delete Theme")
|
||||||
)
|
# )
|
||||||
|
|
||||||
return SnackResponse.success("Theme Deleted")
|
return SnackResponse.success("Theme Deleted")
|
||||||
|
|
|
@ -92,7 +92,6 @@ class ExportDatabase:
|
||||||
|
|
||||||
def export_themes(self):
|
def export_themes(self):
|
||||||
all_themes = SiteTheme.get_all()
|
all_themes = SiteTheme.get_all()
|
||||||
print(all_themes)
|
|
||||||
if all_themes:
|
if all_themes:
|
||||||
all_themes = [x.dict() for x in all_themes]
|
all_themes = [x.dict() for x in all_themes]
|
||||||
out_file = self.themes_dir.joinpath("themes.json")
|
out_file = self.themes_dir.joinpath("themes.json")
|
||||||
|
@ -105,7 +104,6 @@ class ExportDatabase:
|
||||||
if meal_plans:
|
if meal_plans:
|
||||||
meal_plans = [x.dict() for x in meal_plans]
|
meal_plans = [x.dict() for x in meal_plans]
|
||||||
|
|
||||||
print(meal_plans)
|
|
||||||
out_file = self.mealplans_dir.joinpath("mealplans.json")
|
out_file = self.mealplans_dir.joinpath("mealplans.json")
|
||||||
ExportDatabase._write_json_file(meal_plans, out_file)
|
ExportDatabase._write_json_file(meal_plans, out_file)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,10 @@ class Recipe(BaseModel):
|
||||||
recipeYield: Optional[str]
|
recipeYield: Optional[str]
|
||||||
recipeIngredient: Optional[list]
|
recipeIngredient: Optional[list]
|
||||||
recipeInstructions: Optional[list]
|
recipeInstructions: Optional[list]
|
||||||
|
|
||||||
totalTime: Optional[Any]
|
totalTime: Optional[Any]
|
||||||
|
prepTime: Optional[str]
|
||||||
|
performTime: Optional[str]
|
||||||
|
|
||||||
# Mealie Specific
|
# Mealie Specific
|
||||||
slug: Optional[str] = ""
|
slug: Optional[str] = ""
|
||||||
|
|
|
@ -47,7 +47,7 @@ else:
|
||||||
|
|
||||||
|
|
||||||
# DATABASE ENV
|
# DATABASE ENV
|
||||||
DATABASE_TYPE = os.getenv("db_type", "mongo") # mongo, tinydb
|
DATABASE_TYPE = os.getenv("db_type", "sql") # mongo, tinydb
|
||||||
if DATABASE_TYPE == "sql":
|
if DATABASE_TYPE == "sql":
|
||||||
USE_SQL = True
|
USE_SQL = True
|
||||||
USE_MONGO = False
|
USE_MONGO = False
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
from services.scheduler_services import Scheduler
|
from services.scheduler_services import Scheduler
|
||||||
|
|
||||||
scheduler = None
|
|
||||||
|
|
||||||
def start_scheduler():
|
def start_scheduler():
|
||||||
global scheduler
|
global scheduler
|
||||||
scheduler = Scheduler()
|
scheduler = Scheduler()
|
||||||
scheduler.startup_scheduler()
|
scheduler.startup_scheduler()
|
||||||
|
return scheduler
|
||||||
|
|
||||||
|
|
||||||
|
scheduler = start_scheduler()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue