From e5c12a2a9d5747768021acf7111a8bb20bff8859 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 9 Sep 2022 17:04:41 +0800 Subject: [PATCH] feat(nocodb): add KanbanViewColumn --- packages/nocodb/src/lib/models/View.ts | 29 ++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts index f48150c53e..8195cc6c53 100644 --- a/packages/nocodb/src/lib/models/View.ts +++ b/packages/nocodb/src/lib/models/View.ts @@ -36,7 +36,9 @@ export default class View implements ViewType { fk_model_id: string; model?: Model; view?: FormView | GridView | KanbanView | GalleryView; - columns?: Array; + columns?: Array< + FormViewColumn | GridViewColumn | GalleryViewColumn | KanbanViewColumn + >; sorts: Sort[]; filter: Filter; @@ -487,6 +489,17 @@ export default class View implements ViewType { ); } break; + case ViewTypes.KANBAN: + { + col = await KanbanViewColumn.insert( + { + ...param, + fk_view_id: view.id, + }, + ncMeta + ); + } + break; } return col; @@ -503,7 +516,11 @@ export default class View implements ViewType { static async getColumns( viewId: string, ncMeta = Noco.ncMeta - ): Promise> { + ): Promise< + Array< + GridViewColumn | FormViewColumn | GalleryViewColumn | KanbanViewColumn + > + > { let columns: Array = []; const view = await this.get(viewId, ncMeta); @@ -512,13 +529,15 @@ export default class View implements ViewType { case ViewTypes.GRID: columns = await GridViewColumn.list(viewId, ncMeta); break; - case ViewTypes.GALLERY: columns = await GalleryViewColumn.list(viewId, ncMeta); break; case ViewTypes.FORM: columns = await FormViewColumn.list(viewId, ncMeta); break; + case ViewTypes.KANBAN: + columns = await KanbanViewColumn.list(viewId, ncMeta); + break; } return columns; @@ -583,7 +602,9 @@ export default class View implements ViewType { show: boolean; }, ncMeta = Noco.ncMeta - ): Promise { + ): Promise< + GridViewColumn | FormViewColumn | GalleryViewColumn | KanbanViewColumn | any + > { const view = await this.get(viewId); const table = this.extractViewColumnsTableName(view); console.log(table);