Browse Source

refactor(nocodb): revise columnAdd params

pull/5269/head
Wing-Kam Wong 2 years ago
parent
commit
3d10609101
  1. 6
      packages/nocodb/src/lib/controllers/viewColumn.ctl.ts
  2. 8
      packages/nocodb/src/lib/services/viewColumn.svc.ts

6
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) { export async function columnAdd(req: Request, res: Response) {
const viewColumn = await viewColumnService.columnAdd({ const viewColumn = await viewColumnService.columnAdd({
viewId: req.params.viewId, viewId: req.params.viewId,
columnId: req.body.fk_column_id, column: req.body,
column: {
...req.body,
view_id: req.params.viewId,
},
}); });
res.json(viewColumn); res.json(viewColumn);
} }

8
packages/nocodb/src/lib/services/viewColumn.svc.ts

@ -8,7 +8,6 @@ export async function columnList(param: { viewId: string }) {
} }
export async function columnAdd(param: { export async function columnAdd(param: {
viewId: string; viewId: string;
columnId: string;
column: ViewColumnReqType; column: ViewColumnReqType;
}) { }) {
validatePayload( validatePayload(
@ -18,8 +17,11 @@ export async function columnAdd(param: {
const viewColumn = await View.insertOrUpdateColumn( const viewColumn = await View.insertOrUpdateColumn(
param.viewId, param.viewId,
param.columnId, param.column.fk_column_id,
param.column {
order: param.column.order,
show: param.column.show,
}
); );
T.emit('evt', { evt_type: 'viewColumn:inserted' }); T.emit('evt', { evt_type: 'viewColumn:inserted' });

Loading…
Cancel
Save