forked from erp-dev/erp
feat: query all process nodes for business_object
This commit is contained in:
35
examples/test_process_nodes_api.py
Normal file
35
examples/test_process_nodes_api.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
测试新增的 get_process_nodes API 端点
|
||||
"""
|
||||
import requests
|
||||
|
||||
BASE_URL = "http://localhost:8000"
|
||||
|
||||
# 假设你已经有了 JWT token
|
||||
TOKEN = "your_jwt_token_here"
|
||||
headers = {"Authorization": f"Bearer {TOKEN}"}
|
||||
|
||||
# 业务对象 ID
|
||||
business_object_id = 1
|
||||
|
||||
# 获取流程的所有节点
|
||||
response = requests.get(
|
||||
f"{BASE_URL}/api/v1/stateflow/business-objects/{business_object_id}/process-nodes/",
|
||||
headers=headers
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print(f"流程共有 {data['count']} 个节点:")
|
||||
print()
|
||||
|
||||
for node in data['nodes']:
|
||||
print(f"节点 {node['order'] + 1}:")
|
||||
print(f" - ProcessNode ID: {node['id']}")
|
||||
print(f" - State ID: {node['state_id']}")
|
||||
print(f" - State 名称: {node['state_name']}")
|
||||
print(f" - 顺序: {node['order']}")
|
||||
print()
|
||||
else:
|
||||
print(f"错误: {response.status_code}")
|
||||
print(response.json())
|
||||
Reference in New Issue
Block a user