fix: ability to query relationships not equal to ID (#6555)

This commit is contained in:
Jarrod Flesch
2024-05-29 13:47:44 -04:00
committed by GitHub
parent 54e2d7fb38
commit 043a91d719
2 changed files with 33 additions and 5 deletions

View File

@@ -618,6 +618,30 @@ describe('collections-rest', () => {
})
})
it('should query relationships by not_equals', async () => {
const ogPost = await createPost({
relationMultiRelationTo: { relationTo: relationSlug, value: relation.id },
})
await createPost()
const response = await restClient.GET(`/${slug}`, {
query: {
where: {
and: [
{
'relationMultiRelationTo.value': { not_equals: relation.id },
},
],
},
},
})
const result = await response.json()
expect(response.status).toEqual(200)
const foundExcludedDoc = result.docs.some((doc) => ogPost.id === doc.id)
expect(foundExcludedDoc).toBe(false)
})
describe('relationTo multi hasMany', () => {
it('nested by id', async () => {
const post1 = await createPost({