diff --git a/package.json b/package.json index d7c1e62..7554b5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclia-sync-agent-app", - "version": "1.1.0", + "version": "1.2.0", "description": "\"This is a Nuclia Sync Agent App\"", "main": "build/index.js", "scripts": { diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index dfd4231..77e4cc1 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.2.0 (2024-03-13) + +- Secure endpoints by validating the dashboard user token + # 1.1.0 (2024-03-11) - Support filtering options diff --git a/server/src/logic/sync/presentation/routes.ts b/server/src/logic/sync/presentation/routes.ts index 06a1fbb..c9dff4e 100644 --- a/server/src/logic/sync/presentation/routes.ts +++ b/server/src/logic/sync/presentation/routes.ts @@ -44,10 +44,17 @@ export class SyncFileSystemRoutes { next(); }); - router.get('/', async (_req, res) => { + router.get('/kb/:kb', async (_req, res) => { try { - const data = await new GetAllSync(syncRepository).execute(); - res.status(200).send(data); + const allSyncs = await new GetAllSync(syncRepository).execute(); + const kbSyncs = Object.values(allSyncs) + .filter((sync) => sync.kb.knowledgeBox === _req.params.kb) + .map((sync) => ({ + id: sync.id, + title: sync.title, + connector: sync.connector.name, + })); + res.status(200).send(kbSyncs); } catch (error) { this.handleError(res, error); }