Browse Source

fix(nocodb): replace Calendar to CalendarView

pull/7611/head
DarkPhoenix2704 9 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 {Injectable, Optional} from '@nestjs/common';
import { customAlphabet } from 'nanoid'; import {customAlphabet} from 'nanoid';
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc'; import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone'; import timezone from 'dayjs/plugin/timezone';
import type { Knex } from 'knex';
import type * as knex from 'knex'; import type * as knex from 'knex';
import type {Knex} from 'knex';
import XcMigrationSource from '~/meta/migrations/XcMigrationSource'; import XcMigrationSource from '~/meta/migrations/XcMigrationSource';
import XcMigrationSourcev2 from '~/meta/migrations/XcMigrationSourcev2'; import XcMigrationSourcev2 from '~/meta/migrations/XcMigrationSourcev2';
import { XKnex } from '~/db/CustomKnex'; import {XKnex} from '~/db/CustomKnex';
import { NcConfig } from '~/utils/nc-config'; import {NcConfig} from '~/utils/nc-config';
import { MetaTable } from '~/utils/globals'; import {MetaTable} from '~/utils/globals';
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
@ -215,6 +216,15 @@ export class MetaService {
case MetaTable.KANBAN_VIEW_COLUMNS: case MetaTable.KANBAN_VIEW_COLUMNS:
prefix = 'kvc'; prefix = 'kvc';
break; 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: case MetaTable.USERS:
prefix = 'us'; prefix = 'us';
break; break;

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

@ -33,7 +33,7 @@ export default class CalendarView implements CalendarType {
CacheGetType.TYPE_OBJECT, CacheGetType.TYPE_OBJECT,
)); ));
if (!view) { if (!view) {
view = await ncMeta.metaGet2(null, null, MetaTable.CALENDAR, { view = await ncMeta.metaGet2(null, null, MetaTable.CALENDAR_VIEW, {
fk_view_id: viewId, fk_view_id: viewId,
}); });
await NocoCache.set(`${CacheScope.CALENDAR_VIEW}:${viewId}`, view); await NocoCache.set(`${CacheScope.CALENDAR_VIEW}:${viewId}`, view);
@ -57,7 +57,7 @@ export default class CalendarView implements CalendarType {
insertObj.source_id = viewRef.source_id; 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); return this.get(view.fk_view_id, ncMeta);
} }
@ -96,7 +96,7 @@ export default class CalendarView implements CalendarType {
}*/ }*/
// update meta // 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, 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', FORM_VIEW_COLUMNS = 'nc_form_view_columns_v2',
GALLERY_VIEW = 'nc_gallery_view_v2', GALLERY_VIEW = 'nc_gallery_view_v2',
GALLERY_VIEW_COLUMNS = 'nc_gallery_view_columns_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_COLUMNS = 'nc_calendar_view_columns_v2',
CALENDAR_VIEW_RANGE = 'nc_calendar_view_range_v2', CALENDAR_VIEW_RANGE = 'nc_calendar_view_range_v2',
GRID_VIEW = 'nc_grid_view_v2', GRID_VIEW = 'nc_grid_view_v2',
@ -67,7 +67,7 @@ export const orderedMetaTables = [
MetaTable.MAP_VIEW_COLUMNS, MetaTable.MAP_VIEW_COLUMNS,
MetaTable.KANBAN_VIEW_COLUMNS, MetaTable.KANBAN_VIEW_COLUMNS,
MetaTable.KANBAN_VIEW, MetaTable.KANBAN_VIEW,
MetaTable.CALENDAR, MetaTable.CALENDAR_VIEW,
MetaTable.CALENDAR_VIEW_COLUMNS, MetaTable.CALENDAR_VIEW_COLUMNS,
MetaTable.CALENDAR_VIEW_RANGE, MetaTable.CALENDAR_VIEW_RANGE,
MetaTable.GRID_VIEW_COLUMNS, MetaTable.GRID_VIEW_COLUMNS,

Loading…
Cancel
Save