HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/buyercall/blueprints/workflows/__pycache__/models.cpython-310.pyc
o

we]�@s�ddlZddlmZddlmZddlmZddlmZddl	m
Z
Gdd�de
ej�ZGd	d
�d
e
ej�Z
Gdd�de
ej�ZdS)
�N)�
postgresql)�UUID)�Team)�db)�
ResourceMixinc@szeZdZdZejejdd�Zejedd�de	j
dd�Zeje�d�ddd	�Z
eje��dd
dd�Zdd
�Zedd��ZdS)�
WordkflowType�
workflow_typeT��primary_key��as_uuid��unique�default�index�@F���nullable�server_default�1�rrrcC�|jS�N��name��self�r�G/home/arjun/projects/buyercall/buyercall/blueprints/workflows/models.py�__str__�zWordkflowType.__str__cC�|j�|j|k���r
dSdS�NTF��query�filterr�first��clsrrrr�is_name_exists�zWordkflowType.is_name_existsN)�__name__�
__module__�__qualname__�
__tablename__r�Column�Integer�idr�uuid�uuid4�sid�Stringr�Boolean�	is_activer �classmethodr*rrrrrsrc@s�eZdZdZejejdd�Zejedd�de	j
dd�Zeje��dddd�Z
ejejdd	d
�Zejejdd	d
�Zejejdd	d�Zdd
�Zedd��Zedd��ZdS)�WorkflowConditionAction�workflow_condition_actionTr	rr
Frrz{}r�rrcCs
t|j�Sr)�strr5rrrrr %s
zWorkflowConditionAction.__str__cC�$|j�|j|k���}|r|jSiSr)r%r&r2r'�
conditions�r)�aid�detailrrr�get_condition_by_id(�z+WorkflowConditionAction.get_condition_by_idcCr>r)r%r&r2r'�actionsr@rrr�get_actions_by_id-rDz)WorkflowConditionAction.get_actions_by_idN)r,r-r.r/rr0r1r2rr3r4r5r7�is_new_contactr�JSONr?rE�	meta_datar r9rCrFrrrrr:s
r:c@s�eZdZdZejejdd�Zejedd�de	j
dd�Zeje�d�ddd	�Z
eje�d
�dd�Zeje��dddd
�Zejejddd�Zejejejdddd�ddd�Zejejejdddd�ddd�Zejejejdddd�ddd�Zejejejdddd�ddd�Zejejejdddd�ddd�Zejejejdddd�ddd�Zdd�Zedd��Zedd��Zdd�Zd d!�Zd"d#�Zd$d%�Z d&S)'�Workflow�workflowTr	rr
rFrri)rrr�0r<zworkflow_type.id�CASCADE)�onupdate�ondelete)rrzworkflow_condition_action.idzusers.idzpartnership_accounts.idzpartnerships.idcCrrrrrrrr Lr!zWorkflow.__str__cCr"r#r$r(rrrr*Or+zWorkflow.is_name_existscCs|j�|j|k|jdk���S)NT)r%r&�partnership_account_idr8�all)r)�pa_idrrr�get_by_partnership_accountSr+z#Workflow.get_by_partnership_accountcC�t�|j�Sr)r:rC�workflow_detailrrrr�get_conditionsWszWorkflow.get_conditionscCrT)r)r:rFrUrrrr�get_actionsZszWorkflow.get_actionscCstj�tj|jk���Sr)r:r%r&r2rUr'rrrr�
get_detail^szWorkflow.get_detailcCsL|��j}|�dg�}|�dg�}|D]}t�|�}|�|�qtt|��S)N�agentIds�teamIds)rXrI�getr�get_agent_sids_by_team_sid�extend�list�set)rrI�	agent_ids�team_ids�tid�team_agent_idsrrr�get_agents_assigned_in_actionsas

z'Workflow.get_agents_assigned_in_actionsN)!r,r-r.r/rr0r1r2rr3r4r5r6r�descriptionr7r8�status�
ForeignKeyrrU�
created_by�
updated_byrP�partnership_idr r9r*rSrVrWrXrdrrrrrJ3s^������������

rJ)r3�sqlalchemy.dialectsr�sqlalchemy.dialects.postgresqlr�"buyercall.blueprints.agents.modelsr�buyercall.extensionsr�buyercall.lib.util_sqlalchemyr�Modelrr:rJrrrr�<module>s