fix: front-end autowire
This commit is contained in:
parent
5224fe78b6
commit
7c0ef15567
4 changed files with 15 additions and 11 deletions
|
|
@ -1,20 +1,17 @@
|
|||
from typing import Optional, List
|
||||
from typing import Optional, List, Annotated
|
||||
|
||||
from injectable import autowired, injectable, Autowired
|
||||
from pykeepass import Group, Entry
|
||||
|
||||
from app.api.models import EntryKind, EntrySimpleDTO, EntryComplexDTO, GroupDTO, NodeDTO, EntryNodeDTO
|
||||
from app.services import Passwords
|
||||
|
||||
|
||||
@injectable(singleton=True)
|
||||
class PasswordsController:
|
||||
def __init__(self, passwords: Passwords):
|
||||
@autowired
|
||||
def __init__(self, passwords: Annotated[Passwords, Autowired]):
|
||||
self._pw = passwords
|
||||
|
||||
@staticmethod
|
||||
def dep() -> "PasswordsController":
|
||||
# prosta fabryka/DI mostkująca injectable
|
||||
return PasswordsController(Passwords())
|
||||
|
||||
# Helpers
|
||||
def _group_by_path(self, path: Optional[str]) -> Group:
|
||||
if not path or path == "/":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue