40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
/**
|
|
* INVYONE 비즈니스 룰 API 클라이언트 (Phase 5 — 제어 모드)
|
|
* ★ 별도 인터페이스 정의 안 함 — 전부 Record<string, any>
|
|
*/
|
|
|
|
import { apiClient } from './client';
|
|
|
|
export async function getBusinessRuleList(dashboardId: string): Promise<Record<string, any>> {
|
|
const res = await apiClient.get(`/dashboards/${dashboardId}/rules`);
|
|
return res.data.data ?? { list: [], total_count: 0 };
|
|
}
|
|
|
|
export async function getBusinessRuleInfo(ruleId: string): Promise<Record<string, any> | null> {
|
|
const res = await apiClient.get(`/rules/${ruleId}`);
|
|
return res.data.data ?? null;
|
|
}
|
|
|
|
export async function insertBusinessRule(
|
|
dashboardId: string,
|
|
data: Record<string, any>
|
|
): Promise<Record<string, any>> {
|
|
const res = await apiClient.post(`/dashboards/${dashboardId}/rules`, data);
|
|
return res.data.data;
|
|
}
|
|
|
|
export async function updateBusinessRule(
|
|
ruleId: string,
|
|
data: Record<string, any>
|
|
): Promise<void> {
|
|
await apiClient.put(`/rules/${ruleId}`, data);
|
|
}
|
|
|
|
export async function deleteBusinessRule(ruleId: string): Promise<void> {
|
|
await apiClient.delete(`/rules/${ruleId}`);
|
|
}
|
|
|
|
export async function toggleBusinessRule(ruleId: string): Promise<void> {
|
|
await apiClient.put(`/rules/${ruleId}/toggle`);
|
|
}
|