Browse Source

refactor: wrap switch case

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5252/head
Pranav C 2 years ago
parent
commit
1ba4726007
  1. 17
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

17
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

@ -576,7 +576,8 @@ const parseConditionV2 = async (
} }
} }
break; break;
case 'gt': { case 'gt':
{
const gt_op = customWhereClause ? '<' : '>'; const gt_op = customWhereClause ? '<' : '>';
qb = qb.where(field, gt_op, val); qb = qb.where(field, gt_op, val);
if (column.uidt === UITypes.Rating) { if (column.uidt === UITypes.Rating) {
@ -585,10 +586,12 @@ const parseConditionV2 = async (
qb = qb.orWhereNull(field); qb = qb.orWhereNull(field);
} }
} }
}
break; break;
} }
case 'ge': case 'ge':
case 'gte': { case 'gte':
{
const ge_op = customWhereClause ? '<=' : '>='; const ge_op = customWhereClause ? '<=' : '>=';
qb = qb.where(field, ge_op, val); qb = qb.where(field, ge_op, val);
if (column.uidt === UITypes.Rating) { if (column.uidt === UITypes.Rating) {
@ -597,9 +600,10 @@ const parseConditionV2 = async (
qb = qb.orWhereNull(field); qb = qb.orWhereNull(field);
} }
} }
break;
} }
case 'lt': { break;
}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) {
@ -608,11 +612,13 @@ const parseConditionV2 = async (
qb = qb.orWhereNull(field); qb = qb.orWhereNull(field);
} }
} }
}
break; break;
} }
case 'le': case 'le':
case 'lte': { case 'lte':
{
const le_op = customWhereClause ? '>=' : '<='; const le_op = customWhereClause ? '>=' : '<=';
qb = qb.where(field, le_op, val); qb = qb.where(field, le_op, val);
if (column.uidt === UITypes.Rating) { if (column.uidt === UITypes.Rating) {
@ -621,6 +627,7 @@ const parseConditionV2 = async (
qb = qb.orWhereNull(field); qb = qb.orWhereNull(field);
} }
} }
}
break; break;
} }
case 'in': case 'in':

Loading…
Cancel
Save