Finally fix notContains tests.
This commit is contained in:
parent
309506adab
commit
aaf4022f25
|
@ -713,7 +713,11 @@ class InternalBuilder {
|
|||
return q
|
||||
}
|
||||
|
||||
q = addModifiers(q).where(subQuery => {
|
||||
q = q.where(subQuery => {
|
||||
if (mode === filters?.notContains) {
|
||||
subQuery = subQuery.not
|
||||
}
|
||||
|
||||
subQuery.where(subSubQuery => {
|
||||
for (const elem of value) {
|
||||
if (mode === filters?.containsAny) {
|
||||
|
@ -733,14 +737,20 @@ class InternalBuilder {
|
|||
`%${lower}%`
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
return subSubQuery
|
||||
})
|
||||
|
||||
if (mode === filters?.notContains) {
|
||||
subQuery = subQuery.or.whereNull(
|
||||
// @ts-expect-error knex types are wrong, raw is fine here
|
||||
q.or.whereNull(this.rawQuotedIdentifier(key))
|
||||
this.rawQuotedIdentifier(key)
|
||||
)
|
||||
}
|
||||
|
||||
return subQuery
|
||||
})
|
||||
|
||||
return q
|
||||
})
|
||||
}
|
||||
|
|
|
@ -48,13 +48,13 @@ import { generateRowIdField } from "../../../integrations/utils"
|
|||
import { cloneDeep } from "lodash/fp"
|
||||
|
||||
describe.each([
|
||||
// ["in-memory", undefined],
|
||||
// ["lucene", undefined],
|
||||
// ["sqs", undefined],
|
||||
// [DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
|
||||
// [DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
|
||||
// [DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
|
||||
// [DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
|
||||
["in-memory", undefined],
|
||||
["lucene", undefined],
|
||||
["sqs", undefined],
|
||||
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
|
||||
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
|
||||
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
|
||||
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
|
||||
[DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)],
|
||||
])("search (%s)", (name, dsProvider) => {
|
||||
const isSqs = name === "sqs"
|
||||
|
@ -691,7 +691,7 @@ describe.each([
|
|||
])
|
||||
})
|
||||
|
||||
it.only("should not match the session user id in a multi user field", async () => {
|
||||
it("should not match the session user id in a multi user field", async () => {
|
||||
await expectQuery({
|
||||
notContains: { multi_user: ["{{ [user]._id }}"] },
|
||||
notEmpty: { multi_user: true },
|
||||
|
|
Loading…
Reference in New Issue