Browse Source

fix(nocodb): handle error data service

pull/7687/head
DarkPhoenix2704 10 months ago
parent
commit
24f471399b
  1. 6
      packages/nocodb/src/services/datas.service.ts
  2. 2
      packages/nocodb/src/services/public-datas.service.ts

6
packages/nocodb/src/services/datas.service.ts

@ -221,9 +221,9 @@ export class DatasService {
if (view.type !== ViewTypes.CALENDAR)
NcError.badRequest('View is not a calendar view');
const { ranges } = await CalendarRange.read(view.id);
const calendarRange = await CalendarRange.read(view.id);
if (!ranges.length) NcError.badRequest('No ranges found');
if (!calendarRange?.ranges?.length) NcError.badRequest('No ranges found');
const model = await Model.getByIdOrName({
id: view.fk_model_id,
@ -239,7 +239,7 @@ export class DatasService {
const dates: Array<string> = [];
ranges.forEach((range: any) => {
calendarRange.ranges.forEach((range: any) => {
data.list.forEach((date) => {
const from =
date[

2
packages/nocodb/src/services/public-datas.service.ts

@ -117,7 +117,7 @@ export class PublicDatasService {
const calendarRange = await CalendarRange.read(view.id);
if (!calendarRange || !calendarRange.ranges.length)
if (!calendarRange?.ranges?.length)
NcError.notFound('Calendar ranges are required in a calendar view');
const model = await Model.getByIdOrName({

Loading…
Cancel
Save