Browse Source

fix(nocodb): include calendar range in views

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
a15a7b547c
  1. 21
      packages/nocodb/src/controllers/calendars.controller.spec.ts
  2. 8
      packages/nocodb/src/models/CalendarRange.ts
  3. 2
      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';
export default class CalendarRange implements CalendarRangeType {
id: string;
fk_from_column_id: string;
fk_to_column_id: string | null;
fk_view_id: string;
id?: string;
fk_from_column_id?: string;
fk_to_column_id?: string | null;
fk_view_id?: string;
constructor(data: Partial<CalendarRange>) {
Object.assign(this, data);

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

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

Loading…
Cancel
Save