Skip to content

Commit

Permalink
add parentId in the migration scripts to please the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Dec 20, 2024
1 parent e984316 commit f9fc0ff
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ makeScript({}, async ({ execute }, logger) => {
dataSourceConfig,
folderId: makeSpaceInternalId(space.spaceId),
parents: [makeSpaceInternalId(space.spaceId)],
parentId: null,
title: space.name,
mimeType: "application/vnd.dust.confluence.space",
});
Expand Down
4 changes: 4 additions & 0 deletions connectors/migrations/20241216_backfill_zendesk_folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ makeScript({}, async ({ execute }, logger) => {
dataSourceConfig,
folderId: brandInternalId,
parents: [brandInternalId],
parentId: null,
title: brand.name,
mimeType: "application/vnd.dust.zendesk.brand",
});
Expand All @@ -45,6 +46,7 @@ makeScript({}, async ({ execute }, logger) => {
helpCenterNode.internalId,
helpCenterNode.parentInternalId,
],
parentId: helpCenterNode.parentInternalId,
title: helpCenterNode.title,
mimeType: "application/vnd.dust.zendesk.helpcenter",
});
Expand All @@ -54,6 +56,7 @@ makeScript({}, async ({ execute }, logger) => {
dataSourceConfig,
folderId: ticketsNode.internalId,
parents: [ticketsNode.internalId, ticketsNode.parentInternalId],
parentId: ticketsNode.parentInternalId,
title: ticketsNode.title,
mimeType: "application/vnd.dust.zendesk.tickets",
});
Expand Down Expand Up @@ -81,6 +84,7 @@ makeScript({}, async ({ execute }, logger) => {
dataSourceConfig: dataSourceConfigFromConnector(connector),
folderId: parents[0],
parents,
parentId: parents[1],
title: category.name,
mimeType: "application/vnd.dust.zendesk.category",
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ makeScript(
execute,
});
if (execute) {
const parents = getParents(folder);
const result = await upsertDataSourceFolder({
dataSourceConfig,
folderId: folder.internalId,
timestampMs: folder.updatedAt.getTime(),
parents: getParents(folder),
parents,
parentId: parents[1] || null,
title: folder.url,
mimeType: "application/vnd.dust.webcrawler.folder",
});
Expand Down
5 changes: 5 additions & 0 deletions connectors/migrations/20241219_backfill_github_folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ async function upsertFoldersForConnector(
dataSourceConfig,
folderId: repoInternalId,
parents: [repoInternalId],
parentId: null,
title: repoName,
mimeType: "application/vnd.dust.github.repository",
});
Expand All @@ -61,6 +62,7 @@ async function upsertFoldersForConnector(
dataSourceConfig,
folderId: issuesInternalId,
parents: [issuesInternalId, repoInternalId],
parentId: repoInternalId,
title: "Issues",
mimeType: "application/vnd.dust.github.issues",
});
Expand All @@ -76,6 +78,7 @@ async function upsertFoldersForConnector(
dataSourceConfig,
folderId: discussionsInternalId,
parents: [discussionsInternalId, repoInternalId],
parentId: repoInternalId,
title: "Discussions",
mimeType: "application/vnd.dust.github.discussions",
});
Expand All @@ -96,6 +99,7 @@ async function upsertFoldersForConnector(
folderId: codeRootInternalId,
title: "Code",
parents: [codeRootInternalId, repoInternalId],
parentId: repoInternalId,
mimeType: "application/vnd.dust.github.code.root",
});
logger.info(`Upserted code root folder ${codeRootInternalId}`);
Expand All @@ -121,6 +125,7 @@ async function upsertFoldersForConnector(
dataSourceConfig,
folderId: directory.internalId,
parents: [directory.internalId, ...dirParents],
parentId: dirParents[0] || null,
title: directory.dirName,
mimeType: "application/vnd.dust.github.code.directory",
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function createFolderNodes(execute: boolean) {
dataSourceConfig,
folderId: getTeamsInternalId(connector.id),
parents: [getTeamsInternalId(connector.id)],
parentId: null,
title: "Conversations",
mimeType: getDataSourceNodeMimeType("CONVERSATIONS_FOLDER"),
});
Expand All @@ -57,6 +58,7 @@ async function createFolderNodes(execute: boolean) {
dataSourceConfig,
folderId: teamInternalId,
parents: [teamInternalId, getTeamsInternalId(connector.id)],
parentId: getTeamsInternalId(connector.id),
title: team.name,
mimeType: getDataSourceNodeMimeType("TEAM"),
});
Expand Down Expand Up @@ -95,6 +97,7 @@ async function createFolderNodes(execute: boolean) {
dataSourceConfig,
folderId: helpCenterInternalId,
parents: [helpCenterInternalId],
parentId: null,
title: helpCenter.name,
mimeType: getDataSourceNodeMimeType("HELP_CENTER"),
});
Expand Down Expand Up @@ -128,6 +131,7 @@ async function createFolderNodes(execute: boolean) {
dataSourceConfig,
folderId: collectionInternalId,
parents: collectionParents,
parentId: collectionParents[1] || null,
title: collection.name,
mimeType: getDataSourceNodeMimeType("COLLECTION"),
});
Expand Down

0 comments on commit f9fc0ff

Please sign in to comment.