Browse Source

fix(nocodb): unexpected lexical declaration in case block

pull/5262/head
Wing-Kam Wong 2 years ago
parent
commit
537c01bdb4
  1. 16
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

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

@ -576,7 +576,7 @@ 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) {
@ -586,8 +586,9 @@ const parseConditionV2 = async (
} }
} }
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,7 +598,8 @@ const parseConditionV2 = async (
} }
} }
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) {
@ -607,8 +609,10 @@ const parseConditionV2 = async (
} }
} }
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) {
@ -618,6 +622,7 @@ const parseConditionV2 = async (
} }
} }
break; break;
}
case 'in': case 'in':
qb = qb.whereIn( qb = qb.whereIn(
field, field,
@ -720,7 +725,7 @@ const parseConditionV2 = async (
case 'nbtw': case 'nbtw':
qb = qb.whereNotBetween(field, val.split(',')); qb = qb.whereNotBetween(field, val.split(','));
break; break;
case 'isWithin': case 'isWithin': {
let now = dayjs(new Date()).format(dateFormat).toString(); let now = dayjs(new Date()).format(dateFormat).toString();
now = column.uidt === UITypes.Date ? now.substring(0, 10) : now; now = column.uidt === UITypes.Date ? now.substring(0, 10) : now;
switch (filter.comparison_sub_op) { switch (filter.comparison_sub_op) {
@ -737,6 +742,7 @@ const parseConditionV2 = async (
qb = qb.whereBetween(field, [now, val]); qb = qb.whereBetween(field, [now, val]);
break; break;
} }
}
} }
}; };
} }

Loading…
Cancel
Save