Browse Source

Merge pull request #6730 from nocodb/feat/import-date-filter

feat: import date/datetime filters from airtable
pull/6742/head
Raju Udava 1 year ago committed by GitHub
parent
commit
568dc3aed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

33
packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

@ -2020,8 +2020,8 @@ export class AtImportProcessor {
'<=': 'lte', '<=': 'lte',
'>': 'gt', '>': 'gt',
'>=': 'gte', '>=': 'gte',
isEmpty: 'empty', isEmpty: 'blank',
isNotEmpty: 'notempty', isNotEmpty: 'notblank',
contains: 'like', contains: 'like',
doesNotContain: 'nlike', doesNotContain: 'nlike',
isAnyOf: 'anyof', isAnyOf: 'anyof',
@ -2051,12 +2051,9 @@ export class AtImportProcessor {
const ncFilters = []; const ncFilters = [];
// console.log(filter) // console.log(filter)
if ( if (datatype === UITypes.Links) {
datatype === UITypes.Date || // skip filters for links; Link filters in NocoDB are only rollup counts
datatype === UITypes.DateTime || // where-as in airtable, filter can be textual
datatype === UITypes.Links
) {
// skip filters over data datatype
updateMigrationSkipLog( updateMigrationSkipLog(
await sMap.getNcNameFromAtId(viewId), await sMap.getNcNameFromAtId(viewId),
colSchema.title, colSchema.title,
@ -2100,6 +2097,26 @@ export class AtImportProcessor {
}; };
ncFilters.push(fx); ncFilters.push(fx);
} }
} else if (datatype === UITypes.Date || datatype === UITypes.DateTime) {
if (filter.operator === 'isWithin') {
const fx = {
fk_column_id: columnId,
logical_op: f.conjunction,
comparison_op: filter.operator,
comparison_sub_op: filter.value?.mode,
value: filter.value?.numberOfDays,
};
ncFilters.push(fx);
} else {
const fx = {
fk_column_id: columnId,
logical_op: f.conjunction,
comparison_op: filterMap[filter.operator],
comparison_sub_op: filter.value?.mode,
value: filter.value?.exactDate,
};
ncFilters.push(fx);
}
} }
// other data types (number/ text/ long text/ ..) // other data types (number/ text/ long text/ ..)

Loading…
Cancel
Save