mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-02-23 18:51:29 +02:00
feat(api): reorderable categories in panels
This commit is contained in:
parent
0b06e1852f
commit
5ffd18961b
@ -30,7 +30,11 @@ module.exports.post = fastify => ({
|
||||
where: { id: guild.id },
|
||||
});
|
||||
const getMessage = client.i18n.getLocale(settings.locale);
|
||||
const categories = settings.categories.filter(c => data.categories.includes(c.id));
|
||||
const categories = data.categories.map(id => {
|
||||
const category = settings.categories.find(c => c.id === id);
|
||||
if (!category) throw new Error(`Invalid category: ${id}`);
|
||||
return category;
|
||||
});
|
||||
if (categories.length === 0) throw new Error('No categories');
|
||||
if (categories.length !== 1 && data.type === 'MESSAGE') throw new Error('Invalid number of categories for panel type');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user