Skip to content

Commit

Permalink
Fix metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Apr 29, 2024
1 parent 26a6035 commit a379909
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 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.3.0",
"version": "1.3.1",
"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.3.1 (2024-04-29)

- Fix metadata for files

# 1.3.0 (2024-04-25)

- Support deletion syncing (when a file is deleted in a source, the corresponding resource is deleted in the Nuclia Knowledge Box)
Expand Down
11 changes: 2 additions & 9 deletions server/src/logic/sync/domain/nuclia-cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,12 @@ export class NucliaCloud {
const slug = sha256(originalId);
const text = data.text;
const buffer = data.buffer;
const resourceData: Partial<ICreateResource> = { title: filename };
data = this.setMetadata(data, data.metadata);
const resourceData: Partial<ICreateResource> = { title: filename, ...this.setMetadata(data, data.metadata) };
if (buffer || text) {
return this.getKb().pipe(
switchMap((kb) =>
kb.getResourceBySlug(slug, [], []).pipe(
switchMap((resource) => {
if (data.metadata?.labels) {
return resource.modify(resourceData).pipe(map(() => resource));
} else {
return of(resource);
}
}),
switchMap((resource) => resource.modify(resourceData).pipe(map(() => resource))),
catchError((error) => {
if (error.status === 404) {
resourceData.slug = slug;
Expand Down

0 comments on commit a379909

Please sign in to comment.