planfix client as dependency
This commit is contained in:
parent
20e8558ceb
commit
674c22afad
|
|
@ -1,11 +1,14 @@
|
||||||
|
from .planfix_client import PlanfixClientDependency
|
||||||
from chain_service.services.progress_action.factory import ProgressActionServiceFactory
|
from chain_service.services.progress_action.factory import ProgressActionServiceFactory
|
||||||
|
|
||||||
from fastapi import Depends
|
from fastapi import Depends
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
|
|
||||||
def get_progress_action_service_factory() -> ProgressActionServiceFactory:
|
def get_progress_action_service_factory(
|
||||||
return ProgressActionServiceFactory()
|
planfix_client: PlanfixClientDependency,
|
||||||
|
) -> ProgressActionServiceFactory:
|
||||||
|
return ProgressActionServiceFactory(planfix_client=planfix_client)
|
||||||
|
|
||||||
|
|
||||||
ProgressActionServiceFactoryDependency = Annotated[
|
ProgressActionServiceFactoryDependency = Annotated[
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,14 @@ from .base import BaseProgressActionService
|
||||||
from .wait_progress_action import WaitProgressActionService
|
from .wait_progress_action import WaitProgressActionService
|
||||||
from .comment_progress_action import CommentProgressActionService
|
from .comment_progress_action import CommentProgressActionService
|
||||||
|
|
||||||
|
from planfix_client import PlanfixClient
|
||||||
|
|
||||||
|
|
||||||
class ProgressActionServiceFactory:
|
class ProgressActionServiceFactory:
|
||||||
|
|
||||||
|
def __init__(self, planfix_client: PlanfixClient):
|
||||||
|
self.planfix_client = planfix_client
|
||||||
|
|
||||||
def __call__(
|
def __call__(
|
||||||
self, progress_action: BaseProgressAction
|
self, progress_action: BaseProgressAction
|
||||||
) -> BaseProgressActionService:
|
) -> BaseProgressActionService:
|
||||||
|
|
@ -17,4 +22,4 @@ class ProgressActionServiceFactory:
|
||||||
return WaitProgressActionService()
|
return WaitProgressActionService()
|
||||||
|
|
||||||
case "comment":
|
case "comment":
|
||||||
return CommentProgressActionService()
|
return CommentProgressActionService(planfix_client=self.planfix_client)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user