Browse Source

fix: type corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5174/head
Pranav C 2 years ago
parent
commit
f1b75b16e1
  1. 4
      packages/nocodb-sdk/src/lib/Api.ts
  2. 9
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts
  3. 2
      packages/nocodb/src/lib/models/Filter.ts
  4. 4
      scripts/sdk/swagger.json

4
packages/nocodb-sdk/src/lib/Api.ts

@ -198,7 +198,7 @@ export interface FilterType {
logical_op?: string;
comparison_op?: string;
value?: string | number | boolean | null;
is_group?: string | number | null;
is_group?: boolean | number | null;
children?: FilterType[];
project_id?: string;
base_id?: string;
@ -214,7 +214,7 @@ export interface FilterReqType {
logical_op?: string;
comparison_op?: string;
value?: string | number | boolean | null;
is_group?: string | number | null;
is_group?: boolean | number | null;
children?: FilterType[];
project_id?: string;
base_id?: string;

9
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts

@ -1,5 +1,6 @@
import { Knex, knex } from 'knex';
import { SnowflakeClient } from 'nc-help';
import { FilterType } from 'nocodb-sdk';
const types = require('pg').types;
// override parsing date column to Date()
@ -1248,7 +1249,13 @@ knex.QueryBuilder.extend('conditionv2', function (conditionObj: Filter) {
return parseConditionv2(conditionObj, this);
} as any);
const parseConditionv2 = (obj: Filter, qb: Knex.QueryBuilder) => {
const parseConditionv2 = (_obj: Filter | FilterType, qb: Knex.QueryBuilder) => {
let obj: Filter;
if (_obj instanceof Filter) {
obj = _obj;
} else {
obj = new Filter(_obj);
}
if (obj.is_group) {
qb = qb.where(function () {
const children = obj.children;

2
packages/nocodb/src/lib/models/Filter.ts

@ -55,7 +55,7 @@ export default class Filter {
value?: string;
logical_op?: string;
is_group?: boolean;
is_group?: boolean | number;
children?: Filter[];
project_id?: string;
base_id?: string;

4
scripts/sdk/swagger.json

@ -8105,7 +8105,7 @@
"is_group": {
"oneOf": [
{
"type": "string"
"type": "boolean"
},
{
"type": "integer"
@ -8172,7 +8172,7 @@
"is_group": {
"oneOf": [
{
"type": "string"
"type": "boolean"
},
{
"type": "integer"

Loading…
Cancel
Save