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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user