统一前后端代码格式化配置
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { getTaskById } from '../../repositories/task-repo.js'
|
||||
import { createHttpError } from '../../utils/http.js'
|
||||
import { safeParseJson } from './admin-query-utils.js'
|
||||
import { asJsonObject, type JsonObject, JsonRecord } from '../../types/json.js'
|
||||
import { asJsonObject, type JsonObject, JsonRecord } from '../../types/json.js'
|
||||
import {
|
||||
TASK_STATUS,
|
||||
isTaskFulfillmentCompletedStatus,
|
||||
@@ -17,10 +17,7 @@ import type {
|
||||
AdminTaskListItem,
|
||||
} from '../../types/admin/read-models.js'
|
||||
import type { AdminTaskActionPayload } from '../../types/admin/write-models.js'
|
||||
import type {
|
||||
TaskEventRow,
|
||||
TaskRow,
|
||||
} from '../../types/repository/rows.js'
|
||||
import type { TaskEventRow, TaskRow } from '../../types/repository/rows.js'
|
||||
import type { AdminViewerContext } from './admin-read-shared-helpers.js'
|
||||
|
||||
type TaskFulfillmentState = {
|
||||
@@ -28,9 +25,7 @@ type TaskFulfillmentState = {
|
||||
customerStatus: string
|
||||
}
|
||||
|
||||
export function mapAdminTaskSummary(
|
||||
task: TaskRow,
|
||||
): JsonRecord {
|
||||
export function mapAdminTaskSummary(task: TaskRow): JsonRecord {
|
||||
const fulfillment = buildTaskFulfillmentState(task)
|
||||
|
||||
return {
|
||||
@@ -111,8 +106,10 @@ export function mapAdminTaskListItem(
|
||||
lastError: task.last_error,
|
||||
createdAt: task.created_at,
|
||||
updatedAt: task.updated_at,
|
||||
claimToken: viewerContext.canViewSensitiveTaskData ? (task.primary_claim_token || task.claim_token || '') : '',
|
||||
screenshotPath: viewerContext.role === 'support' ? '' : (task.screenshot_path || ''),
|
||||
claimToken: viewerContext.canViewSensitiveTaskData
|
||||
? task.primary_claim_token || task.claim_token || ''
|
||||
: '',
|
||||
screenshotPath: viewerContext.role === 'support' ? '' : task.screenshot_path || '',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +131,9 @@ export function buildOrderFulfillmentProgress(
|
||||
const totalTaskCount = normalizedTasks.length
|
||||
const taskFulfillments = normalizedTasks.map((task) => buildTaskFulfillmentState(task))
|
||||
const preparedTaskCount = normalizedTasks.filter((task) => isTaskResourcePrepared(task)).length
|
||||
const completedTaskCount = normalizedTasks.filter((task) => isTaskFulfillmentCompleted(task)).length
|
||||
const completedTaskCount = normalizedTasks.filter((task) =>
|
||||
isTaskFulfillmentCompleted(task),
|
||||
).length
|
||||
|
||||
let resourceStatus = 'pending_prepare'
|
||||
let customerStatus = 'not_started'
|
||||
@@ -152,7 +151,11 @@ export function buildOrderFulfillmentProgress(
|
||||
if (normalizedTasks.every((task) => isTaskFulfillmentCompleted(task))) {
|
||||
resourceStatus = 'resource_ready'
|
||||
customerStatus = 'customer_completed'
|
||||
} else if (taskFulfillments.some((item) => ['customer_processing', 'customer_confirmed', 'link_opened'].includes(item.customerStatus))) {
|
||||
} else if (
|
||||
taskFulfillments.some((item) =>
|
||||
['customer_processing', 'customer_confirmed', 'link_opened'].includes(item.customerStatus),
|
||||
)
|
||||
) {
|
||||
resourceStatus = preparedTaskCount > 0 ? 'resource_ready' : 'pending_prepare'
|
||||
customerStatus = 'customer_processing'
|
||||
} else if (taskFulfillments.some((item) => item.customerStatus === 'waiting_customer')) {
|
||||
@@ -163,7 +166,11 @@ export function buildOrderFulfillmentProgress(
|
||||
customerStatus = 'customer_exception'
|
||||
} else if (preparedTaskCount > 0) {
|
||||
resourceStatus = 'resource_ready'
|
||||
} else if (taskFulfillments.some((item) => ['manual_review', 'retry_pending'].includes(item.resourceStatus))) {
|
||||
} else if (
|
||||
taskFulfillments.some((item) =>
|
||||
['manual_review', 'retry_pending'].includes(item.resourceStatus),
|
||||
)
|
||||
) {
|
||||
resourceStatus = 'resource_exception'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user