refactor phase 7-8

This commit is contained in:
alorig
2025-11-20 22:40:18 +05:00
parent 45dc0d1fa2
commit 3e142afc7a
11 changed files with 695 additions and 74 deletions

View File

@@ -1580,6 +1580,50 @@ export async function deleteAccountSetting(key: string): Promise<void> {
}
}
// User Settings API functions
export interface UserSetting {
id: number;
key: string;
value: Record<string, any>;
created_at: string;
updated_at: string;
}
export interface UserSettingsResponse {
count: number;
next: string | null;
previous: string | null;
results: UserSetting[];
}
export async function fetchUserSettings(): Promise<UserSettingsResponse> {
return fetchAPI('/v1/system/settings/user/');
}
export async function fetchUserSetting(key: string): Promise<UserSetting> {
return fetchAPI(`/v1/system/settings/user/${key}/`);
}
export async function createUserSetting(data: { key: string; value: Record<string, any> }): Promise<UserSetting> {
return fetchAPI('/v1/system/settings/user/', {
method: 'POST',
body: JSON.stringify(data),
});
}
export async function updateUserSetting(key: string, data: { value: Record<string, any> }): Promise<UserSetting> {
return fetchAPI(`/v1/system/settings/user/${key}/`, {
method: 'PUT',
body: JSON.stringify(data),
});
}
export async function deleteUserSetting(key: string): Promise<void> {
await fetchAPI(`/v1/system/settings/user/${key}/`, {
method: 'DELETE',
});
}
// Module Settings
export interface ModuleEnableSettings {
id: number;