feat(settings): add enable_automation SuperAdmin switch (default off)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -211,6 +211,7 @@ for (const key of EXTRA_EDITABLE) {
|
||||
const SUPERADMIN_OWNED_KEYS = new Set([
|
||||
'customer_direct_sms',
|
||||
'customer_special_pricing',
|
||||
'enable_automation',
|
||||
'enable_conditional_order',
|
||||
'enable_customer_level_profit',
|
||||
'enable_product_funds',
|
||||
@@ -224,6 +225,28 @@ const SUPERADMIN_OWNED_KEYS = new Set([
|
||||
'show_to_users_chat',
|
||||
]);
|
||||
|
||||
/** متادیتای کلیدهای SA که INSERTشان در SQL کامنت شده — برای قالب سوپرادمین */
|
||||
const SUPERADMIN_OWNED_META = {
|
||||
enable_automation: {
|
||||
value: 'false',
|
||||
title_fa: 'اتوماسیون',
|
||||
description:
|
||||
'روشن: منوی اتوماسیون در پنل ادمین و اجرای موتور فعال است. خاموش: منو مخفی است و API/کران اجرا نمیشود. فقط از سوپرادمین قابل تغییر است.',
|
||||
type: 'switch',
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, meta] of Object.entries(SUPERADMIN_OWNED_META)) {
|
||||
const row = ensureRow(key);
|
||||
if (!row) continue;
|
||||
row.can_edit = 0;
|
||||
row.is_active = 1;
|
||||
if (meta.value !== undefined) row.value = meta.value;
|
||||
if (meta.title_fa) row.title_fa = meta.title_fa;
|
||||
if (meta.description) row.description = meta.description;
|
||||
if (meta.type) row.type = meta.type;
|
||||
}
|
||||
|
||||
const systemRows = [...rows.values()]
|
||||
.filter((r) => r.can_edit === 0 && SUPERADMIN_OWNED_KEYS.has(r.key))
|
||||
.sort((a, b) => a.key.localeCompare(b.key));
|
||||
|
||||
Reference in New Issue
Block a user