增强后端 TypeScript 严格类型检查
This commit is contained in:
@@ -109,6 +109,10 @@ export function resolveOrderItemSyncPlan(
|
||||
|
||||
if (matchedIndex >= 0) {
|
||||
const matched = unmatchedExisting.splice(matchedIndex, 1)[0]
|
||||
if (!matched) {
|
||||
creates.push(item)
|
||||
continue
|
||||
}
|
||||
updates.push({
|
||||
orderItemId: matched.id,
|
||||
item,
|
||||
|
||||
@@ -195,18 +195,19 @@ export async function updateTask(taskId: number | string, patch: TaskUpdatePatch
|
||||
)
|
||||
|
||||
if (containsRuntimeContextPatch(patch)) {
|
||||
await upsertTaskRuntimeContextWithClient(client, Number(taskId), {
|
||||
runtimeSessionId: patch.runtime_session_id,
|
||||
loginType: patch.login_type,
|
||||
nickname: patch.nickname,
|
||||
roleId: patch.role_id,
|
||||
roleName: patch.role_name,
|
||||
area: patch.area,
|
||||
partitionName: patch.partition_name,
|
||||
screenshotPath: patch.screenshot_path,
|
||||
artifactsJson: patch.artifacts_json,
|
||||
stateJson: patch.state_json,
|
||||
}, patch.updated_at || current.updated_at)
|
||||
const runtimeContextPatch: TaskRuntimeContextPatch = {}
|
||||
if (patch.runtime_session_id !== undefined) runtimeContextPatch.runtimeSessionId = patch.runtime_session_id
|
||||
if (patch.login_type !== undefined) runtimeContextPatch.loginType = patch.login_type
|
||||
if (patch.nickname !== undefined) runtimeContextPatch.nickname = patch.nickname
|
||||
if (patch.role_id !== undefined) runtimeContextPatch.roleId = patch.role_id
|
||||
if (patch.role_name !== undefined) runtimeContextPatch.roleName = patch.role_name
|
||||
if (patch.area !== undefined) runtimeContextPatch.area = patch.area
|
||||
if (patch.partition_name !== undefined) runtimeContextPatch.partitionName = patch.partition_name
|
||||
if (patch.screenshot_path !== undefined) runtimeContextPatch.screenshotPath = patch.screenshot_path
|
||||
if (patch.artifacts_json !== undefined) runtimeContextPatch.artifactsJson = patch.artifacts_json
|
||||
if (patch.state_json !== undefined) runtimeContextPatch.stateJson = patch.state_json
|
||||
|
||||
await upsertTaskRuntimeContextWithClient(client, Number(taskId), runtimeContextPatch, patch.updated_at || current.updated_at)
|
||||
}
|
||||
|
||||
return getTaskByIdWithExecutor(client.query.bind(client) as TaskQueryExecutor, taskId)
|
||||
|
||||
Reference in New Issue
Block a user