mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-11 22:30:59 +04:30
Add per-business modules and home chart slots.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
0632f67bda
commit
9ca6e2306f
@@ -38,11 +38,41 @@ export type StoreSettings = {
|
||||
orderProcessSteps: OrderProcessStep[];
|
||||
};
|
||||
|
||||
/** Optional CMS modules a business can have. Always-on areas (customers, website, etc.) are not listed. */
|
||||
export const BUSINESS_MODULE_IDS = [
|
||||
'products',
|
||||
'store',
|
||||
'portfolio',
|
||||
'blog',
|
||||
'warehouse',
|
||||
'videos',
|
||||
] as const;
|
||||
|
||||
export type BusinessModuleId = (typeof BUSINESS_MODULE_IDS)[number];
|
||||
|
||||
/** Home dashboard chart types (super-admin selectable). */
|
||||
export const HOME_CHART_IDS = [
|
||||
'none',
|
||||
'orders_30d',
|
||||
'customers_joined_1y',
|
||||
'blog_views_30d',
|
||||
'products_added_1y',
|
||||
] as const;
|
||||
|
||||
export type HomeChartId = (typeof HOME_CHART_IDS)[number];
|
||||
|
||||
export type ModulesSettings = {
|
||||
enabled: BusinessModuleId[];
|
||||
/** Two home-page chart slots (left, right). */
|
||||
charts: [HomeChartId, HomeChartId];
|
||||
};
|
||||
|
||||
/** Top-level business settings stored in `businesses.settings` JSONB. */
|
||||
export type BusinessSettings = {
|
||||
branding: BrandingSettings;
|
||||
dashboard: DashboardSettings;
|
||||
store: StoreSettings;
|
||||
modules: ModulesSettings;
|
||||
};
|
||||
|
||||
export const DEFAULT_ORDER_PROCESS_STEPS: OrderProcessStep[] = [
|
||||
@@ -72,6 +102,16 @@ export const DEFAULT_ORDER_PROCESS_STEPS: OrderProcessStep[] = [
|
||||
},
|
||||
];
|
||||
|
||||
/** Existing tenants without `settings.modules` keep every module enabled. */
|
||||
export const DEFAULT_ENABLED_BUSINESS_MODULES: BusinessModuleId[] = [
|
||||
...BUSINESS_MODULE_IDS,
|
||||
];
|
||||
|
||||
export const DEFAULT_HOME_CHARTS: [HomeChartId, HomeChartId] = [
|
||||
'orders_30d',
|
||||
'customers_joined_1y',
|
||||
];
|
||||
|
||||
export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
||||
branding: {
|
||||
primaryColor: DEFAULT_BUSINESS_PRIMARY_COLOR_ID,
|
||||
@@ -85,4 +125,8 @@ export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
||||
onlineSellEnabled: true,
|
||||
orderProcessSteps: DEFAULT_ORDER_PROCESS_STEPS,
|
||||
},
|
||||
modules: {
|
||||
enabled: DEFAULT_ENABLED_BUSINESS_MODULES,
|
||||
charts: DEFAULT_HOME_CHARTS,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user