Phase A (P1 production blockers): - A1: Apply IP rate limiting to public routes (login/refresh) - A2: Publish domain events for workflow instance state transitions (completed/suspended/resumed/terminated) via outbox pattern - A3: Replace hardcoded nil UUID default tenant with dynamic DB lookup - A4: Add GET /api/v1/audit-logs query endpoint with pagination - A5: Enhance CORS wildcard warning for production environments Phase B (P2 functional gaps): - B1: Remove dead erp-common crate (zero references in codebase) - B2: Refactor 5 settings pages to use typed API modules instead of direct client calls; create api/themes.ts; delete dead errors.ts - B3: Add resume/suspend buttons to InstanceMonitor page - B4: Remove unused EventHandler trait from erp-core - B5: Handle task.completed events in message module (send notifications) - B6: Wire TimeoutChecker as 60s background task - B7: Auto-skip ServiceTask nodes instead of crashing the process - B8: Remove empty register_routes() from ErpModule trait and modules
108 lines
2.6 KiB
TypeScript
108 lines
2.6 KiB
TypeScript
import client from './client';
|
|
import type { PaginatedResponse } from './users';
|
|
|
|
export interface DictionaryItemInfo {
|
|
id: string;
|
|
dictionary_id: string;
|
|
label: string;
|
|
value: string;
|
|
sort_order: number;
|
|
color?: string;
|
|
}
|
|
|
|
export interface DictionaryInfo {
|
|
id: string;
|
|
name: string;
|
|
code: string;
|
|
description?: string;
|
|
items: DictionaryItemInfo[];
|
|
}
|
|
|
|
export interface CreateDictionaryRequest {
|
|
name: string;
|
|
code: string;
|
|
description?: string;
|
|
}
|
|
|
|
export interface UpdateDictionaryRequest {
|
|
name?: string;
|
|
description?: string;
|
|
}
|
|
|
|
export async function listDictionaries(page = 1, pageSize = 20) {
|
|
const { data } = await client.get<{ success: boolean; data: PaginatedResponse<DictionaryInfo> }>(
|
|
'/config/dictionaries',
|
|
{ params: { page, page_size: pageSize } },
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function createDictionary(req: CreateDictionaryRequest) {
|
|
const { data } = await client.post<{ success: boolean; data: DictionaryInfo }>(
|
|
'/config/dictionaries',
|
|
req,
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function updateDictionary(id: string, req: UpdateDictionaryRequest) {
|
|
const { data } = await client.put<{ success: boolean; data: DictionaryInfo }>(
|
|
`/config/dictionaries/${id}`,
|
|
req,
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function deleteDictionary(id: string) {
|
|
await client.delete(`/config/dictionaries/${id}`);
|
|
}
|
|
|
|
export async function listItemsByCode(code: string) {
|
|
const { data } = await client.get<{ success: boolean; data: DictionaryItemInfo[] }>(
|
|
'/config/dictionaries/items',
|
|
{ params: { code } },
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export interface CreateDictionaryItemRequest {
|
|
label: string;
|
|
value: string;
|
|
sort_order?: number;
|
|
color?: string;
|
|
}
|
|
|
|
export interface UpdateDictionaryItemRequest {
|
|
label?: string;
|
|
value?: string;
|
|
sort_order?: number;
|
|
color?: string;
|
|
}
|
|
|
|
export async function createDictionaryItem(
|
|
dictionaryId: string,
|
|
req: CreateDictionaryItemRequest,
|
|
) {
|
|
const { data } = await client.post<{ success: boolean; data: DictionaryItemInfo }>(
|
|
`/config/dictionaries/${dictionaryId}/items`,
|
|
req,
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function updateDictionaryItem(
|
|
dictionaryId: string,
|
|
itemId: string,
|
|
req: UpdateDictionaryItemRequest,
|
|
) {
|
|
const { data } = await client.put<{ success: boolean; data: DictionaryItemInfo }>(
|
|
`/config/dictionaries/${dictionaryId}/items/${itemId}`,
|
|
req,
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function deleteDictionaryItem(dictionaryId: string, itemId: string) {
|
|
await client.delete(`/config/dictionaries/${dictionaryId}/items/${itemId}`);
|
|
}
|