Browse Source

fix(nc-gui): updated job & migration

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
30835cbe53
  1. 2
      packages/nocodb/src/meta/migrations/v2/nc_041_calendar_view.ts
  2. 30
      packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts

2
packages/nocodb/src/meta/migrations/v2/nc_041_calendar_view.ts

@ -49,7 +49,7 @@ const up = async (knex: Knex) => {
table.string('fk_to_column_id', 20); table.string('fk_to_column_id', 20);
table.string('label', 20); table.string('label', 40);
table.string('fk_from_column_id', 20); table.string('fk_from_column_id', 20);

30
packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts

@ -1,13 +1,18 @@
import { UITypes, ViewTypes } from 'nocodb-sdk'; import { isLinksOrLTAR, isVirtualCol, UITypes, ViewTypes } from 'nocodb-sdk';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import papaparse from 'papaparse'; import papaparse from 'papaparse';
import debug from 'debug'; import debug from 'debug';
import { isLinksOrLTAR, isVirtualCol } from 'nocodb-sdk';
import { elapsedTime, initTime } from '../../helpers'; import { elapsedTime, initTime } from '../../helpers';
import type { Readable } from 'stream';
import type { UserType, ViewCreateReqType } from 'nocodb-sdk'; import type { UserType, ViewCreateReqType } from 'nocodb-sdk';
import type { LinkToAnotherRecordColumn, User, View } from '~/models'; import type { Readable } from 'stream';
import type {
CalendarView,
LinkToAnotherRecordColumn,
User,
View,
} from '~/models';
import type { NcRequest } from '~/interface/config'; import type { NcRequest } from '~/interface/config';
import { Base, Column, Model, Source } from '~/models';
import { import {
findWithIdentifier, findWithIdentifier,
generateUniqueName, generateUniqueName,
@ -18,7 +23,6 @@ import {
withoutNull, withoutNull,
} from '~/helpers/exportImportHelpers'; } from '~/helpers/exportImportHelpers';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import { Base, Column, Model, Source } from '~/models';
import { TablesService } from '~/services/tables.service'; import { TablesService } from '~/services/tables.service';
import { ColumnsService } from '~/services/columns.service'; import { ColumnsService } from '~/services/columns.service';
import { FiltersService } from '~/services/filters.service'; import { FiltersService } from '~/services/filters.service';
@ -1218,22 +1222,20 @@ export class ImportService {
return fview; return fview;
} }
case ViewTypes.CALENDAR: { case ViewTypes.CALENDAR: {
const cview = await this.calendarsService.calendarViewCreate({ return await this.calendarsService.calendarViewCreate({
tableId: md.id, tableId: md.id,
calendar: { calendar: {
...vw, ...vw,
calendar_range: (vw.view as any).calendar_range calendar_range: (vw.view as CalendarView).calendar_range.map(
? (vw.view as any).calendar_range.map((a) => ({ (a) => ({
fk_from_column_id: idMap.get(a.fk_from_column_id as string), fk_from_column_id: idMap.get(a.fk_from_column_id),
fk_to_column_id: idMap.get(a.fk_to_column_id as string), fk_to_column_id: idMap.get(a.fk_to_column_id),
})) }),
: null, ),
} as ViewCreateReqType, } as ViewCreateReqType,
user, user,
req, req,
}); });
return cview;
} }
case ViewTypes.GALLERY: { case ViewTypes.GALLERY: {
const glview = await this.galleriesService.galleryViewCreate({ const glview = await this.galleriesService.galleryViewCreate({

Loading…
Cancel
Save