From 3d10609101c564486568ac20dd7cfcc9801942d6 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 13 Mar 2023 16:55:24 +0800 Subject: [PATCH] refactor(nocodb): revise columnAdd params --- packages/nocodb/src/lib/controllers/viewColumn.ctl.ts | 6 +----- packages/nocodb/src/lib/services/viewColumn.svc.ts | 8 +++++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/nocodb/src/lib/controllers/viewColumn.ctl.ts b/packages/nocodb/src/lib/controllers/viewColumn.ctl.ts index 25716a4be1..8ce58377ab 100644 --- a/packages/nocodb/src/lib/controllers/viewColumn.ctl.ts +++ b/packages/nocodb/src/lib/controllers/viewColumn.ctl.ts @@ -16,11 +16,7 @@ export async function columnList(req: Request, res: Response) { export async function columnAdd(req: Request, res: Response) { const viewColumn = await viewColumnService.columnAdd({ viewId: req.params.viewId, - columnId: req.body.fk_column_id, - column: { - ...req.body, - view_id: req.params.viewId, - }, + column: req.body, }); res.json(viewColumn); } diff --git a/packages/nocodb/src/lib/services/viewColumn.svc.ts b/packages/nocodb/src/lib/services/viewColumn.svc.ts index 60a2a40cca..b5d78af9e2 100644 --- a/packages/nocodb/src/lib/services/viewColumn.svc.ts +++ b/packages/nocodb/src/lib/services/viewColumn.svc.ts @@ -8,7 +8,6 @@ export async function columnList(param: { viewId: string }) { } export async function columnAdd(param: { viewId: string; - columnId: string; column: ViewColumnReqType; }) { validatePayload( @@ -18,8 +17,11 @@ export async function columnAdd(param: { const viewColumn = await View.insertOrUpdateColumn( param.viewId, - param.columnId, - param.column + param.column.fk_column_id, + { + order: param.column.order, + show: param.column.show, + } ); T.emit('evt', { evt_type: 'viewColumn:inserted' });