From 8bbe8f5297e6496d5e12122bcee3c1569a64d13c Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 18 Sep 2024 08:31:08 +0000 Subject: [PATCH] refactor: exclude unnecessary data from response --- packages/nocodb/src/controllers/sources.controller.ts | 9 ++++++--- packages/nocodb/src/services/sources.service.ts | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/controllers/sources.controller.ts b/packages/nocodb/src/controllers/sources.controller.ts index e2532a3b5f..5a4bd897f9 100644 --- a/packages/nocodb/src/controllers/sources.controller.ts +++ b/packages/nocodb/src/controllers/sources.controller.ts @@ -37,6 +37,7 @@ export class SourcesController { if (source.isMeta()) { source.config = undefined; } + source.integration_config = undefined; return source; } @@ -60,6 +61,9 @@ export class SourcesController { req, }); + source.config = undefined; + source.integration_config = undefined; + return source; } @@ -77,9 +81,8 @@ export class SourcesController { }); for (const source of sources) { - if (source.isMeta()) { - source.config = undefined; - } + source.config = undefined; + source.integration_config = undefined; } return new PagedResponseImpl(sources, { diff --git a/packages/nocodb/src/services/sources.service.ts b/packages/nocodb/src/services/sources.service.ts index f3e833bb25..f2551509e7 100644 --- a/packages/nocodb/src/services/sources.service.ts +++ b/packages/nocodb/src/services/sources.service.ts @@ -21,6 +21,10 @@ export class SourcesService { async baseGetWithConfig(context: NcContext, param: { sourceId: any }) { const source = await Source.get(context, param.sourceId); + if (!source) { + NcError.sourceNotFound(param.sourceId); + } + source.config = await source.getSourceConfig(); return source;