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,6 +1,7 @@
from fastapi import APIRouter, Depends, Body, Query
from fastapi.responses import JSONResponse
from fastapi_utils.cbv import cbv
from injectable import inject
from app.api.models import *
from app.web import PasswordsController
@ -17,14 +18,20 @@ async def root():
async def health():
return {"status": "ok"}
@router.post("/ci", summary="CI Webhook")
async def ci(request: Request):
return Response(200)
class AutowireSupport:
@staticmethod
def password_controller():
return inject(PasswordsController)
@cbv(router)
class TreeController:
svc: PasswordsController = Depends(PasswordsController.dep)
svc: PasswordsController = Depends(AutowireSupport.password_controller)
@router.get("/tree", response_model=NodeDTO)
def get_tree(self) -> NodeDTO: