refactor(api): Rename model factory methods to `new_...`

pull/19737/head
QuantumGhost 1 year ago
parent 19f9ae6aeb
commit bc89e1ea8f

@ -933,7 +933,7 @@ class WorkflowDraftVariable(Base):
return DraftVariableType.NODE return DraftVariableType.NODE
@classmethod @classmethod
def _create( def _new(
cls, cls,
*, *,
app_id: str, app_id: str,
@ -955,14 +955,14 @@ class WorkflowDraftVariable(Base):
return variable return variable
@classmethod @classmethod
def create_conversation_variable( def new_conversation_variable(
cls, cls,
*, *,
app_id: str, app_id: str,
name: str, name: str,
value: Segment, value: Segment,
) -> "WorkflowDraftVariable": ) -> "WorkflowDraftVariable":
variable = cls._create( variable = cls._new(
app_id=app_id, app_id=app_id,
node_id=CONVERSATION_VARIABLE_NODE_ID, node_id=CONVERSATION_VARIABLE_NODE_ID,
name=name, name=name,
@ -971,7 +971,7 @@ class WorkflowDraftVariable(Base):
return variable return variable
@classmethod @classmethod
def create_sys_variable( def new_sys_variable(
cls, cls,
*, *,
app_id: str, app_id: str,
@ -979,12 +979,12 @@ class WorkflowDraftVariable(Base):
value: Segment, value: Segment,
editable: bool = False, editable: bool = False,
) -> "WorkflowDraftVariable": ) -> "WorkflowDraftVariable":
variable = cls._create(app_id=app_id, node_id=SYSTEM_VARIABLE_NODE_ID, name=name, value=value) variable = cls._new(app_id=app_id, node_id=SYSTEM_VARIABLE_NODE_ID, name=name, value=value)
variable.editable = editable variable.editable = editable
return variable return variable
@classmethod @classmethod
def create_node_variable( def new_node_variable(
cls, cls,
*, *,
app_id: str, app_id: str,
@ -993,7 +993,7 @@ class WorkflowDraftVariable(Base):
value: Segment, value: Segment,
visible: bool = True, visible: bool = True,
) -> "WorkflowDraftVariable": ) -> "WorkflowDraftVariable":
variable = cls._create(app_id=app_id, node_id=node_id, name=name, value=value) variable = cls._new(app_id=app_id, node_id=node_id, name=name, value=value)
variable.visible = visible variable.visible = visible
variable.editable = True variable.editable = True
return variable return variable

Loading…
Cancel
Save