/** * FieldConfig 기반 데이터 CRUD API 래퍼 * 기존 dataApi를 활용하면서 FieldConfig 컴포넌트에서 쓰기 편한 형태로 감쌈 * * ★ 별도 인터페이스 정의 안 함 — Record */ import { dataApi } from './data'; /** FieldConfig 기반 목록 조회 */ export async function fcList(params: Record): Promise> { const { tableName, page = 1, size = 20, sortBy, sortOrder, ...filters } = params; return dataApi.getTableData(tableName, { page, size, sortBy, sortOrder, filters, }); } /** FieldConfig 기반 단건 조회 */ export async function fcGet(tableName: string, id: string): Promise> { const result = await dataApi.getRecordDetail(tableName, id); return result.data ?? {}; } /** FieldConfig 기반 등록 */ export async function fcInsert(tableName: string, data: Record): Promise { return dataApi.createRecord(tableName, data); } /** FieldConfig 기반 수정 */ export async function fcUpdate(tableName: string, id: string, data: Record): Promise { return dataApi.updateRecord(tableName, id, data); } /** FieldConfig 기반 삭제 */ export async function fcDelete(tableName: string, ids: string[]): Promise { // 단건씩 삭제 (bulk delete API가 있으면 교체) const results = await Promise.all(ids.map((id) => dataApi.deleteRecord(tableName, id))); return results; }