112 lines
2.8 KiB
TypeScript
112 lines
2.8 KiB
TypeScript
import { ConditionNode } from "@/lib/api/dataflow";
|
|
|
|
// 연결 정보 타입
|
|
export interface ConnectionInfo {
|
|
from_node: {
|
|
id: string;
|
|
table_name: string;
|
|
display_name: string;
|
|
};
|
|
to_node: {
|
|
id: string;
|
|
table_name: string;
|
|
display_name: string;
|
|
};
|
|
from_column?: string;
|
|
to_column?: string;
|
|
selected_columns_data?: {
|
|
[tableName: string]: {
|
|
display_name: string;
|
|
columns: string[];
|
|
};
|
|
};
|
|
existing_relationship?: {
|
|
relationship_name: string;
|
|
connection_type: string;
|
|
note?: string; // 연결 설명
|
|
settings?: Record<string, unknown>;
|
|
};
|
|
}
|
|
|
|
// 연결 설정 타입
|
|
export interface ConnectionConfig {
|
|
relationship_name: string;
|
|
connection_type: "simple-key" | "data-save" | "external-call";
|
|
from_column_name: string;
|
|
to_column_name: string;
|
|
settings?: Record<string, unknown>;
|
|
}
|
|
|
|
// 단순 키값 연결 설정
|
|
export interface SimpleKeySettings {
|
|
notes: string;
|
|
}
|
|
|
|
// 데이터 저장 설정
|
|
export interface DataSaveSettings {
|
|
actions: Array<{
|
|
id: string;
|
|
name: string;
|
|
action_type: "insert" | "update" | "delete" | "upsert";
|
|
logical_operator?: "AND" | "OR"; // 액션 간 논리 연산자 (첫 번째 액션 제외)
|
|
conditions?: ConditionNode[];
|
|
field_mappings: Array<{
|
|
source_table?: string;
|
|
source_field: string;
|
|
target_table?: string;
|
|
target_field: string;
|
|
default_value?: string;
|
|
transform_function?: string;
|
|
}>;
|
|
split_config?: {
|
|
source_field: string; // 분할할 소스 필드
|
|
delimiter: string; // 구분자 (예: ",")
|
|
target_field: string; // 분할된 값이 들어갈 필드
|
|
};
|
|
}>;
|
|
}
|
|
|
|
// 외부 호출 설정
|
|
export interface ExternalCallSettings {
|
|
call_type: "rest-api" | "email" | "ftp" | "queue";
|
|
|
|
// REST API 세부 종류
|
|
api_type?: "slack" | "kakao-talk" | "discord" | "generic";
|
|
|
|
// 일반 REST API 설정
|
|
api_url?: string;
|
|
http_method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
headers?: string;
|
|
body_template?: string;
|
|
|
|
// 슬랙 전용 설정
|
|
slack_webhook_url?: string;
|
|
slack_channel?: string;
|
|
slack_message?: string;
|
|
|
|
// 카카오톡 전용 설정
|
|
kakao_access_token?: string;
|
|
kakao_message?: string;
|
|
|
|
// 디스코드 전용 설정
|
|
discord_webhook_url?: string;
|
|
discord_message?: string;
|
|
discord_username?: string;
|
|
}
|
|
|
|
// 단순화된 외부 호출 설정 (새로운 버전)
|
|
export interface SimpleExternalCallSettings {
|
|
config_id?: number; // 선택된 외부 호출 설정 ID
|
|
config_name?: string; // 설정 이름 (표시용)
|
|
message: string; // 메시지 템플릿
|
|
}
|
|
|
|
// ConnectionSetupModal Props 타입
|
|
export interface ConnectionSetupModalProps {
|
|
isOpen: boolean;
|
|
connection: ConnectionInfo | null;
|
|
company_code: string;
|
|
onConfirm: (relationship: any) => void;
|
|
onCancel: () => void;
|
|
}
|