🚀 feat(custom_component.py): add methods to retrieve flow by name and flow by id for CustomComponent
🐛 fix(custom_component.py): fix indentation issue in CustomComponent class
This commit is contained in:
parent
2ec4cf1a55
commit
9acb6fef36
1 changed files with 10 additions and 0 deletions
|
|
@ -158,5 +158,15 @@ class CustomComponent(Component, extra=Extra.allow):
|
||||||
flows = session.query(Flow).all()
|
flows = session.query(Flow).all()
|
||||||
return flows
|
return flows
|
||||||
|
|
||||||
|
def get_flow(self, flow_name: str) -> Flow:
|
||||||
|
with session_getter() as session:
|
||||||
|
flow = session.query(Flow).filter(Flow.name == flow_name).first()
|
||||||
|
return flow
|
||||||
|
|
||||||
|
def get_flow_by_id(self, flow_id: str) -> Flow:
|
||||||
|
with session_getter() as session:
|
||||||
|
flow = session.query(Flow).filter(Flow.id == flow_id).first()
|
||||||
|
return flow
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue