fix(api): sync from legacy used wrong type of data

This commit is contained in:
41666 2021-03-21 22:10:27 -04:00
parent bfc96b0750
commit 117c73a8a1
2 changed files with 9 additions and 6 deletions

View file

@ -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,
})
),
};
};