style(backend): 格式化代码并修复floating-promises以通过pre-push检查

This commit is contained in:
yml2213
2026-09-12 17:46:47 +08:00
parent 8cc3aa2a35
commit fea82bff36
12 changed files with 55 additions and 71 deletions
@@ -1,10 +1,10 @@
import { query } from "../../db/client.js"
import { runtimeConfig } from "../../config/runtime.js"
import { getWorkerProductMatchConfig } from "../worker-platform/worker-product-match-config-service.js"
import { pruneWorkProductMatchLogs } from "../../repositories/worker-platform/product-match-repo.js"
import { query } from '../../db/client.js'
import { runtimeConfig } from '../../config/runtime.js'
import { getWorkerProductMatchConfig } from '../worker-platform/worker-product-match-config-service.js'
import { pruneWorkProductMatchLogs } from '../../repositories/worker-platform/product-match-repo.js'
export type DataRetentionResult = {
status: "ok"
status: 'ok'
message: string
rawPayloadRows: number
taskEventRows: number
@@ -31,20 +31,20 @@ export async function runDataRetentionJob(): Promise<DataRetentionResult> {
// 2. 清理其他报文与日志
const rawPayloadRows =
(await scrubJsonColumnInBatches("orders", "updated_at", rawPayloadDays)) +
(await scrubJsonColumnInBatches("kuaishou_industry_vouchers", "updated_at", rawPayloadDays))
(await scrubJsonColumnInBatches('orders', 'updated_at', rawPayloadDays)) +
(await scrubJsonColumnInBatches('kuaishou_industry_vouchers', 'updated_at', rawPayloadDays))
const matchLogRows = await scrubJsonColumnInBatches(
"work_product_match_logs",
"created_at",
'work_product_match_logs',
'created_at',
rawPayloadDays,
)
const taskEventRows = await deleteOldRowsInBatches("task_events", taskEventDays)
const webhookEventRows = await deleteOldRowsInBatches("webhook_events", webhookEventDays)
const auditLogRows = await deleteOldRowsInBatches("admin_audit_logs", auditLogDays)
const taskEventRows = await deleteOldRowsInBatches('task_events', taskEventDays)
const webhookEventRows = await deleteOldRowsInBatches('webhook_events', webhookEventDays)
const auditLogRows = await deleteOldRowsInBatches('admin_audit_logs', auditLogDays)
return {
status: "ok",
message: "数据保留清理完成",
status: 'ok',
message: '数据保留清理完成',
rawPayloadRows,
matchLogRows,
matchLogDeletedRows: matchLogPruneResult.totalDeleted,
@@ -14,7 +14,10 @@ export async function runPddOrderSyncJob(job: JsonObject) {
? (job.config as JsonObject)
: {}
const sourcesConfig = getPddSourcesConfig()
const pageSize = Math.min(100, Math.max(1, Number(config.pageSize || sourcesConfig.pageSize || 50)))
const pageSize = Math.min(
100,
Math.max(1, Number(config.pageSize || sourcesConfig.pageSize || 50)),
)
const maxPages = Math.min(20, Math.max(1, Number(config.maxPages || sourcesConfig.maxPages || 5)))
const orderType = Number(config.orderType ?? sourcesConfig.orderType ?? 2)