Browse Source

fix(nocodb): replace Calendar to CalendarView

pull/7611/head
DarkPhoenix2704 7 months ago
parent
commit
de5e2bd41b
  1. 22
      packages/nocodb/src/meta/meta.service.ts
  2. 6
      packages/nocodb/src/models/CalendarView.ts
  3. 4
      packages/nocodb/src/utils/globals.ts

22
packages/nocodb/src/meta/meta.service.ts

@ -1,16 +1,17 @@
import { Injectable, Optional } from '@nestjs/common';
import { customAlphabet } from 'nanoid';
import {Injectable, Optional} from '@nestjs/common';
import {customAlphabet} from 'nanoid';
import CryptoJS from 'crypto-js';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import type { Knex } from 'knex';
import type * as knex from 'knex';
import type {Knex} from 'knex';
import XcMigrationSource from '~/meta/migrations/XcMigrationSource';
import XcMigrationSourcev2 from '~/meta/migrations/XcMigrationSourcev2';
import { XKnex } from '~/db/CustomKnex';
import { NcConfig } from '~/utils/nc-config';
import { MetaTable } from '~/utils/globals';
import {XKnex} from '~/db/CustomKnex';
import {NcConfig} from '~/utils/nc-config';
import {MetaTable} from '~/utils/globals';
dayjs.extend(utc);
dayjs.extend(timezone);
@ -215,6 +216,15 @@ export class MetaService {
case MetaTable.KANBAN_VIEW_COLUMNS:
prefix = 'kvc';
break;
case MetaTable.CALENDAR_VIEW:
prefix = 'cv';
break;
case MetaTable.CALENDAR_VIEW_COLUMNS:
prefix = 'cvc';
break;
case MetaTable.CALENDAR_VIEW_RANGE:
prefix = 'cvr';
break;
case MetaTable.USERS:
prefix = 'us';
break;

6
packages/nocodb/src/models/CalendarView.ts

@ -33,7 +33,7 @@ export default class CalendarView implements CalendarType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(null, null, MetaTable.CALENDAR, {
view = await ncMeta.metaGet2(null, null, MetaTable.CALENDAR_VIEW, {
fk_view_id: viewId,
});
await NocoCache.set(`${CacheScope.CALENDAR_VIEW}:${viewId}`, view);
@ -57,7 +57,7 @@ export default class CalendarView implements CalendarType {
insertObj.source_id = viewRef.source_id;
}
await ncMeta.metaInsert2(null, null, MetaTable.CALENDAR, insertObj, true);
await ncMeta.metaInsert2(null, null, MetaTable.CALENDAR_VIEW, insertObj, true);
return this.get(view.fk_view_id, ncMeta);
}
@ -96,7 +96,7 @@ export default class CalendarView implements CalendarType {
}*/
// update meta
return await ncMeta.metaUpdate(null, null, MetaTable.CALENDAR, updateObj, {
return await ncMeta.metaUpdate(null, null, MetaTable.CALENDAR_VIEW, updateObj, {
fk_view_id: calendarId,
});
}

4
packages/nocodb/src/utils/globals.ts

@ -21,7 +21,7 @@ export enum MetaTable {
FORM_VIEW_COLUMNS = 'nc_form_view_columns_v2',
GALLERY_VIEW = 'nc_gallery_view_v2',
GALLERY_VIEW_COLUMNS = 'nc_gallery_view_columns_v2',
CALENDAR = 'nc_calendar_view_v2',
CALENDAR_VIEW = 'nc_calendar_view_v2',
CALENDAR_VIEW_COLUMNS = 'nc_calendar_view_columns_v2',
CALENDAR_VIEW_RANGE = 'nc_calendar_view_range_v2',
GRID_VIEW = 'nc_grid_view_v2',
@ -67,7 +67,7 @@ export const orderedMetaTables = [
MetaTable.MAP_VIEW_COLUMNS,
MetaTable.KANBAN_VIEW_COLUMNS,
MetaTable.KANBAN_VIEW,
MetaTable.CALENDAR,
MetaTable.CALENDAR_VIEW,
MetaTable.CALENDAR_VIEW_COLUMNS,
MetaTable.CALENDAR_VIEW_RANGE,
MetaTable.GRID_VIEW_COLUMNS,

Loading…
Cancel
Save