修复:恢复 PostgreSQL 集成测试并规范工单搜索条件
This commit is contained in:
@@ -35,7 +35,7 @@ test(
|
||||
const tableName = `integration_webhook_${Date.now()}`
|
||||
try {
|
||||
await pool.query(
|
||||
`CREATE TEMP TABLE ${tableName} (
|
||||
`CREATE TABLE ${tableName} (
|
||||
id serial primary key,
|
||||
provider text not null,
|
||||
event_id text not null,
|
||||
@@ -54,6 +54,7 @@ test(
|
||||
const result = await pool.query(`SELECT COUNT(*)::int AS count FROM ${tableName}`)
|
||||
assert.equal(result.rows[0].count, 1)
|
||||
} finally {
|
||||
await pool.query(`DROP TABLE IF EXISTS ${tableName}`)
|
||||
await pool.end()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -690,6 +690,7 @@ export function buildWorkOrderWhere({
|
||||
const filters: string[] = []
|
||||
const params: unknown[] = []
|
||||
const joins: string[] = []
|
||||
const normalizedKeyword = String(keyword || '').trim()
|
||||
if (createdFrom) {
|
||||
params.push(createdFrom)
|
||||
filters.push(
|
||||
@@ -808,8 +809,8 @@ export function buildWorkOrderWhere({
|
||||
params.push(workOrderId)
|
||||
filters.push(`wo.id = $${params.length}`)
|
||||
}
|
||||
if (keyword) {
|
||||
params.push(`%${keyword}%`)
|
||||
if (normalizedKeyword) {
|
||||
params.push(`%${normalizedKeyword}%`)
|
||||
filters.push(`${workOrderSearchExpression()} LIKE LOWER($${params.length})`)
|
||||
}
|
||||
if (workerId) {
|
||||
|
||||
Reference in New Issue
Block a user