Implement the complete erp-config crate with: - Data dictionaries (CRUD + items management) - Dynamic menus (tree structure with role filtering) - System settings (hierarchical: platform > tenant > org > user) - Numbering rules (concurrency-safe via PostgreSQL advisory_lock) - Theme and language configuration (via settings store) - 6 database migrations (dictionaries, menus, settings, numbering_rules) - Frontend Settings page with 5 tabs (dictionary, menu, numbering, settings, theme) Refactor: move RBAC functions (require_permission) from erp-auth to erp-core to avoid cross-module dependencies. Add 20 new seed permissions for config module operations.
26 lines
679 B
TypeScript
26 lines
679 B
TypeScript
import client from './client';
|
|
|
|
export interface SettingInfo {
|
|
id: string;
|
|
scope: string;
|
|
scope_id?: string;
|
|
setting_key: string;
|
|
setting_value: unknown;
|
|
}
|
|
|
|
export async function getSetting(key: string, scope?: string, scopeId?: string) {
|
|
const { data } = await client.get<{ success: boolean; data: SettingInfo }>(
|
|
`/config/settings/${key}`,
|
|
{ params: { scope, scope_id: scopeId } },
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function updateSetting(key: string, settingValue: unknown) {
|
|
const { data } = await client.put<{ success: boolean; data: SettingInfo }>(
|
|
`/config/settings/${key}`,
|
|
{ setting_value: settingValue },
|
|
);
|
|
return data.data;
|
|
}
|