0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-22 04:38:11 +00:00

canonize system value on api

This commit is contained in:
Víctor Losada Hernández
2026-03-11 12:13:59 +01:00
parent 01bac3fcd3
commit 89a21f8099

View File

@@ -31,13 +31,21 @@ const isStaticTheme = (renderer, themeName)=>{
// });
// };
const migrateSystemsToTags = (brew) => {
if (!('systems' in brew)) return brew;
if (!Array.isArray(brew.systems) || brew.systems.length === 0) {
brew.systems = undefined;
return brew;
}
const systemTags = brew.systems.map(s => `system:${s}`);
const systemMap = {
'5e': 'system:D&D 5e',
'4e': 'system:D&D 4e',
'3.5e': 'system:D&D 3.5e',
'Pathfinder': 'system:Pathfinder'
};
const systemTags = brew.systems.map(s => systemMap[s]);
brew.tags = _.uniq([...(brew.tags || []), ...systemTags]);
brew.systems = undefined;