mirror of https://github.com/nocodb/nocodb
Pranav C
2 years ago
6 changed files with 84 additions and 26 deletions
@ -0,0 +1,15 @@
|
||||
import { GridColumnReqType } from 'nocodb-sdk'; |
||||
import GridViewColumn from '../models/GridViewColumn'; |
||||
import { Tele } from 'nc-help'; |
||||
|
||||
export async function columnList(param: { gridViewId: string }) { |
||||
return await GridViewColumn.list(param.gridViewId); |
||||
} |
||||
|
||||
export async function gridColumnUpdate(param: { |
||||
gridViewColumnId: string; |
||||
grid: GridColumnReqType; |
||||
}) { |
||||
Tele.emit('evt', { evt_type: 'gridViewColumn:updated' }); |
||||
return await GridViewColumn.update(param.gridViewColumnId, param.grid); |
||||
} |
@ -0,0 +1,39 @@
|
||||
import { Tele } from 'nc-help'; |
||||
import { View } from '../models' |
||||
|
||||
export async function columnList(param: { viewId: string }) { |
||||
return await View.getColumns(param.viewId); |
||||
} |
||||
export async function columnAdd(param: { |
||||
viewId: string; |
||||
columnId: string; |
||||
// todo: add proper type for grid column in swagger
|
||||
column: any; |
||||
}) { |
||||
const viewColumn = await View.insertOrUpdateColumn( |
||||
param.viewId, |
||||
param.columnId, |
||||
{ |
||||
...param.column, |
||||
view_id: param.viewId, |
||||
} |
||||
); |
||||
Tele.emit('evt', { evt_type: 'viewColumn:inserted' }); |
||||
|
||||
return viewColumn; |
||||
} |
||||
|
||||
export async function columnUpdate(param: { |
||||
viewId: string; |
||||
columnId: string; |
||||
// todo: add proper type for grid column in swagger
|
||||
column: any; |
||||
}) { |
||||
const result = await View.updateColumn( |
||||
param.viewId, |
||||
param.columnId, |
||||
param.column |
||||
); |
||||
Tele.emit('evt', { evt_type: 'viewColumn:updated' }); |
||||
return result; |
||||
} |
Loading…
Reference in new issue