|
|
|
@ -1,13 +1,13 @@
|
|
|
|
|
import Filter from '../../../../models/Filter'; |
|
|
|
|
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn'; |
|
|
|
|
import { Knex } from 'knex'; |
|
|
|
|
import { XKnex } from '../../index'; |
|
|
|
|
import Column from '../../../../models/Column'; |
|
|
|
|
import LookupColumn from '../../../../models/LookupColumn'; |
|
|
|
|
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn'; |
|
|
|
|
import type { Knex } from 'knex'; |
|
|
|
|
import type { XKnex } from '../../index'; |
|
|
|
|
import type Column from '../../../../models/Column'; |
|
|
|
|
import type LookupColumn from '../../../../models/LookupColumn'; |
|
|
|
|
import genRollupSelectv2 from './genRollupSelectv2'; |
|
|
|
|
import RollupColumn from '../../../../models/RollupColumn'; |
|
|
|
|
import type RollupColumn from '../../../../models/RollupColumn'; |
|
|
|
|
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2'; |
|
|
|
|
import FormulaColumn from '../../../../models/FormulaColumn'; |
|
|
|
|
import type FormulaColumn from '../../../../models/FormulaColumn'; |
|
|
|
|
import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk'; |
|
|
|
|
import { sanitize } from './helpers/sanitize'; |
|
|
|
|
import dayjs, { extend } from 'dayjs'; |
|
|
|
@ -576,53 +576,57 @@ const parseConditionV2 = async (
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'gt': { |
|
|
|
|
const gt_op = customWhereClause ? '<' : '>'; |
|
|
|
|
qb = qb.where(field, gt_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset rating is considered as NULL
|
|
|
|
|
if (gt_op === '<' && val > 0) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
case 'gt': |
|
|
|
|
{ |
|
|
|
|
const gt_op = customWhereClause ? '<' : '>'; |
|
|
|
|
qb = qb.where(field, gt_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset rating is considered as NULL
|
|
|
|
|
if (gt_op === '<' && val > 0) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case 'ge': |
|
|
|
|
case 'gte': { |
|
|
|
|
const ge_op = customWhereClause ? '<=' : '>='; |
|
|
|
|
qb = qb.where(field, ge_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset rating is considered as NULL
|
|
|
|
|
if (ge_op === '<=' || (ge_op === '>=' && val === 0)) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
case 'gte': |
|
|
|
|
{ |
|
|
|
|
const ge_op = customWhereClause ? '<=' : '>='; |
|
|
|
|
qb = qb.where(field, ge_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset rating is considered as NULL
|
|
|
|
|
if (ge_op === '<=' || (ge_op === '>=' && val === 0)) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case 'lt': { |
|
|
|
|
const lt_op = customWhereClause ? '>' : '<'; |
|
|
|
|
qb = qb.where(field, lt_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset number is considered as NULL
|
|
|
|
|
if (lt_op === '<' && val > 0) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
case 'lt': |
|
|
|
|
{ |
|
|
|
|
const lt_op = customWhereClause ? '>' : '<'; |
|
|
|
|
qb = qb.where(field, lt_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset number is considered as NULL
|
|
|
|
|
if (lt_op === '<' && val > 0) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'le': |
|
|
|
|
case 'lte': { |
|
|
|
|
const le_op = customWhereClause ? '>=' : '<='; |
|
|
|
|
qb = qb.where(field, le_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset number is considered as NULL
|
|
|
|
|
if (le_op === '<=' || (le_op === '>=' && val === 0)) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
case 'lte': |
|
|
|
|
{ |
|
|
|
|
const le_op = customWhereClause ? '>=' : '<='; |
|
|
|
|
qb = qb.where(field, le_op, val); |
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
|
// unset number is considered as NULL
|
|
|
|
|
if (le_op === '<=' || (le_op === '>=' && val === 0)) { |
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case 'in': |
|
|
|
|
qb = qb.whereIn( |
|
|
|
|
field, |
|
|
|
|