c350ebe86a
- 마이그레이션 V022/RUN_088: DEPT_MANAGERS 신규 (role: approval/dept/org_leader, PK 3-tuple, FK CASCADE) - StartupSchemaMigrator 에 V022 idempotent CREATE 추가 → 테넌트 DB 자동 동기화 - mapper.xml: SELECT 에 3 json_agg ::TEXT 컬럼 추가, insertDeptManagers + deleteDeptManagersByDeptAndRole 신규 - service: parseManagersJson + syncManagers (delete-all + insert-all, 최대 10명, 역할 한글 메시지) - frontend: types 3 필드, DeptDetailDraft 확장, ManagerChipsField (chip+UserSearchModal 재사용), 조직장 Row 신규 기존 DEPT_INFO.APPROVAL_MANAGER / DEPT_MANAGER 단일 컬럼은 호환을 위해 유지.
104 lines
3.2 KiB
TypeScript
104 lines
3.2 KiB
TypeScript
/**
|
|
* 부서 관리 관련 타입 정의
|
|
*/
|
|
|
|
// 부서 정보 (dept_info 테이블 1:1 매핑) — V019 정리 후
|
|
export interface Department {
|
|
dept_code: string; // 부서 코드 (PK)
|
|
parent_dept_code?: string | null; // 상위 부서 코드
|
|
dept_name: string; // 부서명
|
|
location?: string | null; // 위치코드 (UI hide, V2 매핑용 컬럼만 유지)
|
|
created_date?: string | null; // 생성일시
|
|
status?: "active" | "inactive" | null; // 사용여부
|
|
company_name?: string | null; // 회사명
|
|
company_code: string; // 회사 코드
|
|
short_name?: string | null; // 부서약칭
|
|
dept_type?: string | null; // 부서유형 (dept/team/temp)
|
|
org_system?: string | null; // 조직체계
|
|
approval_manager?: string | null; // 결재관리자 user_id
|
|
dept_manager?: string | null; // 부서관리자 user_id
|
|
zipcode?: string | null;
|
|
address1?: string | null;
|
|
address2?: string | null;
|
|
start_date?: string | null; // YYYY-MM-DD
|
|
end_date?: string | null; // YYYY-MM-DD
|
|
sort_order?: number | null;
|
|
created_at?: string;
|
|
updated_at?: string;
|
|
deleted_at?: string | null; // V1: soft-delete 시각. NULL=active, 값 있음=휴지통
|
|
// 다중 관리자 매핑 (서버 응답: dept_managers 테이블에서 role 별로 json_agg)
|
|
approval_managers?: { user_id: string }[];
|
|
dept_managers?: { user_id: string }[];
|
|
org_leaders?: { user_id: string }[];
|
|
// UI용 추가 필드
|
|
children?: Department[];
|
|
member_count?: number;
|
|
}
|
|
|
|
// 부서원 정보
|
|
export interface DepartmentMember {
|
|
user_id: string; // 사용자 ID
|
|
user_name: string; // 사용자명
|
|
dept_code: string; // 부서 코드
|
|
dept_name: string; // 부서명
|
|
is_primary: boolean; // 주 부서 여부
|
|
position_name?: string; // 직책명
|
|
email?: string; // 이메일
|
|
phone?: string; // 전화번호
|
|
cell_phone?: string; // 휴대폰
|
|
}
|
|
|
|
// 사용자-부서 매핑 (겸직 지원)
|
|
export interface UserDepartmentMapping {
|
|
user_id: string;
|
|
dept_code: string;
|
|
is_primary: boolean; // 주 부서 여부
|
|
created_at?: string;
|
|
}
|
|
|
|
// 부서 등록/수정 폼 데이터 — dept_info 스키마 1:1 (V019 정리 후)
|
|
export interface DepartmentFormData {
|
|
dept_name: string; // 부서명 (필수)
|
|
parent_dept_code?: string | null;
|
|
short_name?: string | null;
|
|
dept_type?: string | null;
|
|
org_system?: string | null;
|
|
approval_manager?: string | null;
|
|
dept_manager?: string | null;
|
|
zipcode?: string | null;
|
|
address1?: string | null;
|
|
address2?: string | null;
|
|
start_date?: string | null;
|
|
end_date?: string | null;
|
|
sort_order?: number | null;
|
|
status?: "active" | "inactive" | null;
|
|
// dept_info 추가 필드 (location 코드만 유지)
|
|
location?: string | null;
|
|
dept_code?: string | null; // 일괄등록용 (자동 부여 시 미전달)
|
|
}
|
|
|
|
// 부서 트리 노드 (UI용)
|
|
export interface DepartmentTreeNode {
|
|
dept_code: string;
|
|
dept_name: string;
|
|
parent_dept_code?: string | null;
|
|
children: DepartmentTreeNode[];
|
|
member_count: number;
|
|
isExpanded: boolean;
|
|
}
|
|
|
|
// 부서 API 응답
|
|
export interface DepartmentApiResponse {
|
|
success: boolean;
|
|
message: string;
|
|
data?: Department | Department[];
|
|
}
|
|
|
|
// 부서원 API 응답
|
|
export interface DepartmentMemberApiResponse {
|
|
success: boolean;
|
|
message: string;
|
|
data?: DepartmentMember | DepartmentMember[];
|
|
}
|
|
|