mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-07 00:13:12 -05:00
feat: add initial notification support
* Add updated recipe notification * Add recipe deleted notification * Add notifications translations * Shopping lists full c/u/d notifications * Add categories c/u/d notifications * Deal with None values in translation provider * Add tag c/u/d notifications * Add cookbook c/u/d notifications * use single key pairs for consistency with frontend * change dependency injection strategy * use generic update messages * use service to manage url generation server-side * use new strategies for messages * fix translator Co-authored-by: Miroito <alban.vachette@gmail.com>
This commit is contained in:
1
mealie/services/urls/__init__.py
Normal file
1
mealie/services/urls/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .url_constructors import *
|
||||
36
mealie/services/urls/url_constructors.py
Normal file
36
mealie/services/urls/url_constructors.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.core.config import get_app_settings
|
||||
|
||||
|
||||
def _base_or(base_url: str | None) -> str:
|
||||
if base_url is None:
|
||||
settings = get_app_settings()
|
||||
return settings.BASE_URL
|
||||
|
||||
return base_url
|
||||
|
||||
|
||||
def recipe_url(recipe_slug: str, base_url: str | None) -> str:
|
||||
base = _base_or(base_url)
|
||||
return f"{base}/recipe/{recipe_slug}"
|
||||
|
||||
|
||||
def shopping_list_url(shopping_list_id: UUID4 | str, base_url: str | None) -> str:
|
||||
base = _base_or(base_url)
|
||||
return f"{base}/shopping-list/{shopping_list_id}"
|
||||
|
||||
|
||||
def tag_url(tag_slug: str, base_url: str | None) -> str:
|
||||
base = _base_or(base_url)
|
||||
return f"{base}/recipes/tags/{tag_slug}"
|
||||
|
||||
|
||||
def category_url(category_slug: str, base_url: str | None) -> str:
|
||||
base = _base_or(base_url)
|
||||
return f"{base}/recipes/categories/{category_slug}"
|
||||
|
||||
|
||||
def tool_url(tool_slug: str, base_url: str | None) -> str:
|
||||
base = _base_or(base_url)
|
||||
return f"{base}/recipes/tool/{tool_slug}"
|
||||
Reference in New Issue
Block a user