단순 키 연결 구현 시 증계 테입르에 레코드 생성 구현

This commit is contained in:
hyeonsu
2025-09-08 18:18:47 +09:00
parent 6b6c62f3b7
commit ac03f311b0
7 changed files with 269 additions and 86 deletions

View File

@@ -57,12 +57,8 @@ export interface DataBridge {
relationshipId: number;
fromTableName: string;
fromColumnName: string;
fromKeyValue: string;
fromRecordId?: string;
toTableName: string;
toColumnName: string;
toKeyValue: string;
toRecordId?: string;
connectionType: string;
companyCode: string;
createdAt: string;
@@ -78,6 +74,19 @@ export interface DataBridge {
};
}
// 테이블 데이터 조회 응답 타입
export interface TableDataResponse {
data: Record<string, unknown>[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
hasNext: boolean;
hasPrev: boolean;
};
}
// 테이블 간 데이터 관계 설정 API 클래스
export class DataFlowAPI {
/**
@@ -225,12 +234,8 @@ export class DataFlowAPI {
relationshipId: number;
fromTableName: string;
fromColumnName: string;
fromKeyValue: string;
fromRecordId?: string;
toTableName: string;
toColumnName: string;
toKeyValue: string;
toRecordId?: string;
connectionType: string;
bridgeData?: Record<string, unknown>;
}): Promise<DataBridge> {
@@ -283,4 +288,39 @@ export class DataFlowAPI {
throw error;
}
}
// ==================== 테이블 데이터 조회 API ====================
/**
* 테이블 실제 데이터 조회 (페이징)
*/
static async getTableData(
tableName: string,
page: number = 1,
limit: number = 10,
search: string = "",
searchColumn: string = "",
): Promise<TableDataResponse> {
try {
const params = new URLSearchParams({
page: page.toString(),
limit: limit.toString(),
...(search && { search }),
...(searchColumn && { searchColumn }),
});
const response = await apiClient.get<ApiResponse<TableDataResponse>>(
`/dataflow/table-data/${tableName}?${params}`,
);
if (!response.data.success) {
throw new Error(response.data.message || "테이블 데이터 조회에 실패했습니다.");
}
return response.data.data as TableDataResponse;
} catch (error) {
console.error("테이블 데이터 조회 오류:", error);
throw error;
}
}
}