feat(file-check): 更新文件检核工具 API Key 配置及相关文档
This commit is contained in:
1 parent
634dee4b81
commit
55cf7ff734
74 files changed
+1525
-1182
No files matched your search
@@ -283,6 +283,7 @@ def serialize_batch_for_tool(batch: ShippingBatch | None) -> dict[str, Any] | No
|
||||
|
||||
|
||||
def serialize_batch_summary(batch: ShippingBatch) -> dict[str, Any]:
|
||||
"""工作台批次列表/详情用的批次摘要投影。"""
|
||||
tasks = list(batch.tasks or [])
|
||||
return {
|
||||
"id": batch.id,
|
||||
@@ -297,14 +298,17 @@ def serialize_batch_summary(batch: ShippingBatch) -> dict[str, Any]:
|
||||
|
||||
|
||||
def serialize_task_summary(task: ShippingTask) -> dict[str, Any]:
|
||||
"""工作台任务列表用的 SUMMARY 投影。"""
|
||||
return serialize_task(task, TaskProjection.SUMMARY)
|
||||
|
||||
|
||||
def serialize_task_detail(task: ShippingTask) -> dict[str, Any]:
|
||||
"""工作台任务详情用的 DETAIL 投影(含 lines、events 等)。"""
|
||||
return serialize_task(task, TaskProjection.DETAIL)
|
||||
|
||||
|
||||
def get_batch_for_user(batch_no: str, user_id: int) -> ShippingBatch | None:
|
||||
"""按 batch_no 查找批次并校验 user_id 归属。"""
|
||||
batch = get_batch_by_no(batch_no)
|
||||
if not batch:
|
||||
return None
|
||||
@@ -318,6 +322,7 @@ def list_batches_for_user(
|
||||
*,
|
||||
limit: int = 100,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""列出用户可见批次摘要(按 created_at 降序,limit 上限 500)。"""
|
||||
q = ShippingBatch.query.filter(
|
||||
(ShippingBatch.user_id == user_id) | (ShippingBatch.user_id.is_(None))
|
||||
)
|
||||
@@ -326,6 +331,7 @@ def list_batches_for_user(
|
||||
|
||||
|
||||
def list_tasks_for_batch(batch_no: str, user_id: int) -> list[dict[str, Any]]:
|
||||
"""列出批次下已排序任务的 SUMMARY 投影;批次不存在或无权限时返回空列表。"""
|
||||
batch = get_batch_for_user(batch_no, user_id)
|
||||
if not batch:
|
||||
return []
|
||||
@@ -333,6 +339,7 @@ def list_tasks_for_batch(batch_no: str, user_id: int) -> list[dict[str, Any]]:
|
||||
|
||||
|
||||
def get_focus_task_for_batch(batch_no: str, user_id: int) -> ShippingTask | None:
|
||||
"""获取批次当前 focus 任务;未设置时返回 batch_index 最小的首票。"""
|
||||
batch = get_batch_for_user(batch_no, user_id)
|
||||
if not batch:
|
||||
return None
|
||||
@@ -352,6 +359,7 @@ def list_tasks_for_user(
|
||||
process_status: str | None = None,
|
||||
limit: int = 100,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""列出用户可见任务摘要,可按 batch_no / process_status 过滤。"""
|
||||
q = ShippingTask.query.filter(
|
||||
(ShippingTask.user_id == user_id) | (ShippingTask.user_id.is_(None))
|
||||
)
|
||||
@@ -367,6 +375,7 @@ def list_tasks_for_user(
|
||||
|
||||
|
||||
def get_task_for_user(task_no: str, user_id: int) -> ShippingTask | None:
|
||||
"""按 task_no 查找任务并校验 user_id 归属。"""
|
||||
task = get_task_by_ref(task_no)
|
||||
if not task:
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user