fix: front-end autowire
This commit is contained in:
parent
5224fe78b6
commit
7c0ef15567
4 changed files with 15 additions and 11 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue