fix(db-postgres): search is broken when useAsTitle is not specified (#13232)
Fixes https://github.com/payloadcms/payload/issues/13171
This commit is contained in:
@@ -219,7 +219,10 @@ export function parseParams({
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
operator === 'like' &&
|
operator === 'like' &&
|
||||||
(field.type === 'number' || table[columnName].columnType === 'PgUUID')
|
(field.type === 'number' ||
|
||||||
|
field.type === 'relationship' ||
|
||||||
|
field.type === 'upload' ||
|
||||||
|
table[columnName].columnType === 'PgUUID')
|
||||||
) {
|
) {
|
||||||
operator = 'equals'
|
operator = 'equals'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3001,6 +3001,21 @@ describe('database', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should allow to query like by ID with draft: true', async () => {
|
||||||
|
const category = await payload.create({
|
||||||
|
collection: 'categories',
|
||||||
|
data: { title: 'category123' },
|
||||||
|
})
|
||||||
|
const res = await payload.find({
|
||||||
|
collection: 'categories',
|
||||||
|
draft: true,
|
||||||
|
// eslint-disable-next-line jest/no-conditional-in-test
|
||||||
|
where: { id: { like: typeof category.id === 'number' ? `${category.id}` : category.id } },
|
||||||
|
})
|
||||||
|
expect(res.docs).toHaveLength(1)
|
||||||
|
expect(res.docs[0].id).toBe(category.id)
|
||||||
|
})
|
||||||
|
|
||||||
it('should allow incremental number update', async () => {
|
it('should allow incremental number update', async () => {
|
||||||
const post = await payload.create({ collection: 'posts', data: { number: 1, title: 'post' } })
|
const post = await payload.create({ collection: 'posts', data: { number: 1, title: 'post' } })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user