fix: front-end autowire

This commit is contained in:
Piotr Dec 2025-10-17 20:41:52 +02:00
parent 5224fe78b6
commit 7c0ef15567
Signed by: stawros
GPG key ID: 74B18A3F0F1E99C0
4 changed files with 15 additions and 11 deletions

View file

@ -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 == "/":