fix: type corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
This commit is contained in:
Pranav C
2023-02-25 15:19:01 +05:30
parent ad92b58952
commit f1b75b16e1
4 changed files with 13 additions and 6 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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"