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) {
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);
}

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: {
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' });

Loading…
Cancel
Save