|
|
@ -576,49 +576,56 @@ const parseConditionV2 = async ( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'gt': { |
|
|
|
case 'gt': |
|
|
|
const gt_op = customWhereClause ? '<' : '>'; |
|
|
|
{ |
|
|
|
qb = qb.where(field, gt_op, val); |
|
|
|
const gt_op = customWhereClause ? '<' : '>'; |
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
qb = qb.where(field, gt_op, val); |
|
|
|
// unset rating is considered as NULL
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
if (gt_op === '<' && val > 0) { |
|
|
|
// unset rating is considered as NULL
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
if (gt_op === '<' && val > 0) { |
|
|
|
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
case 'ge': |
|
|
|
case 'ge': |
|
|
|
case 'gte': { |
|
|
|
case 'gte': |
|
|
|
const ge_op = customWhereClause ? '<=' : '>='; |
|
|
|
{ |
|
|
|
qb = qb.where(field, ge_op, val); |
|
|
|
const ge_op = customWhereClause ? '<=' : '>='; |
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
qb = qb.where(field, ge_op, val); |
|
|
|
// unset rating is considered as NULL
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
if (ge_op === '<=' || (ge_op === '>=' && val === 0)) { |
|
|
|
// unset rating is considered as NULL
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
if (ge_op === '<=' || (ge_op === '>=' && val === 0)) { |
|
|
|
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
}case 'lt': |
|
|
|
case 'lt': { |
|
|
|
{ |
|
|
|
const lt_op = customWhereClause ? '>' : '<'; |
|
|
|
const lt_op = customWhereClause ? '>' : '<'; |
|
|
|
qb = qb.where(field, lt_op, val); |
|
|
|
qb = qb.where(field, lt_op, val); |
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
// unset number is considered as NULL
|
|
|
|
// unset number is considered as NULL
|
|
|
|
if (lt_op === '<' && val > 0) { |
|
|
|
if (lt_op === '<' && val > 0) { |
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case 'le': |
|
|
|
case 'le': |
|
|
|
case 'lte': { |
|
|
|
case 'lte': |
|
|
|
const le_op = customWhereClause ? '>=' : '<='; |
|
|
|
{ |
|
|
|
qb = qb.where(field, le_op, val); |
|
|
|
const le_op = customWhereClause ? '>=' : '<='; |
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
qb = qb.where(field, le_op, val); |
|
|
|
// unset number is considered as NULL
|
|
|
|
if (column.uidt === UITypes.Rating) { |
|
|
|
if (le_op === '<=' || (le_op === '>=' && val === 0)) { |
|
|
|
// unset number is considered as NULL
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
if (le_op === '<=' || (le_op === '>=' && val === 0)) { |
|
|
|
|
|
|
|
qb = qb.orWhereNull(field); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|