Browse Source

fix: missing imports

pull/8281/head
Pranav C 3 months ago
parent
commit
40f2de51b5
  1. 26
      packages/nocodb/src/controllers/view-columns.controller.ts
  2. 40
      packages/nocodb/src/services/view-columns.service.ts

26
packages/nocodb/src/controllers/view-columns.controller.ts

@ -9,14 +9,14 @@ import {
Req, Req,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { import { APIContext, ViewColumnReqType } from 'nocodb-sdk';
APIContext, CalendarColumnReqType, import type {
CalendarColumnReqType,
FormColumnReqType, FormColumnReqType,
GalleryColumnReqType, GalleryColumnReqType,
GridColumnReqType, GridColumnReqType,
KanbanColumnReqType, KanbanColumnReqType,
ViewColumnReqType, } from 'nocodb-sdk';
} from 'nocodb-sdk'
import { GlobalGuard } from '~/guards/global/global.guard'; import { GlobalGuard } from '~/guards/global/global.guard';
import { PagedResponseImpl } from '~/helpers/PagedResponse'; import { PagedResponseImpl } from '~/helpers/PagedResponse';
import { ViewColumnsService } from '~/services/view-columns.service'; import { ViewColumnsService } from '~/services/view-columns.service';
@ -88,8 +88,22 @@ export class ViewColumnsController {
@Param('viewId') viewId: string, @Param('viewId') viewId: string,
@Body() @Body()
body: body:
| 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
>
>,
) { ) {
return new PagedResponseImpl( return new PagedResponseImpl(
await this.viewColumnsService.columnsUpdate({ await this.viewColumnsService.columnsUpdate({

40
packages/nocodb/src/services/view-columns.service.ts

@ -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,
), ),

Loading…
Cancel
Save