π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
refactor: review comments
Pranav Cc0bd6a265286
diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.tsindex 54a4d9958b..ac97739918 100644--- a/packages/nocodb/src/services/columns.service.ts+++ b/packages/nocodb/src/services/columns.service.ts@@ -1971,16 +1971,15 @@ export class ColumnsService implements IColumnsService {// Handle filter transformation if this is a column type changeif (column.uidt !== colBody.uidt) {try {- await this.filtersService.transformFiltersForColumnTypeChange(- context,- column.id,- colBody.uidt as UITypes,- column.uidt as UITypes,+ await this.filtersService.transformFiltersForColumnTypeChange(context, {+ columnId: column.id,+ newColumnType: colBody.uidt as UITypes,+ oldColumnType: column.uidt as UITypes,sqlUi,- );+ });} catch (error) {// Log error but don't fail the column update- console.error(+ this.logger.error('Failed to transform filters for column type change:',error.message,);diff --git a/packages/nocodb/src/services/filters.service.ts b/packages/nocodb/src/services/filters.service.tsindex 411fd9a793..7bb8cf235c 100644--- a/packages/nocodb/src/services/filters.service.ts+++ b/packages/nocodb/src/services/filters.service.ts@@ -304,12 +304,16 @@ export class FiltersService {*/async transformFiltersForColumnTypeChange(context: NcContext,- columnId: string,- newColumnType: UITypes,- oldColumnType: UITypes,- sqlUi: any,+ params: {+ columnId: string;+ newColumnType: UITypes;+ oldColumnType: UITypes;+ sqlUi: any;+ },ncMeta = Noco.ncMeta,): Promise<void> {+ const { columnId, newColumnType, oldColumnType, sqlUi } = params;+// Get all filters that reference this column from all tablesconst filtersToCheck = await this.getAllFiltersForColumn(context,@@ -459,16 +463,16 @@ export class FiltersService {};}- // Check if operator is compatible with new type- if (this.isOperatorCompatible(operator, newColumnType, oldColumnType)) {- return { shouldRemove: false };+ // Operator is not compatible, filter must be removed+ if (!this.isOperatorCompatible(operator, newColumnType, oldColumnType)) {+ return {+ shouldRemove: true,+ reason: `Operator ${operator} is not compatible with column type ${newColumnType}`,+ };}- // Operator is not compatible, filter must be removed- return {- shouldRemove: true,- reason: `Operator ${operator} is not compatible with column type ${newColumnType}`,- };+ // Operator is compatible, no removal needed+ return { shouldRemove: false };}/**