From 117c73a8a114333b91533840fda5efedcad9b92e Mon Sep 17 00:00:00 2001 From: Katalina Okano Date: Sun, 21 Mar 2021 22:10:27 -0400 Subject: [PATCH] fix(api): sync from legacy used wrong type of data --- packages/api/utils/import-from-legacy.ts | 14 ++++++++------ packages/api/worker.config.js | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/api/utils/import-from-legacy.ts b/packages/api/utils/import-from-legacy.ts index 5c559ab..31b0246 100644 --- a/packages/api/utils/import-from-legacy.ts +++ b/packages/api/utils/import-from-legacy.ts @@ -44,11 +44,13 @@ export const transformLegacyGuild = (guild: LegacyGuildData): GuildData => { id: guild.id, message: guild.message, features: Features.LegacyGuild, - categories: sortBy(guild.categories, 'position').map((category, idx) => ({ - ...category, - id: KSUID.randomSync().string, - position: idx, // Reset positions by index. May have side-effects but oh well. - type: category.type === 'multi' ? CategoryType.Multi : CategoryType.Single, - })), + categories: sortBy(Object.values(guild.categories), 'position').map( + (category, idx) => ({ + ...category, + id: KSUID.randomSync().string, + position: idx, // Reset positions by index. May have side-effects but oh well. + type: category.type === 'multi' ? CategoryType.Multi : CategoryType.Single, + }) + ), }; }; diff --git a/packages/api/worker.config.js b/packages/api/worker.config.js index 3cb26d9..b73f304 100644 --- a/packages/api/worker.config.js +++ b/packages/api/worker.config.js @@ -7,6 +7,7 @@ module.exports = { 'BOT_CLIENT_ID', 'BOT_CLIENT_SECRET', 'BOT_TOKEN', + 'BOT_IMPORT_TOKEN', 'UI_PUBLIC_URI', 'API_PUBLIC_URI', 'ROOT_USERS',