From 7798473150bf553efe7304c39800e2802c1ff9f7 Mon Sep 17 00:00:00 2001 From: Eric BREHAULT Date: Thu, 25 Apr 2024 17:54:22 +0200 Subject: [PATCH] lint --- server/CHANGELOG.md | 2 +- .../connectors/gdrive.connector.ts | 1 + server/src/logic/sync/domain/sync.entity.ts | 17 ++++++++--------- .../use-cases/sync-all-folders-data.use-case.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index 4470ffd..416692b 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -1,6 +1,6 @@ # 1.3.0 (2024-04-25) -- Support deletion syncing +- Support deletion syncing (when a file is deleted in a source, the corresponding resource is deleted in the Nuclia Knowledge Box) # 1.2.21 (2024-04-18) diff --git a/server/src/logic/connector/infrastructure/connectors/gdrive.connector.ts b/server/src/logic/connector/infrastructure/connectors/gdrive.connector.ts index 2f4aac5..8de31d8 100644 --- a/server/src/logic/connector/infrastructure/connectors/gdrive.connector.ts +++ b/server/src/logic/connector/infrastructure/connectors/gdrive.connector.ts @@ -275,6 +275,7 @@ export class GDriveImpl extends OAuthBaseConnector implements IConnector { } else { const nextPage = res['nextPageToken']; const items = (res.files || []) + // eslint-disable-next-line @typescript-eslint/no-explicit-any .filter((item: any) => !item.trashed) .map((item: unknown) => this.mapToSyncItem(item)); const results = { diff --git a/server/src/logic/sync/domain/sync.entity.ts b/server/src/logic/sync/domain/sync.entity.ts index 4353337..e9f4f49 100644 --- a/server/src/logic/sync/domain/sync.entity.ts +++ b/server/src/logic/sync/domain/sync.entity.ts @@ -155,15 +155,14 @@ export class SyncEntity { const foldersToSyncUpdated: SyncItem[] = (this.foldersToSync ?? []).filter( (folder) => folder.status === FileStatus.UPLOADED, ); - const getFilesFoldersUpdated = - foldersToSyncUpdated.length > 0 - ? this.sourceConnector!.getLastModified( - this.lastSyncGMT || '2000-01-01T00:00:00.000Z', - foldersToSyncUpdated, - existings, - ) - : of({ items: [] } as SearchResults); - + let getFilesFoldersUpdated = of({ items: [] } as SearchResults); + if (foldersToSyncUpdated.length > 0) { + getFilesFoldersUpdated = this.sourceConnector!.getLastModified( + this.lastSyncGMT || '2000-01-01T00:00:00.000Z', + foldersToSyncUpdated, + existings, + ); + } const getFilesFolderPending = foldersToSyncPending.length > 0 ? this.sourceConnector!.getFilesFromFolders(foldersToSyncPending) diff --git a/server/src/logic/sync/domain/use-cases/sync-all-folders-data.use-case.ts b/server/src/logic/sync/domain/use-cases/sync-all-folders-data.use-case.ts index b8642d5..ad05af0 100644 --- a/server/src/logic/sync/domain/use-cases/sync-all-folders-data.use-case.ts +++ b/server/src/logic/sync/domain/use-cases/sync-all-folders-data.use-case.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { concatMap, delay, filter, from, lastValueFrom, map, of, switchMap, tap, toArray } from 'rxjs'; +import { concatMap, delay, filter, from, lastValueFrom, map, of, switchMap, toArray } from 'rxjs'; import { EVENTS } from '../../../../events/events'; import { eventEmitter } from '../../../../server';