Browse Source

fix(nocodb): include calendar range in views

pull/7611/head
DarkPhoenix2704 10 months ago
parent
commit
a15a7b547c
  1. 21
      packages/nocodb/src/controllers/calendars.controller.spec.ts
  2. 8
      packages/nocodb/src/models/CalendarRange.ts
  3. 4
      packages/nocodb/src/models/View.ts

21
packages/nocodb/src/controllers/calendars.controller.spec.ts

@ -0,0 +1,21 @@
import { Test } from '@nestjs/testing';
import { CalendarsService } from '../services/calendars.service';
import { CalendarsController } from './calendars.controller';
import type { TestingModule } from '@nestjs/testing';
describe('CalendarsController', () => {
let controller: CalendarsController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [CalendarsController],
providers: [CalendarsService],
}).compile();
controller = module.get<CalendarsController>(CalendarsController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

8
packages/nocodb/src/models/CalendarRange.ts

@ -5,10 +5,10 @@ import {extractProps} from '~/helpers/extractProps';
import {CacheGetType, CacheScope, MetaTable} from '~/utils/globals'; import {CacheGetType, CacheScope, MetaTable} from '~/utils/globals';
export default class CalendarRange implements CalendarRangeType { export default class CalendarRange implements CalendarRangeType {
id: string; id?: string;
fk_from_column_id: string; fk_from_column_id?: string;
fk_to_column_id: string | null; fk_to_column_id?: string | null;
fk_view_id: string; fk_view_id?: string;
constructor(data: Partial<CalendarRange>) { constructor(data: Partial<CalendarRange>) {
Object.assign(this, data); Object.assign(this, data);

4
packages/nocodb/src/models/View.ts

@ -63,6 +63,7 @@ export default class View implements ViewType {
| MapViewColumn | MapViewColumn
| CalendarViewColumn | CalendarViewColumn
>; >;
calendar_range?: Array<CalendarRange>;
sorts: Sort[]; sorts: Sort[];
filter: Filter; filter: Filter;
@ -134,6 +135,7 @@ export default class View implements ViewType {
break; break;
case ViewTypes.CALENDAR: case ViewTypes.CALENDAR:
this.view = await CalendarView.get(this.id, ncMeta); this.view = await CalendarView.get(this.id, ncMeta);
this.calendar_range = (await CalendarRange.read(this.id, ncMeta)).ranges;
break; break;
} }
return this.view; return this.view;
@ -280,7 +282,7 @@ export default class View implements ViewType {
Partial<FormView | GridView | GalleryView | KanbanView | MapView | CalendarView> & { Partial<FormView | GridView | GalleryView | KanbanView | MapView | CalendarView> & {
copy_from_id?: string; copy_from_id?: string;
fk_grp_col_id?: string; fk_grp_col_id?: string;
calendar_range?: Partial<CalendarRange>[]; calendar_range?: Partial<CalendarRange>[];
}, },
ncMeta = Noco.ncMeta, ncMeta = Noco.ncMeta,
) { ) {

Loading…
Cancel
Save