Browse Source

fix(nocodb): calendar ranges doesnot delete on view deletion

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
b9dad5c977
  1. 23
      packages/nocodb/src/models/View.ts

23
packages/nocodb/src/models/View.ts

@ -1001,6 +1001,8 @@ export default class View implements ViewType {
order: colData.order, order: colData.order,
show: colData.show, show: colData.show,
}); });
case ViewTypes.CALENDAR:
// todo: calendar view column
} }
return await ncMeta.metaInsert2(view.base_id, view.source_id, table, { return await ncMeta.metaInsert2(view.base_id, view.source_id, table, {
fk_view_id: viewId, fk_view_id: viewId,
@ -1201,6 +1203,7 @@ export default class View implements ViewType {
await Sort.deleteAll(viewId, ncMeta); await Sort.deleteAll(viewId, ncMeta);
await Filter.deleteAll(viewId, ncMeta); await Filter.deleteAll(viewId, ncMeta);
const table = this.extractViewTableName(view); const table = this.extractViewTableName(view);
const tableScope = this.extractViewTableNameScope(view); const tableScope = this.extractViewTableNameScope(view);
const columnTable = this.extractViewColumnsTableName(view); const columnTable = this.extractViewColumnsTableName(view);
const columnTableScope = this.extractViewColumnsTableNameScope(view); const columnTableScope = this.extractViewColumnsTableNameScope(view);
@ -1215,6 +1218,14 @@ export default class View implements ViewType {
`${tableScope}:${viewId}`, `${tableScope}:${viewId}`,
CacheDelDirection.CHILD_TO_PARENT, CacheDelDirection.CHILD_TO_PARENT,
); );
// For Calendar View, delete the range associated with viewId
if (view.type === ViewTypes.CALENDAR) {
await ncMeta.metaDelete(null, null, MetaTable.CALENDAR_VIEW_RANGE, {
fk_view_id: viewId,
})
await NocoCache.deepDel(CacheScope.CALENDAR_VIEW_RANGE, `${CacheScope.CALENDAR_VIEW_RANGE}:${viewId}`, CacheDelDirection.CHILD_TO_PARENT)
}
await NocoCache.deepDel( await NocoCache.deepDel(
`${columnTableScope}:${viewId}`, `${columnTableScope}:${viewId}`,
CacheDelDirection.CHILD_TO_PARENT, CacheDelDirection.CHILD_TO_PARENT,
@ -1255,6 +1266,9 @@ export default class View implements ViewType {
case ViewTypes.MAP: case ViewTypes.MAP:
table = MetaTable.MAP_VIEW_COLUMNS; table = MetaTable.MAP_VIEW_COLUMNS;
break; break;
case ViewTypes.CALENDAR:
table = MetaTable.CALENDAR_VIEW_COLUMNS;
break;
} }
return table; return table;
} }
@ -1277,6 +1291,9 @@ export default class View implements ViewType {
case ViewTypes.MAP: case ViewTypes.MAP:
table = MetaTable.MAP_VIEW; table = MetaTable.MAP_VIEW;
break; break;
case ViewTypes.CALENDAR:
table = MetaTable.CALENDAR_VIEW;
break;
} }
return table; return table;
} }
@ -1299,6 +1316,9 @@ export default class View implements ViewType {
case ViewTypes.FORM: case ViewTypes.FORM:
scope = CacheScope.FORM_VIEW_COLUMN; scope = CacheScope.FORM_VIEW_COLUMN;
break; break;
case ViewTypes.CALENDAR:
scope = CacheScope.CALENDAR_VIEW_COLUMN;
break;
} }
return scope; return scope;
} }
@ -1321,6 +1341,9 @@ export default class View implements ViewType {
case ViewTypes.FORM: case ViewTypes.FORM:
scope = CacheScope.FORM_VIEW; scope = CacheScope.FORM_VIEW;
break; break;
case ViewTypes.CALENDAR:
scope = CacheScope.CALENDAR_VIEW;
break;
} }
return scope; return scope;
} }

Loading…
Cancel
Save