Skip to content

Commit

Permalink
updates parents for folders for microsoft
Browse files Browse the repository at this point in the history
  • Loading branch information
philipperolet committed Dec 22, 2024
1 parent 2115e0d commit 3c57236
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions connectors/src/connectors/microsoft/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ export async function syncDeltaForRootNodesInDrive({
});

if (isMoved) {
await updateDescendantsParentsInQdrant({
await updateDescendantsParentsInCore({
dataSourceConfig,
folder: resource,
startSyncTs,
Expand Down Expand Up @@ -844,7 +844,7 @@ async function isFolderMovedInSameRoot({
return oldParentId !== newParentId;
}

async function updateDescendantsParentsInQdrant({
async function updateDescendantsParentsInCore({
folder,
dataSourceConfig,
startSyncTs,
Expand All @@ -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 }),
Expand All @@ -864,7 +877,7 @@ async function updateDescendantsParentsInQdrant({
}
);
for (const childFolder of folders) {
await updateDescendantsParentsInQdrant({
await updateDescendantsParentsInCore({
dataSourceConfig,
folder: childFolder,
startSyncTs,
Expand Down

0 comments on commit 3c57236

Please sign in to comment.