Browse Source

fix: add field validation wherever missing

pull/6974/head
Pranav C 1 year ago
parent
commit
8fded81bcb
  1. 2
      packages/nocodb/src/db/conditionV2.ts
  2. 4
      packages/nocodb/src/helpers/getAst.ts

2
packages/nocodb/src/db/conditionV2.ts

@ -342,7 +342,7 @@ const parseConditionV2 = async (
return (qbP: Knex.QueryBuilder) => { return (qbP: Knex.QueryBuilder) => {
if (filter.comparison_op in negatedMapping) if (filter.comparison_op in negatedMapping)
qbP.where((qb) => qbP.where((qb) =>
qbP qb
.whereNotIn(childColumn.column_name, selectQb) .whereNotIn(childColumn.column_name, selectQb)
.orWhereNull(childColumn.column_name), .orWhereNull(childColumn.column_name),
); );

4
packages/nocodb/src/helpers/getAst.ts

@ -69,7 +69,9 @@ const getAst = async ({
if (throwErrorIfInvalidParams) { if (throwErrorIfInvalidParams) {
const colAliasMap = await model.getColAliasMapping(); const colAliasMap = await model.getColAliasMapping();
const aliasColMap = await model.getAliasColMapping(); const aliasColMap = await model.getAliasColMapping();
const invalidFields = fields.filter((f) => !colAliasMap[f] && !aliasColMap[f]); const invalidFields = fields.filter(
(f) => !colAliasMap[f] && !aliasColMap[f],
);
if (invalidFields.length) { if (invalidFields.length) {
NcError.unprocessableEntity( NcError.unprocessableEntity(
`Following fields are invalid: ${invalidFields.join(', ')}`, `Following fields are invalid: ${invalidFields.join(', ')}`,

Loading…
Cancel
Save