Phase 0: Add frontend module config and update settings store

- Created modules.config.ts with module definitions
- Added ModuleEnableSettings API functions
- Updated settingsStore with module enable settings support
- Added isModuleEnabled helper method
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-16 18:43:24 +00:00
parent 13bd7fa134
commit 8102aa74eb
3 changed files with 176 additions and 0 deletions

View File

@@ -1474,6 +1474,20 @@ export async function deleteAccountSetting(key: string): Promise<void> {
}
// Module Settings
export interface ModuleEnableSettings {
id: number;
planner_enabled: boolean;
writer_enabled: boolean;
thinker_enabled: boolean;
automation_enabled: boolean;
site_builder_enabled: boolean;
linker_enabled: boolean;
optimizer_enabled: boolean;
publisher_enabled: boolean;
created_at: string;
updated_at: string;
}
export interface ModuleSetting {
id: number;
module_name: string;
@@ -1498,6 +1512,19 @@ export async function createModuleSetting(data: { module_name: string; key: stri
});
}
export async function fetchModuleEnableSettings(): Promise<ModuleEnableSettings> {
const response = await fetchAPI('/v1/system/settings/modules/enable/');
return response;
}
export async function updateModuleEnableSettings(data: Partial<ModuleEnableSettings>): Promise<ModuleEnableSettings> {
const response = await fetchAPI('/v1/system/settings/modules/enable/', {
method: 'PUT',
body: JSON.stringify(data),
});
return response;
}
export async function updateModuleSetting(moduleName: string, key: string, data: Partial<{ config: Record<string, any>; is_active: boolean }>): Promise<ModuleSetting> {
return fetchAPI(`/v1/system/settings/modules/${key}/?module_name=${moduleName}`, {
method: 'PUT',