Fix notContains tests again.

This commit is contained in:
Sam Rose 2024-10-24 11:20:31 +01:00
parent 4a42439647
commit e14918c105
No known key found for this signature in database
2 changed files with 11 additions and 3 deletions

View File

@ -740,12 +740,12 @@ class InternalBuilder {
return q return q
} }
return q.where(subQuery => { q = q.where(subQuery => {
if (mode === filters?.notContains) { if (mode === filters?.notContains) {
subQuery = subQuery.not subQuery = subQuery.not
} }
return subQuery.where(subSubQuery => { subQuery = subQuery.where(subSubQuery => {
for (const elem of value) { for (const elem of value) {
if (mode === filters?.containsAny) { if (mode === filters?.containsAny) {
subSubQuery = subSubQuery.or subSubQuery = subSubQuery.or
@ -765,7 +765,15 @@ class InternalBuilder {
) )
} }
}) })
if (mode === filters?.notContains) {
subQuery = subQuery.or.whereNull(
// @ts-expect-error knex types are wrong, raw is fine here
this.rawQuotedIdentifier(key)
)
}
return subQuery
}) })
return q
}) })
} }
} }

View File

@ -2163,7 +2163,7 @@ describe.each([
}) })
}) })
describe.only("multi user", () => { describe("multi user", () => {
let user1: User let user1: User
let user2: User let user2: User