- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { apiFetch } from './client';
|
|
import { API_ENDPOINTS } from './config';
|
|
|
|
export interface SettingResponse {
|
|
setting_id: string;
|
|
setting_key: string;
|
|
setting_value: unknown;
|
|
description: string | null;
|
|
is_public: boolean;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface SettingCreate {
|
|
setting_key: string;
|
|
setting_value: unknown;
|
|
description?: string;
|
|
is_public?: boolean;
|
|
}
|
|
|
|
export interface SettingUpdate {
|
|
setting_value: unknown;
|
|
description?: string;
|
|
is_public?: boolean;
|
|
}
|
|
|
|
export const settingsService = {
|
|
async getPublic(): Promise<SettingResponse[]> {
|
|
return apiFetch<SettingResponse[]>(API_ENDPOINTS.SETTINGS_PUBLIC);
|
|
},
|
|
|
|
async getByKey(key: string): Promise<SettingResponse> {
|
|
return apiFetch<SettingResponse>(API_ENDPOINTS.SETTINGS_BY_KEY(key));
|
|
},
|
|
|
|
async create(data: SettingCreate): Promise<SettingResponse> {
|
|
return apiFetch<SettingResponse>(API_ENDPOINTS.SETTINGS_CREATE, {
|
|
method: 'POST',
|
|
body: JSON.stringify(data),
|
|
});
|
|
},
|
|
|
|
async update(key: string, data: SettingUpdate): Promise<SettingResponse> {
|
|
return apiFetch<SettingResponse>(API_ENDPOINTS.SETTINGS_UPDATE(key), {
|
|
method: 'PUT',
|
|
body: JSON.stringify(data),
|
|
});
|
|
},
|
|
};
|