fix: fixed a problem for uppercase fields on search by (#446)
This commit is contained in:
parent
4f3898b273
commit
f85bd02b11
@ -302,11 +302,18 @@ export async function paginate<T extends ObjectLiteral>(
|
|||||||
propertyPath.length > 1 &&
|
propertyPath.length > 1 &&
|
||||||
queryBuilder.expressionMap.mainAlias.metadata.hasRelationWithPropertyPath(propertyPath[0])
|
queryBuilder.expressionMap.mainAlias.metadata.hasRelationWithPropertyPath(propertyPath[0])
|
||||||
|
|
||||||
const aliasColumn = hasRelation ? `${qb.alias}_${column}` : `${qb.alias}.${column}`
|
|
||||||
|
|
||||||
if (['postgres', 'cockroachdb'].includes(queryBuilder.connection.options.type)) {
|
if (['postgres', 'cockroachdb'].includes(queryBuilder.connection.options.type)) {
|
||||||
|
const alias = hasRelation ? `"${qb.alias}"_` : `"${qb.alias}".`
|
||||||
|
let columns = ''
|
||||||
|
|
||||||
|
for (const property of propertyPath) {
|
||||||
|
columns += `"${property}".`
|
||||||
|
}
|
||||||
|
const aliasColumn = alias + columns.substring(0, columns.length - 1)
|
||||||
|
|
||||||
qb.orWhere(`${aliasColumn}::text ILIKE '%${query.search}%'`)
|
qb.orWhere(`${aliasColumn}::text ILIKE '%${query.search}%'`)
|
||||||
} else {
|
} else {
|
||||||
|
const aliasColumn = hasRelation ? `${qb.alias}_${column}` : `${qb.alias}.${column}`
|
||||||
qb.orWhere(`UPPER(${aliasColumn}) LIKE UPPER('%${query.search}%')`)
|
qb.orWhere(`UPPER(${aliasColumn}) LIKE UPPER('%${query.search}%')`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user