From 3c572360f9b23462414de33bc69fdf2335bcfdde Mon Sep 17 00:00:00 2001 From: filou Date: Thu, 19 Dec 2024 22:54:51 +0100 Subject: [PATCH] updates parents for folders for microsoft --- .../microsoft/temporal/activities.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/connectors/src/connectors/microsoft/temporal/activities.ts b/connectors/src/connectors/microsoft/temporal/activities.ts index d95c7b802624f..2557cae78110c 100644 --- a/connectors/src/connectors/microsoft/temporal/activities.ts +++ b/connectors/src/connectors/microsoft/temporal/activities.ts @@ -670,7 +670,7 @@ export async function syncDeltaForRootNodesInDrive({ }); if (isMoved) { - await updateDescendantsParentsInQdrant({ + await updateDescendantsParentsInCore({ dataSourceConfig, folder: resource, startSyncTs, @@ -844,7 +844,7 @@ async function isFolderMovedInSameRoot({ return oldParentId !== newParentId; } -async function updateDescendantsParentsInQdrant({ +async function updateDescendantsParentsInCore({ folder, dataSourceConfig, startSyncTs, @@ -856,6 +856,19 @@ async function updateDescendantsParentsInQdrant({ const children = await folder.fetchChildren(); const files = children.filter((child) => child.nodeType === "file"); const folders = children.filter((child) => child.nodeType === "folder"); + + await upsertDataSourceFolder({ + dataSourceConfig, + folderId: folder.internalId, + parents: await getParents({ + connectorId: folder.connectorId, + internalId: folder.internalId, + startSyncTs, + }), + title: folder.name ?? "", + mimeType: "application/vnd.dust.microsoft.folder", + }); + await concurrentExecutor( files, async (file) => updateParentsField({ file, dataSourceConfig, startSyncTs }), @@ -864,7 +877,7 @@ async function updateDescendantsParentsInQdrant({ } ); for (const childFolder of folders) { - await updateDescendantsParentsInQdrant({ + await updateDescendantsParentsInCore({ dataSourceConfig, folder: childFolder, startSyncTs,