ERP-node/frontend/types/flow.ts

225 lines
4.9 KiB
TypeScript

/**
* 플로우 관리 시스템 - 프론트엔드 타입 정의
*/
// ============================================
// 조건 연산자
// ============================================
export type ConditionOperator =
| "equals"
| "not_equals"
| "in"
| "not_in"
| "greater_than"
| "less_than"
| "greater_than_or_equal"
| "less_than_or_equal"
| "is_null"
| "is_not_null"
| "like"
| "not_like";
// ============================================
// 플로우 조건
// ============================================
export interface FlowCondition {
column: string;
operator: ConditionOperator;
value?: any;
}
export interface FlowConditionGroup {
type: "AND" | "OR";
conditions: FlowCondition[];
}
// ============================================
// 플로우 정의
// ============================================
export interface FlowDefinition {
id: number;
name: string;
description?: string;
tableName: string;
isActive: boolean;
createdAt: string;
updatedAt: string;
createdBy: string;
updatedBy: string;
}
export interface CreateFlowDefinitionRequest {
name: string;
description?: string;
tableName: string;
}
export interface UpdateFlowDefinitionRequest {
name?: string;
description?: string;
tableName?: string;
isActive?: boolean;
}
// ============================================
// 플로우 단계
// ============================================
export interface FlowStep {
id: number;
flowDefinitionId: number;
stepName: string;
stepOrder: number;
tableName?: string; // 이 단계에서 조회할 테이블명
conditionJson?: FlowConditionGroup;
color: string;
positionX: number;
positionY: number;
createdAt: string;
updatedAt: string;
createdBy: string;
updatedBy: string;
}
export interface CreateFlowStepRequest {
stepName: string;
stepOrder: number;
tableName?: string; // 이 단계에서 조회할 테이블명
conditionJson?: FlowConditionGroup;
color?: string;
positionX?: number;
positionY?: number;
}
export interface UpdateFlowStepRequest {
stepName?: string;
tableName?: string; // 이 단계에서 조회할 테이블명
stepOrder?: number;
conditionJson?: FlowConditionGroup;
color?: string;
positionX?: number;
positionY?: number;
}
// ============================================
// 플로우 단계 연결
// ============================================
export interface FlowStepConnection {
id: number;
flowDefinitionId: number;
fromStepId: number;
toStepId: number;
label?: string;
createdAt: string;
updatedAt: string;
}
export interface CreateFlowConnectionRequest {
flowDefinitionId: number;
fromStepId: number;
toStepId: number;
label?: string;
}
// ============================================
// 플로우 데이터 상태
// ============================================
export interface FlowDataStatus {
id: number;
flowDefinitionId: number;
tableName: string;
recordId: string;
currentStepId: number | null;
updatedAt: string;
updatedBy: string;
}
// ============================================
// 플로우 오딧 로그
// ============================================
export interface FlowAuditLog {
id: number;
flowDefinitionId: number;
tableName: string;
recordId: string;
fromStepId: number | null;
toStepId: number | null;
changedAt: string;
changedBy: string;
note?: string;
fromStepName?: string;
toStepName?: string;
}
// ============================================
// 플로우 실행 관련
// ============================================
export interface FlowStepDataCount {
stepId: number;
stepName: string;
count: number;
}
export interface FlowStepDataList {
records: any[];
total: number;
page: number;
pageSize: number;
}
export interface MoveDataRequest {
flowId: number;
recordId: string;
toStepId: number;
note?: string;
}
export interface MoveBatchDataRequest {
flowId: number;
recordIds: string[];
toStepId: number;
note?: string;
}
// ============================================
// API 응답 타입
// ============================================
export interface ApiResponse<T> {
success: boolean;
data?: T;
message?: string;
error?: string;
}
// ============================================
// React Flow 관련 타입 (비주얼 편집기용)
// ============================================
export interface FlowNodeData {
id: number;
label: string;
stepOrder: number;
tableName?: string;
count?: number;
condition?: FlowConditionGroup;
}
export interface FlowEdgeData {
id: number;
label?: string;
}
// ============================================
// UI 컴포넌트용 타입
// ============================================
export interface FlowListItem extends FlowDefinition {
stepsCount?: number;
lastUpdated?: string;
}
export interface FlowEditorState {
flowDefinition: FlowDefinition | null;
steps: FlowStep[];
connections: FlowStepConnection[];
selectedStepId: number | null;
isEditMode: boolean;
}