|
|
@ -5,7 +5,15 @@ import GalleryViewColumn from '../models/GalleryViewColumn'; |
|
|
|
import KanbanViewColumn from '../models/KanbanViewColumn'; |
|
|
|
import KanbanViewColumn from '../models/KanbanViewColumn'; |
|
|
|
import MapViewColumn from '../models/MapViewColumn'; |
|
|
|
import MapViewColumn from '../models/MapViewColumn'; |
|
|
|
import FormViewColumn from '../models/FormViewColumn'; |
|
|
|
import FormViewColumn from '../models/FormViewColumn'; |
|
|
|
import type { ViewColumnReqType, ViewColumnUpdateReqType } from 'nocodb-sdk'; |
|
|
|
import type { |
|
|
|
|
|
|
|
CalendarColumnReqType, |
|
|
|
|
|
|
|
FormColumnReqType, |
|
|
|
|
|
|
|
GalleryColumnReqType, |
|
|
|
|
|
|
|
GridColumnReqType, |
|
|
|
|
|
|
|
KanbanColumnReqType, |
|
|
|
|
|
|
|
ViewColumnReqType, |
|
|
|
|
|
|
|
ViewColumnUpdateReqType, |
|
|
|
|
|
|
|
} from 'nocodb-sdk'; |
|
|
|
import type { NcRequest } from '~/interface/config'; |
|
|
|
import type { NcRequest } from '~/interface/config'; |
|
|
|
import { AppHooksService } from '~/services/app-hooks/app-hooks.service'; |
|
|
|
import { AppHooksService } from '~/services/app-hooks/app-hooks.service'; |
|
|
|
import { validatePayload } from '~/helpers'; |
|
|
|
import { validatePayload } from '~/helpers'; |
|
|
@ -75,8 +83,22 @@ export class ViewColumnsService { |
|
|
|
async columnsUpdate(param: { |
|
|
|
async columnsUpdate(param: { |
|
|
|
viewId: string; |
|
|
|
viewId: string; |
|
|
|
columns: |
|
|
|
columns: |
|
|
|
| GridColumnReqType | GalleryColumnReqType | KanbanColumnReqType | FormColumnReqType | CalendarColumnReqType[] |
|
|
|
| GridColumnReqType |
|
|
|
| Record<APIContext.VIEW_COLUMNS, Record<string, GridColumnReqType | GalleryColumnReqType | KanbanColumnReqType | FormColumnReqType | CalendarColumnReqType>>; |
|
|
|
| GalleryColumnReqType |
|
|
|
|
|
|
|
| KanbanColumnReqType |
|
|
|
|
|
|
|
| FormColumnReqType |
|
|
|
|
|
|
|
| CalendarColumnReqType[] |
|
|
|
|
|
|
|
| Record< |
|
|
|
|
|
|
|
APIContext.VIEW_COLUMNS, |
|
|
|
|
|
|
|
Record< |
|
|
|
|
|
|
|
string, |
|
|
|
|
|
|
|
| GridColumnReqType |
|
|
|
|
|
|
|
| GalleryColumnReqType |
|
|
|
|
|
|
|
| KanbanColumnReqType |
|
|
|
|
|
|
|
| FormColumnReqType |
|
|
|
|
|
|
|
| CalendarColumnReqType |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
>; |
|
|
|
req: any; |
|
|
|
req: any; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const { viewId } = param; |
|
|
|
const { viewId } = param; |
|
|
@ -118,9 +140,9 @@ export class ViewColumnsService { |
|
|
|
updateOrInsertOptions.push( |
|
|
|
updateOrInsertOptions.push( |
|
|
|
GridViewColumn.insert( |
|
|
|
GridViewColumn.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
...(column as GridColumnReqType), |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_column_id: columnId, |
|
|
|
fk_column_id: columnId, |
|
|
|
...column, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
), |
|
|
|
), |
|
|
@ -136,9 +158,9 @@ export class ViewColumnsService { |
|
|
|
updateOrInsertOptions.push( |
|
|
|
updateOrInsertOptions.push( |
|
|
|
GalleryViewColumn.insert( |
|
|
|
GalleryViewColumn.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
...(column as GalleryColumnReqType), |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_column_id: columnId, |
|
|
|
fk_column_id: columnId, |
|
|
|
...column, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
), |
|
|
|
), |
|
|
@ -154,9 +176,9 @@ export class ViewColumnsService { |
|
|
|
updateOrInsertOptions.push( |
|
|
|
updateOrInsertOptions.push( |
|
|
|
KanbanViewColumn.insert( |
|
|
|
KanbanViewColumn.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
...(column as KanbanColumnReqType), |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_column_id: columnId, |
|
|
|
fk_column_id: columnId, |
|
|
|
...column, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
), |
|
|
|
), |
|
|
@ -172,9 +194,9 @@ export class ViewColumnsService { |
|
|
|
updateOrInsertOptions.push( |
|
|
|
updateOrInsertOptions.push( |
|
|
|
MapViewColumn.insert( |
|
|
|
MapViewColumn.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
...(column as MapViewColumn), |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_column_id: columnId, |
|
|
|
fk_column_id: columnId, |
|
|
|
...column, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
), |
|
|
|
), |
|
|
@ -190,9 +212,9 @@ export class ViewColumnsService { |
|
|
|
updateOrInsertOptions.push( |
|
|
|
updateOrInsertOptions.push( |
|
|
|
FormViewColumn.insert( |
|
|
|
FormViewColumn.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
...(column as FormColumnReqType), |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_column_id: columnId, |
|
|
|
fk_column_id: columnId, |
|
|
|
...column, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
), |
|
|
|
), |
|
|
@ -208,9 +230,9 @@ export class ViewColumnsService { |
|
|
|
updateOrInsertOptions.push( |
|
|
|
updateOrInsertOptions.push( |
|
|
|
CalendarViewColumn.insert( |
|
|
|
CalendarViewColumn.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
...(column as CalendarColumnReqType), |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_view_id: viewId, |
|
|
|
fk_column_id: columnId, |
|
|
|
fk_column_id: columnId, |
|
|
|
...column, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
), |
|
|
|
), |
|
|
|