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 fastapi import Depends
|
||||
from typing import Annotated
|
||||
|
||||
|
||||
def get_progress_action_service_factory() -> ProgressActionServiceFactory:
|
||||
return ProgressActionServiceFactory()
|
||||
def get_progress_action_service_factory(
|
||||
planfix_client: PlanfixClientDependency,
|
||||
) -> ProgressActionServiceFactory:
|
||||
return ProgressActionServiceFactory(planfix_client=planfix_client)
|
||||
|
||||
|
||||
ProgressActionServiceFactoryDependency = Annotated[
|
||||
|
|
|
|||
|
|
@ -4,9 +4,14 @@ from .base import BaseProgressActionService
|
|||
from .wait_progress_action import WaitProgressActionService
|
||||
from .comment_progress_action import CommentProgressActionService
|
||||
|
||||
from planfix_client import PlanfixClient
|
||||
|
||||
|
||||
class ProgressActionServiceFactory:
|
||||
|
||||
def __init__(self, planfix_client: PlanfixClient):
|
||||
self.planfix_client = planfix_client
|
||||
|
||||
def __call__(
|
||||
self, progress_action: BaseProgressAction
|
||||
) -> BaseProgressActionService:
|
||||
|
|
@ -17,4 +22,4 @@ class ProgressActionServiceFactory:
|
|||
return WaitProgressActionService()
|
||||
|
||||
case "comment":
|
||||
return CommentProgressActionService()
|
||||
return CommentProgressActionService(planfix_client=self.planfix_client)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user