mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-20 05:23:34 -07: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:
parent
841b560abc
commit
b2066dfe72
12 changed files with 244 additions and 24 deletions
|
@ -5,6 +5,8 @@ from fastapi import Depends
|
|||
from pydantic import UUID4
|
||||
|
||||
from mealie.core.exceptions import mealie_registered_exceptions
|
||||
from mealie.lang import local_provider
|
||||
from mealie.lang.providers import Translator
|
||||
from mealie.repos.all_repositories import AllRepositories
|
||||
from mealie.routes._base.checks import OperationChecks
|
||||
from mealie.routes._base.dependencies import SharedDependencies
|
||||
|
@ -19,6 +21,10 @@ class BasePublicController(ABC):
|
|||
"""
|
||||
|
||||
deps: SharedDependencies = Depends(SharedDependencies.public)
|
||||
translator: Translator = Depends(local_provider)
|
||||
|
||||
def __init__(self):
|
||||
self.t = self.translator.t if self.translator else local_provider().t
|
||||
|
||||
|
||||
class BaseUserController(ABC):
|
||||
|
@ -29,6 +35,10 @@ class BaseUserController(ABC):
|
|||
"""
|
||||
|
||||
deps: SharedDependencies = Depends(SharedDependencies.user)
|
||||
translator: Translator = Depends(local_provider)
|
||||
|
||||
def __init__(self):
|
||||
self.t = self.translator.t if self.translator else local_provider().t
|
||||
|
||||
def registered_exceptions(self, ex: type[Exception]) -> str:
|
||||
registered = {
|
||||
|
@ -65,3 +75,7 @@ class BaseAdminController(BaseUserController):
|
|||
"""
|
||||
|
||||
deps: SharedDependencies = Depends(SharedDependencies.admin)
|
||||
translator: Translator = Depends(local_provider)
|
||||
|
||||
def __init__(self):
|
||||
self.t = self.translator.t if self.translator else local_provider().t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue