Skip to content

Commit

Permalink
secure how we get sync parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Mar 13, 2024
1 parent 02efb17 commit ff6502c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 10 additions & 3 deletions server/src/logic/sync/presentation/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit ff6502c

Please sign in to comment.