From 40f2de51b57a2a773510799c276fbb6984007339 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 16 Apr 2024 07:14:19 +0000 Subject: [PATCH] fix: missing imports --- .../controllers/view-columns.controller.ts | 26 +++++++++--- .../src/services/view-columns.service.ts | 40 ++++++++++++++----- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/packages/nocodb/src/controllers/view-columns.controller.ts b/packages/nocodb/src/controllers/view-columns.controller.ts index cf4ec565ff..f6d939f274 100644 --- a/packages/nocodb/src/controllers/view-columns.controller.ts +++ b/packages/nocodb/src/controllers/view-columns.controller.ts @@ -9,14 +9,14 @@ import { Req, UseGuards, } from '@nestjs/common'; -import { - APIContext, CalendarColumnReqType, +import { APIContext, ViewColumnReqType } from 'nocodb-sdk'; +import type { + CalendarColumnReqType, FormColumnReqType, GalleryColumnReqType, GridColumnReqType, KanbanColumnReqType, - ViewColumnReqType, -} from 'nocodb-sdk' +} from 'nocodb-sdk'; import { GlobalGuard } from '~/guards/global/global.guard'; import { PagedResponseImpl } from '~/helpers/PagedResponse'; import { ViewColumnsService } from '~/services/view-columns.service'; @@ -88,8 +88,22 @@ export class ViewColumnsController { @Param('viewId') viewId: string, @Body() body: - | GridColumnReqType | GalleryColumnReqType | KanbanColumnReqType | FormColumnReqType | CalendarColumnReqType[] - | Record>, + | GridColumnReqType + | GalleryColumnReqType + | KanbanColumnReqType + | FormColumnReqType + | CalendarColumnReqType[] + | Record< + APIContext.VIEW_COLUMNS, + Record< + string, + | GridColumnReqType + | GalleryColumnReqType + | KanbanColumnReqType + | FormColumnReqType + | CalendarColumnReqType + > + >, ) { return new PagedResponseImpl( await this.viewColumnsService.columnsUpdate({ diff --git a/packages/nocodb/src/services/view-columns.service.ts b/packages/nocodb/src/services/view-columns.service.ts index 69835e7fe6..3ff20c2f8e 100644 --- a/packages/nocodb/src/services/view-columns.service.ts +++ b/packages/nocodb/src/services/view-columns.service.ts @@ -5,7 +5,15 @@ import GalleryViewColumn from '../models/GalleryViewColumn'; import KanbanViewColumn from '../models/KanbanViewColumn'; import MapViewColumn from '../models/MapViewColumn'; 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 { AppHooksService } from '~/services/app-hooks/app-hooks.service'; import { validatePayload } from '~/helpers'; @@ -75,8 +83,22 @@ export class ViewColumnsService { async columnsUpdate(param: { viewId: string; columns: - | GridColumnReqType | GalleryColumnReqType | KanbanColumnReqType | FormColumnReqType | CalendarColumnReqType[] - | Record>; + | GridColumnReqType + | GalleryColumnReqType + | KanbanColumnReqType + | FormColumnReqType + | CalendarColumnReqType[] + | Record< + APIContext.VIEW_COLUMNS, + Record< + string, + | GridColumnReqType + | GalleryColumnReqType + | KanbanColumnReqType + | FormColumnReqType + | CalendarColumnReqType + > + >; req: any; }) { const { viewId } = param; @@ -118,9 +140,9 @@ export class ViewColumnsService { updateOrInsertOptions.push( GridViewColumn.insert( { + ...(column as GridColumnReqType), fk_view_id: viewId, fk_column_id: columnId, - ...column, }, ncMeta, ), @@ -136,9 +158,9 @@ export class ViewColumnsService { updateOrInsertOptions.push( GalleryViewColumn.insert( { + ...(column as GalleryColumnReqType), fk_view_id: viewId, fk_column_id: columnId, - ...column, }, ncMeta, ), @@ -154,9 +176,9 @@ export class ViewColumnsService { updateOrInsertOptions.push( KanbanViewColumn.insert( { + ...(column as KanbanColumnReqType), fk_view_id: viewId, fk_column_id: columnId, - ...column, }, ncMeta, ), @@ -172,9 +194,9 @@ export class ViewColumnsService { updateOrInsertOptions.push( MapViewColumn.insert( { + ...(column as MapViewColumn), fk_view_id: viewId, fk_column_id: columnId, - ...column, }, ncMeta, ), @@ -190,9 +212,9 @@ export class ViewColumnsService { updateOrInsertOptions.push( FormViewColumn.insert( { + ...(column as FormColumnReqType), fk_view_id: viewId, fk_column_id: columnId, - ...column, }, ncMeta, ), @@ -208,9 +230,9 @@ export class ViewColumnsService { updateOrInsertOptions.push( CalendarViewColumn.insert( { + ...(column as CalendarColumnReqType), fk_view_id: viewId, fk_column_id: columnId, - ...column, }, ncMeta, ),