mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -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
|
||||
|
||||
Documentation
|
||||
- [ ] V0.1.0 Release Notes
|
||||
- [ ] Nextcloud Migration How To
|
||||
- [ ] New Docker Setup with Sqlite
|
||||
- [ ] New Roadmap / Milestones
|
||||
|
||||
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
|
||||
- [x] Catch 400 / bad response on create from URL
|
||||
- [ ] 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.
|
||||
- [ ] 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
|
||||
- [x] Add Debug folder for writing the last pulled recipe data to.
|
||||
- [x] Recipe Editor Data Validation Server Side
|
||||
- [ ] Normalize Recipe data on scrape
|
||||
- [ ] Database Import
|
||||
- [x] Recipes
|
||||
- [x] Images
|
||||
- [ ] Meal Plans
|
||||
- [ ] Settings
|
||||
- [ ] Themes
|
||||
- [ ] Remove Print / Debug Code
|
||||
- [ ] Support how to Sections and how to steps
|
||||
- [ ] Export Markdown on Auto backups
|
||||
- [ ] 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
|
||||
## v0.0.2
|
||||
|
|
|
@ -37,4 +37,3 @@ if __name__ == "__main__":
|
|||
data = json.dumps(theme)
|
||||
response = requests.post(POST_URL, data)
|
||||
response = requests.get(GET_URL)
|
||||
print(response.text)
|
||||
|
|
|
@ -3,21 +3,13 @@ from fastapi import FastAPI
|
|||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
import utils.startup as startup
|
||||
from routes import (
|
||||
backup_routes,
|
||||
meal_routes,
|
||||
migration_routes,
|
||||
recipe_routes,
|
||||
setting_routes,
|
||||
static_routes,
|
||||
user_routes,
|
||||
)
|
||||
from routes import (backup_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 utils.api_docs import generate_api_docs
|
||||
from utils.logger import logger
|
||||
|
||||
startup.pre_start()
|
||||
# start_scheduler()
|
||||
|
||||
app = FastAPI(
|
||||
title="Mealie",
|
||||
|
|
Binary file not shown.
|
@ -146,7 +146,6 @@ class BaseDocument:
|
|||
return BaseDocument._unpack_mongo(new_document)
|
||||
elif USE_SQL:
|
||||
session = self.create_session()
|
||||
print(document)
|
||||
new_document = self.sql_model(**document)
|
||||
session.add(new_document)
|
||||
return_data = new_document.dict()
|
||||
|
@ -161,7 +160,6 @@ class BaseDocument:
|
|||
session, entry = self._query_one(match_value=match_value)
|
||||
entry.update(session=session, **new_data)
|
||||
return_data = entry.dict()
|
||||
print(entry)
|
||||
session.commit()
|
||||
|
||||
session.close()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from db.sql.meal_models import *
|
||||
from db.sql.recipe_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.orm as orm
|
||||
from db.sql.model_base import BaseMixins, SqlAlchemyBase
|
||||
from sqlalchemy.ext.orderinglist import ordering_list
|
||||
|
||||
|
||||
class ApiExtras(SqlAlchemyBase):
|
||||
|
@ -56,6 +57,7 @@ class Note(SqlAlchemyBase):
|
|||
class RecipeIngredient(SqlAlchemyBase):
|
||||
__tablename__ = "recipes_ingredients"
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
position = sa.Column(sa.Integer)
|
||||
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
|
||||
ingredient = sa.Column(sa.String)
|
||||
|
||||
|
@ -70,6 +72,7 @@ class RecipeInstruction(SqlAlchemyBase):
|
|||
__tablename__ = "recipe_instructions"
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
|
||||
position = sa.Column(sa.Integer)
|
||||
type = sa.Column(sa.String, default="")
|
||||
text = sa.Column(sa.String)
|
||||
|
||||
|
@ -81,19 +84,31 @@ class RecipeInstruction(SqlAlchemyBase):
|
|||
|
||||
class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||
__tablename__ = "recipes"
|
||||
# Database Specific
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
|
||||
# General Recipe Properties
|
||||
name = sa.Column(sa.String)
|
||||
description = sa.Column(sa.String)
|
||||
image = sa.Column(sa.String)
|
||||
recipeYield = sa.Column(sa.String)
|
||||
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(
|
||||
"RecipeInstruction",
|
||||
cascade="all, delete",
|
||||
order_by="RecipeInstruction.position",
|
||||
collection_class=ordering_list("position"),
|
||||
)
|
||||
|
||||
# How to Properties
|
||||
totalTime = sa.Column(sa.String)
|
||||
prepTime = sa.Column(sa.String)
|
||||
performTime = sa.Column(sa.String)
|
||||
|
||||
# Mealie Specific
|
||||
slug = sa.Column(sa.String, index=True, unique=True)
|
||||
|
@ -123,6 +138,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
|||
recipeIngredient: List[str] = None,
|
||||
recipeInstructions: List[dict] = None,
|
||||
totalTime: str = None,
|
||||
prepTime: str = None,
|
||||
performTime: str = None,
|
||||
slug: str = None,
|
||||
categories: List[str] = None,
|
||||
tags: List[str] = None,
|
||||
|
@ -144,6 +161,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
|||
for instruc in recipeInstructions
|
||||
]
|
||||
self.totalTime = totalTime
|
||||
self.prepTime = prepTime
|
||||
self.performTime = performTime
|
||||
|
||||
# Mealie Specific
|
||||
self.slug = slug
|
||||
|
@ -165,6 +184,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
|||
recipeIngredient: List[str] = None,
|
||||
recipeInstructions: List[dict] = None,
|
||||
totalTime: str = None,
|
||||
prepTime: str = None,
|
||||
performTime: str = None,
|
||||
slug: str = None,
|
||||
categories: List[str] = None,
|
||||
tags: List[str] = None,
|
||||
|
@ -175,11 +196,6 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
|||
extras: dict = None,
|
||||
):
|
||||
"""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]
|
||||
RecipeModel._sql_remove_list(session, list_of_tables, self.id)
|
||||
|
||||
|
@ -191,6 +207,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
|||
recipeIngredient=recipeIngredient,
|
||||
recipeInstructions=recipeInstructions,
|
||||
totalTime=totalTime,
|
||||
prepTime=prepTime,
|
||||
performTime=performTime,
|
||||
slug=slug,
|
||||
categories=categories,
|
||||
tags=tags,
|
||||
|
@ -210,6 +228,8 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
|||
"recipeIngredient": [x.to_str() for x in self.recipeIngredient],
|
||||
"recipeInstructions": [x.dict() for x in self.recipeInstructions],
|
||||
"totalTime": self.totalTime,
|
||||
"prepTime": self.prepTime,
|
||||
"performTime": self.performTime,
|
||||
# Mealie
|
||||
"slug": self.slug,
|
||||
"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")
|
||||
# )
|
||||
|
||||
# scheduler.reschedule_webhooks()
|
||||
scheduler.reschedule_webhooks()
|
||||
return SnackResponse.success("Settings Updated")
|
||||
|
||||
|
||||
|
@ -81,11 +81,11 @@ def update_theme(theme_name: str, data: SiteTheme):
|
|||
def delete_theme(theme_name: str):
|
||||
""" Deletes theme from the database """
|
||||
SiteTheme.delete_theme(theme_name)
|
||||
try:
|
||||
SiteTheme.delete_theme(theme_name)
|
||||
except:
|
||||
raise HTTPException(
|
||||
status_code=400, detail=SnackResponse.error("Unable to Delete Theme")
|
||||
)
|
||||
# try:
|
||||
# SiteTheme.delete_theme(theme_name)
|
||||
# except:
|
||||
# raise HTTPException(
|
||||
# status_code=400, detail=SnackResponse.error("Unable to Delete Theme")
|
||||
# )
|
||||
|
||||
return SnackResponse.success("Theme Deleted")
|
||||
|
|
|
@ -92,7 +92,6 @@ class ExportDatabase:
|
|||
|
||||
def export_themes(self):
|
||||
all_themes = SiteTheme.get_all()
|
||||
print(all_themes)
|
||||
if all_themes:
|
||||
all_themes = [x.dict() for x in all_themes]
|
||||
out_file = self.themes_dir.joinpath("themes.json")
|
||||
|
@ -105,7 +104,6 @@ class ExportDatabase:
|
|||
if meal_plans:
|
||||
meal_plans = [x.dict() for x in meal_plans]
|
||||
|
||||
print(meal_plans)
|
||||
out_file = self.mealplans_dir.joinpath("mealplans.json")
|
||||
ExportDatabase._write_json_file(meal_plans, out_file)
|
||||
|
||||
|
|
|
@ -27,7 +27,10 @@ class Recipe(BaseModel):
|
|||
recipeYield: Optional[str]
|
||||
recipeIngredient: Optional[list]
|
||||
recipeInstructions: Optional[list]
|
||||
|
||||
totalTime: Optional[Any]
|
||||
prepTime: Optional[str]
|
||||
performTime: Optional[str]
|
||||
|
||||
# Mealie Specific
|
||||
slug: Optional[str] = ""
|
||||
|
|
|
@ -47,7 +47,7 @@ else:
|
|||
|
||||
|
||||
# DATABASE ENV
|
||||
DATABASE_TYPE = os.getenv("db_type", "mongo") # mongo, tinydb
|
||||
DATABASE_TYPE = os.getenv("db_type", "sql") # mongo, tinydb
|
||||
if DATABASE_TYPE == "sql":
|
||||
USE_SQL = True
|
||||
USE_MONGO = False
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
from services.scheduler_services import Scheduler
|
||||
|
||||
scheduler = None
|
||||
|
||||
def start_scheduler():
|
||||
global scheduler
|
||||
scheduler = Scheduler()
|
||||
scheduler.startup_scheduler()
|
||||
return scheduler
|
||||
|
||||
|
||||
scheduler = start_scheduler()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue