Compare commits

..
225 Commits
Author SHA1 Message Date
ypshimandClaude Haiku 5.5 166b4af874 docs: 프로젝트 README 추가 (실행 방법, 명령어, 입력 파일, 폴더 구조)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-29 15:06:17 +09:00
ypshimandClaude Haiku 5.5 1ecd7542ee feat(quantity): ④ 전체 합계에 교량 전체 집계 표를 추가
- 교각 목록의 "전체"를 "전체 합계 (N기)"로 표시
- 전체를 고르고 2기 이상이면 강종·직경별 교량 전체 집계를 맨 위에 표시 (소계, 합계, 할증 포함, 커플러)
- 집계 규칙을 core/quantity-total.ts로 분리하고 테스트 3건 추가. 교각별 표는 그대로

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 17:10:11 +09:00
ypshimandClaude Haiku 5.5 7861bc3fdf feat(quantity): ④ 재료표 범위를 교각 목록의 선택과 맞춤 (전체 또는 고른 교각)
- 교각 목록 맨 위에 "전체 (N기)" 항목 추가 (기본 선택)
- 교각 이름을 누르면 그 교각의 재료표만 표시, 제목·합계 문구도 그 교각 기준
- 범위 규칙을 core/quantity-scope.ts로 분리하고 테스트 4건 추가

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 17:08:05 +09:00
ypshimandClaude Haiku 5.5 278d19faa5 feat(copy): 복사 항목이 없는 부재(교량받침·기둥)에서는 속성 복사 패널을 숨김
- hasCopyItems 추가, 테스트 2건 (코핑·확대기초·지반은 표시, 교량받침·기둥은 숨김)
- "이 부재는 복사 항목이 없습니다" 문구 제거
- 대응표는 그대로 두어 항목이 생기면 자동으로 다시 표시

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 17:03:45 +09:00
ypshimandClaude Haiku 5.5 fb09c693c4 refactor(copy): 대상 교각의 같은 형식 필터와 같은 형식 모두 선택 버튼 제거
- "원본과 같은 형식만" 체크박스와 "같은 형식 모두 선택" 버튼 삭제, "선택 해제"는 유지
- 대상 칩에 원본과 형식이 다르면 "형식 다름" 표시
- copyCandidates와 selectedTargets에서 형식 필터 인자 제거, 테스트 갱신
- 테스트 타입 오류(optional 필드) 수정

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 17:01:32 +09:00
ypshimandClaude Haiku 5.5 5f3ea8d56f feat(copy): 코핑의 끝단 높이 h1, 테이퍼 높이 h2, Level 폭을 복사 항목에 추가
- COPY_ITEMS에 coping-h1, coping-h2, level-width 추가 (기본 해제)
- 코핑 부재의 복사 항목에 포함, 바뀐 값이 있으면 기본으로 체크
- 테스트 갱신 및 h1·Level 폭 기본 체크 테스트 추가

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:56:12 +09:00
ypshimandClaude Haiku 5.5 7314da639b feat(copy): 복사 항목 기본 체크를 기준 교각에서 바뀐 항목으로 설정
- 기준 교각의 되돌리기가 보이는 값에 해당하는 복사 항목을 자동으로 체크
- 기준 교각이나 부재가 바뀔 때만 다시 계산, 그 사이 사용자의 체크는 유지
- "변경 항목으로 선택" 버튼으로 언제든 같은 상태로 되돌림
- 바뀐 값이 없으면 아무 항목도 체크하지 않음 (적용 버튼 비활성)
- copyItemsWithOverrides 추가, 테스트 4건

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:51:30 +09:00
ypshimandClaude Haiku 5.5 70fa0be86f fix(rebar): 부재 fck 되돌리기가 교각도 기본값으로 돌아가고, 기본과 다르면 주황색 표시
- IMPORTED_FCK(기둥 40, 코핑 40, 확대기초 27)와 fckChanged 추가, 테스트 4건
- 되돌리기는 공통 fck가 아니라 교각도 기본값으로 돌아감 (기둥·코핑은 기존에 27로 돌아가던 문제)
- 기본과 다르면 입력 카드를 주황색으로 표시. "변경 n건"에는 넣지 않음 (배근에만 반영)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:47:06 +09:00
ypshimandClaude Haiku 5.5 9a338614a6 refactor(copy): 속성 복사의 원본 섹션 제거, 미리보기 표를 대상별 한 줄 요약으로
- 원본 교각은 패널 제목 아래 한 줄로 옮김 (별도 섹션 없음)
- 적용 미리보기 표를 "교각 · 바뀌는 값 · 건너뜀" 한 줄 요약으로 바꿈 (고른 교각만)
- 섹션 번호: 1 대상 교각, 2 복사할 항목, 3 변경 요약

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:41:13 +09:00
ypshimandClaude Haiku 5.5 0dbd66d807 refactor(copy): 속성 복사를 ② 형상계획 부재 패널에만 두고 ①에서 제거
- 복사 패널을 ② 부재 패널(다시 생성 아래)로 옮김. ①의 수정 카드에는 없음
- ①의 부재 선택 드롭다운과 관련 코드 제거 (②의 부재 목록을 그대로 사용)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:38:22 +09:00
ypshimandClaude Haiku 5.5 3a16ee59da feat(copy): 속성 복사 항목을 선택한 부재에 해당하는 것만 표시
- 부재별 복사 항목 대응표(MEMBER_COPY_ITEMS)를 core/copy-targets.ts에 두고 테스트 추가
  코핑 → 폭·길이, 확대기초·말뚝 → 말뚝 길이·열별 본수, 지반 → 위치·지하수위, 기둥·받침 → 없음
- 항목은 선택된 부재(state.member) 기준으로 그려지고, 체크 상태는 부재를 바꿔도 유지
- 기둥·받침은 "복사 항목 없음"을 표시하고 적용 버튼을 비활성화
- ①은 복사 패널 안의 부재 선택으로, ②는 부재 목록으로 같은 부재를 고름

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:31:38 +09:00
ypshimandClaude Haiku 5.5 ccc1f494bc feat(copy): 속성 복사는 고른 대상 교각에만 적용
- 대상 교각을 원본 아래(2번)로 올리고, 기본 0기로 시작
- 같은 형식 모두 선택 / 선택 해제 버튼 추가, 모델 없는 교각은 고를 수 없음
- 적용 버튼에 대상 이름을 표시 ("P1, P5 2기에만 적용"), 미리보기는 고른 교각만 표시
- 후보·선택 규칙을 core/copy-targets.ts로 분리하고 테스트 6건 추가

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:25:02 +09:00
ypshimandClaude Haiku 5.5 d8b383423c fix(view): 체크박스 제거 후 교각 목록의 이름 버튼이 좁아 선택이 안 되던 문제
- 행과 머리글 격자가 체크박스 열(36px)을 그대로 두고 있어 이름 버튼이 그 열에 갇혔음
- 격자를 이름·배지 두 열로 바꾸고 이름 버튼이 행 전체 너비를 쓰도록 함

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:20:55 +09:00
ypshimandClaude Haiku 5.5 42ae591eba refactor(view): 교각 목록 체크박스 제거, 속성 복사를 부재별 편집창 하단으로 이동
- 교각 목록의 체크박스·전체 선택·선택 교각 수 막대 제거
- ① 3D: 생성된 교각 전체 (전체 보기), ② 3D: 기준 교각만
- 다시 생성: 변경이 있거나 아직 생성되지 않은 교각만 다시 생성 (변경 교각 다시 생성)
- 속성 복사: 모달 창을 없애고 ① 편집 카드, ② 부재 패널 하단의 인라인 패널로 이동
  대상 교각은 패널 안에서만 고름. 지반 위치·지하수위 항목을 복사 항목에 추가
- 일괄 적용 버튼과 ③ 속성 복사 버튼 제거 (복사는 편집 패널에서)
- 활성 교각 체크 기능(shownNames, overrideTargets) 제거

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 16:16:30 +09:00
ypshimandClaude Haiku 5.5 4fc02afb1a feat(view): 체크한 교각을 활성으로 보고 기준 교각 수정값을 활성 교각에 적용
- 체크 = 활성: 체크된 교각(모델 있는 것)과 기준 교각을 3D에 함께 표시
- ② 형상계획도 활성 교각이 2기 이상이면 같은 좌표계로 배치
- 이름 클릭 = 기준 교각: 코핑·말뚝 수정 카드의 대상
- '활성 교각에 적용': 기준 교각의 변경 항목만 다른 활성 교각에 복사 (확인 후, 다시 생성으로 반영)
- 입력값 표: 활성 교각 행 음영, 기준 교각 굵게

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:45:05 +09:00
ypshimandClaude Haiku 5.5 60e50b1186 feat(view): 3D 뷰에 전체 보기 버튼 다시 추가
- 부재 표시·시점 버튼과 같은 우측 패널에 배치
- ① 형상 생성에서는 기본이 전체 보기이며, 버튼으로 단일 보기와 전환
- 다른 단계에서는 버튼 비활성

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:33:53 +09:00
ypshimandClaude Haiku 5.5 d2ebce026d refactor(view): 3D 뷰의 전체 보기 버튼 삭제, ① 진입 시 전체 보기로 시작
- 전체 보기 버튼 제거. ① 형상 생성은 항상 전체 보기로 열림
- 다른 단계에서 ①로 돌아오면 전체 보기로 다시 설정
- 교각을 눌러 단일 보기로 바꾼 뒤에는 ①로 다시 들어와야 전체 보기로 돌아감

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:32:02 +09:00
ypshimandClaude Haiku 5.5 12e9828a3a feat(view): 입력값을 6기 표로 보이고 코핑·말뚝 수정 대상 교각을 표시
- 입력값: 교각마다 한 행(코핑 상면·기초 하단·지반고·말뚝·코핑 폭×길이·받침)
- 행을 누르면 그 교각이 활성이 되고 상세와 수정 대상이 바뀜
- 수정 카드 제목에 대상 교각 이름을 표시

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:29:34 +09:00
ypshimandClaude Haiku 5.5 b0a71fc73f feat(import): 엑셀 불러오기 미리보기에 전체 교각의 입력값 표시
- 교각 정보: 교각마다 열 하나, 행은 형식·EL·기초·말뚝·두부보·기둥·받침/IP 수·불러오기 여부
- 받침과 IP: 모든 교각을 한 표에 두고 교각 열을 추가, 표는 스크롤
- 교각 이름 클릭으로 미리볼 교각을 고르던 방식은 제거 (전체를 보여 줌)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:26:35 +09:00
ypshimandClaude Haiku 5.5 844177b40e feat(view): 지형 모델이 없을 때 교각별 지반 패드를 정사각형으로 표시
- 한 변 = 코핑 길이 + 2 m, 교각 축에 맞춰 코핑 중심에 둠, 지반고 높이
- 패드는 교각별 추정이며 서로 잇지 않음 (지형 면 아님)
- 테스트: 상면 네 모서리로 한 변과 대각선 길이 확인

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:23:49 +09:00
ypshimandClaude Haiku 5.5 2caed5b87f feat(view): 형상 생성 화면에서 전체 보기를 기본으로 선택
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:19:49 +09:00
ypshimandClaude Haiku 5.5 e5d8002c79 fix(view): 지형 모델이 없을 때 60 m 사각판 대신 교각별 지반고 선 표시
- 지형 격자가 없으면 교각 지반고 위치에 얇은 선(코핑 길이 + 여유 2 m)만 그림
- 전체 보기에서도 지형이 없으면 교각별 지반고 선을 표시, 지형이 있으면 공유 격자만 표시
- 부재 표시 '지반' 체크박스는 두 경우 모두 동작
- 테스트: 얇은 선 위치와 길이, 지형 있을 때 선 미표시

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:16:49 +09:00
ypshimandClaude Haiku 5.5 765384cd71 fix(view): 전체 보기 버튼을 넓은 화면에서도 보이도록 부유 패널로 이동
viewer-head는 넓은 화면에서 숨겨져 있어 버튼이 보이지 않았음.
부재 표시·시점 버튼과 같은 우측 패널에 둠.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:09:47 +09:00
ypshimandClaude Haiku 5.5 a2ad0f2baf feat(view): 전체 보기로 6기 콘크리트를 한 화면에 표시
- 교각별 축 위치(pivot E·N 차이)로 장면을 배치하는 pierOffset과 buildAllPiers 추가
- 지형 격자는 기준 교각(첫 교각) 좌표로 한 번만 그림, 교각별 지반면은 숨김
- 철근은 표시하지 않음 (콘크리트만). ① 형상 생성에서만 동작
- 전체 보기에서 교각을 클릭하면 그 교각을 활성으로 하고 단일 교각 보기로 전환
- 테스트: 위치 오프셋 부호, 피벗을 옮겨도 같은 월드 상자

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 15:08:09 +09:00
ypshimandClaude Haiku 5.5 ab04c19afb feat(rebar): 확대기초 다리 배치 상세 탭과 B10 모서리 탭 추가
- core/rebar/footing-legs.ts: 번호별 다리 형태·길이·끝 높이·이음 여부 (계산 함수 결과 사용)
- view/footing-corner-svg.ts: B10-2 → B10-1 모서리 갈고리, 깊이 122.25 / 123.85, l_h 296, 최하단 제외 표시
- 패널 탭 4개 모두 작동 (B10 모서리는 개략도, 단면 비율 아님)
- 테스트: 12개 철근, B2 다리 1723, B6 이음 필요, 모서리 값

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 14:09:13 +09:00
ypshimandClaude Haiku 5.5 df96991c9b fix(rebar): 길이 단면의 B12 풍선을 왼쪽으로 옮겨 B11 지시선과 구분, 말뚝 개수 테스트 추가
- B12 풍선을 피복선 쪽으로 80 px 옮겨 B11 지시선과 떨어지게 함
- 말뚝 5개 위치 전부 그려지는지 테스트로 확인

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 14:01:49 +09:00
ypshimandClaude Haiku 5.5 cf8410e450 feat(rebar): 길이 단면의 주철근 B5–B8을 굵게 표시하고 양끝 다리를 그림
- B5–B8 선 굵기 2, B5 양끝 아래, B6·B7 양끝 위, B8 직선 (확대기초철근 (1).md §6)
- 테스트: 다리 6개 확인

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 13:58:27 +09:00
ypshimandClaude Haiku 5.5 0e9d89951a feat(rebar): 확대기초 교각축 단면(길이 L) 탭 추가
- view/footing-section-l-svg.ts: 길이 방향 단면 (B1–B4 점, B5–B8 선, B9 세로선, B10-2 점·B10-1 선, B11 점, B12 선)
- 탭 전환: 교각축 직각 단면(폭 W) ↔ 교각축 단면(길이 L), 다리 배치 상세·B10 모서리는 다음 단계
- 테스트: 점·선 개수가 철근표 개수와 같음

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 13:56:05 +09:00
ypshimandClaude Haiku 5.5 d3c761dcd1 feat(rebar): 부재별 fck 초기값을 교각도 기준으로 설정 (기둥·코핑 40, 기초 27)
- 화면 초기 상태만 변경. 코어 기본값과 테스트는 그대로 (기존 프로젝트 파일의 값은 유지)
- 철근 강도 H = SD400(코핑), S = SD500(기둥·기초)은 기존 설정과 도면이 이미 일치

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 13:52:46 +09:00
ypshimandClaude Haiku 5.5 2cf82b248a docs(rebar): B9 행 엇갈림 방향을 L 방향으로 명시
삽도(9,350 기초)의 상면 200과 중앙 450 여유 차이 250 = 2s가 L 방향 엇갈림을 보여 줌. 계산은 그대로.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 12:35:11 +09:00
ypshim b6f942195e Revert "feat(rebar): 확대기초 단면 그림에서 B1–B4와 B10-1 제외"
This reverts commit 77ad63fcbf.
2026-10-27 11:21:07 +09:00
ypshimandClaude Haiku 5.5 77ad63fcbf feat(rebar): 확대기초 단면 그림에서 B1–B4와 B10-1 제외
- B1–B4 선, B2 다리선, B1–B4 풍선 제거 (그림에서만, 철근표·3D는 그대로)
- B10-1 점과 풍선 제거, 범례의 B1–B4·B10 항목 제거
- 테스트 갱신

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 11:19:36 +09:00
ypshimandClaude Haiku 5.5 61a8db916d feat(rebar): 확대기초 단면 풍선 지시선의 끝을 점철근 표시로 변경
- 각 풍선의 지시선 끝에 철근 계열 색의 점(점철근)을 찍어, 선 위가 아니라 점에 닿도록 함
- B1–B4 선 철근, B11 선 철근도 같은 방식으로 점 표시

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 09:59:18 +09:00
ypshimandClaude Haiku 5.5 71fdb75c71 Reapply "feat(rebar): B1–B4와 B5–B8 방향 교환 (B1–B4는 W 방향, B5–B8은 L 방향)"
사용자 요청으로 방향 교환을 다시 적용 (99db6a1 되돌림). 격자 키 sL/sW, 3D·단면·철근표 역할과 테스트 기대값이 교환 기준으로 돌아감.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 09:51:04 +09:00
ypshimandClaude Haiku 5.5 99db6a1f52 Revert "feat(rebar): B1–B4와 B5–B8 방향 교환 (B1–B4는 W 방향, B5–B8은 L 방향)"
이 교환은 9,350 방향이 L이라는 가정에서 적용됐으나, 단면 삽도(B5–B8 선, 교각축 직각 단면)와 재료표가 원래 배치(B1–B4 L 방향, B5–B8 W 방향)와 맞는 것으로 확인되어 되돌림.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 09:48:05 +09:00
ypshimandClaude Haiku 5.5 a026d52799 refactor(rebar): 확대기초 단면의 풍선 클릭 강조 기능 제거
- 풍선 클릭 리스너와 강조 함수 제거, 풍선은 라벨로만 표시
- 캡션에서 "풍선을 누르면" 문구 제거

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 09:44:08 +09:00
ypshimandClaude Haiku 5.5 752de2fd9d feat(rebar): B1–B4와 B5–B8 방향 교환 (B1–B4는 W 방향, B5–B8은 L 방향)
- 재료표(B5–B8 9150 = 9350 − 2c, B1–B4 7600 = 7800 − 2c)와 같은 방향 배정으로 맞춤
- 격자 키를 물리 방향으로 정리: sL = L 방향 간격, sW = W 방향 간격 (기존 sAxis → sL, sPerp → sW)
- B1–B4: L 격자로 개수, 길이 W − 2c. B5–B8: W 격자로 개수, 길이 L − 2c
- B9: 열(L)은 sL, 행(W)은 sW 격자 (물리 격자 일치), 개수 불변
- B11은 L 방향 간격(sL), B12는 W 방향 간격(sW)
- 3D 확대기초 철근과 단면 그림의 역할을 교환 (B1–B4 선, B5–B8 점)
- 철근표 간격과 규칙 값, 설정 라벨을 방향 기준으로 수정
- 테스트 기대값 갱신 (B1–B4 40, B5–B8 31, B6 13646 분할 경고)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-27 09:36:20 +09:00
ypshimandClaude Haiku 5.5 f2fa48913b feat(rebar): B10-2 최하단 단 삭제, 측면 B2 다리선 강조 (모서리 연결)
- B10-2 최하단(z = c_b)도 하면 1단 B2·B4와 같은 높이에서 간섭하므로 삭제 (승인 2026-10-26)
- B10-2: 18 → 16본 (8단 × 2면). 표와 3D가 같은 규칙
- 단면 그림의 측면 B2 다리선을 굵은 주황 실선으로 그려 모서리 연결을 드러냄
- 테스트 기대값 갱신 (B10-2 16)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:21:47 +09:00
ypshimandClaude Haiku 5.5 eb6c7bb4ad fix(rebar): 확대기초 단면 하단 지시선·격자 치수·우측 주석·상단 여백 정리
- 하단 풍선 B2·B4·B3를 각 철근 바로 아래(가운데 기준 좌·중앙·우)에 두고 수직 지시선으로 연결
- 격자 치수 글자를 우측 중앙으로 옮겨 지시선과 겹치지 않게 함
- 뷰박스를 600 × 430으로 넓히고 전체를 20 px 아래로 이동 (우측 주석과 상단 풍선이 잘리지 않음)
- 범례와 캡션을 아래로 이동

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:19:11 +09:00
ypshimandClaude Haiku 5.5 8860fb8231 feat(rebar): B10-1 최하단 단 삭제, 하면 1단 B2·B4가 모서리에서 대체
- B10-1 최하단(z = c_b)은 하면 1단 B2·B4와 같은 높이에서 모서리 간섭이 있어 삭제 (승인 2026-10-26)
- B10-1: 18 → 16본 (8단 × 2면), 길이는 그대로. B1–B4 개수·길이 불변, 새 철근 없음
- 표, 3D, 단면 그림이 같은 규칙을 씀
- 테스트 기대값 갱신 (B10-1 16)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:17:00 +09:00
ypshimandClaude Haiku 5.5 3fe94fa0e1 feat(rebar): 확대기초 단면 최외측 열에 B1–B4 연장선과 측면 피복 다리선 추가
- 최외측 두 열에 B1·B2·B3·B4 점을 모두 표시 (빠진 점은 'ext'로 추가, 표 개수 불변)
- 상단(B1)과 하단(B2·B4) 연장선을 측면 피복 c_s까지 이음
- 측면 피복선에 B2 다리선을 하면 1단에서 B1 높이까지 그림
- 테스트: 다리선 2개, 연장 표시 존재, 기존 개수 테스트 유지

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:12:59 +09:00
ypshimandClaude Haiku 5.5 f793a69d3f fix(rebar): 확대기초 단면 B6 다리 주석을 우측 여백으로, 격자 치수 글자를 치수선 위로
- B6 다리 주석 "B6 다리 → B5 / 높이 1723"을 우측 여백에 두고 B6 다리 끝까지 지시선을 그림
- 격자 치수 "61@125=7625"를 치수선 위로 옮겨 하단 지시선과 겹치지 않게 함

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:08:16 +09:00
ypshimandClaude Haiku 5.5 665b1c948a fix(rebar): 확대기초 단면 제목과 폭 치수 글자 겹침 해소
- 제목을 그림 위(y 20)로 옮겨 말뚝과 지시선과 겹치지 않게 함
- 양끝 피복은 치수선 바깥쪽에, 격자 여유(e)는 각각 안쪽 끝에 놓아 "16216"처럼 붙던 글자를 분리
- 치수선을 한 줄 내림 (Y0+40)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:04:36 +09:00
ypshimandClaude Haiku 5.5 6c7a7ff781 feat(rebar): 확대기초 단면 삽도 2단계 (범례·선 스타일·치수선·다리 주석·기둥·말뚝·실제 비율·탭 4개)
- 선 스타일을 삽도에 맞춤: B5–B8 청록 실선, B1–B4 주황 점, B9 보라 세로선, B10 녹색 점, B11 회색 파선, B12 회색 점
- 범례 5항목 (선 모양별)
- 하단 치수선(피복 · 격자 e · n@s=G · e)과 우측 높이 치수선(상면 피복 · B10 단 · 하면 피복), 화살 끝 표시
- B6 다리 주석 "B6 다리 → B5 높이 (값)"
- 기둥 블록(상부)과 말뚝 머리(하부)를 맥락 그림으로 표시
- 높이 방향을 실제 비율로 그림 (축소 없음)
- 탭 4개 중 "교각축 직각 단면 (폭 W)"만 작동, 나머지는 다음 단계 자리로 비활성

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 18:02:51 +09:00
ypshimandClaude Haiku 5.5 bad220d791 fix(rebar): 조립 철근 B11·B12를 짝수 격자에 배치 (B9 홀수 격자와 겹치지 않음)
- assemblyEvenStart: 짝수 시작칸 중 양끝 여유 차이가 가장 작은 값 선택
- B12(W 방향, n 61)는 시작칸이 1(홀수)이던 것을 2(짝수)로 바꿔 B9 행선과 겹치지 않게 함
- 개수(B11 30, B12 24)와 가운데 정렬(차이 ≤ 1칸)은 그대로, 엇갈림 2칸 유지
- 테스트: 조립 철근 인덱스가 모두 짝수

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:51:10 +09:00
ypshimandClaude Haiku 5.5 5fb2b9938f fix(rebar): 확대기초 단면 B5 풍선이 B1 풍선에 가려지는 문제 수정, 치수 글자 바탕 테두리
- B5 풍선을 B5 선 시작점 쪽(오른쪽)으로 옮김
- 치수 글자에 흰색 테두리(paint-order stroke)를 줘서 지시선이 지나가도 읽힘

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:48:48 +09:00
ypshimandClaude Haiku 5.5 de20b84c00 feat(rebar): 조립 철근(B11·B12)을 격자 가운데에 배치 (양끝 여유 차이 ≤ 1칸)
- assemblyGridIndices: 단마다 k칸 간격, 엇갈림 2칸 유지, 짝수 단 시작칸을 가운데 정렬
- 개수는 그대로 (B11 30, B12 24), 3D와 단면 삽도가 같은 위치를 씀
- 테스트: 양끝 여유 차이 ≤ 1칸, 엇갈림 2칸

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:47:21 +09:00
ypshimandClaude Haiku 5.5 20d8546b6f fix(rebar): 확대기초 단면 풍선 위치를 외곽 밖으로 펼치고 지시선 추가, 캡션을 아래로 이동
- 풍선을 외곽 위·아래에 넓게 배치하고, 각 철근 표시까지 지시선을 그림 (지시선도 같은 data-bar로 강조)
- B2·B4·B3가 겹치던 문제 해결 (풍선 간격 70 px)
- 뷰박스 높이 300, 캡션을 맨 아래로

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:43:53 +09:00
ypshimandClaude Haiku 5.5 c91fe74d9a feat(rebar): 확대기초 교각축 직각 단면(폭 W) 삽도 1단계
- view/footing-section-svg.ts: B5–B8 선, B1–B4 점, B9 행 선, B10-1 측면 점, B11 선, B12 점을 계산 함수 결과로 그림
- 치수: 폭 W, 격자(e · n@s=G · e), 피복, B10 단 수 @ s_v, 높이 방향 축소 표시
- 풍선(B1–B5, B11, B2–B4, B10-1)을 누르면 그 철근만 강조, 다시 누르면 해제
- 테스트: 점·선 개수가 철근표 개수와 같음 (B1·B2·B4, B9 행, B10-1, B11 단, B12)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:42:03 +09:00
ypshimandClaude Haiku 5.5 6957054f4c fix(rebar): 확대기초 n 라벨을 "B11·B12 연직간격 배수"로 변경 (FT02 메시지 포함)
- 변수 이름 n과 계산은 그대로 (조립 단 간격 = n·s_v)
- FT02 메시지도 같은 이름을 씀

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:39:23 +09:00
ypshimandClaude Haiku 5.5 0588ffe3f4 feat(rebar): B11·B12 수평간격을 배수 k 입력으로 (기본 k = 8, 방향은 문서 기준)
- 간격 = k·s: B11은 L 방향 격자(교각축 직각 s), B12는 W 방향 격자(교각축 s). 기본 k = 8 (1000 mm, s = 125)
- 개수는 격자 k칸마다, 조립 단 엇갈림 2칸 유지. 3D 철근도 같은 간격
- 기본 k = 8이므로 P1 기본값의 B11·B12 개수가 60 / 47 → 30 / 24로 바뀜 (k = 4이면 문서값 60 / 47을 재현, 테스트로 확인)
- 패널에 k 두 칸, 규칙 표시에 B11·B12 간격 (k·s)
- FT02를 n·kB11·kB12 정수 검사로 확장

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:34:51 +09:00
ypshimandClaude Haiku 5.5 48e6811600 feat(rebar): 확대기초 패널 규칙 값 표시 (상면·2단, B2·B6 디리, B9, 조립 단 수) 및 "규칙" 표기
- footingRuleValues: 패널 표시값을 계산 함수에서 직접 읽음 (새 공식 없음)
- B2·B6 디리 두 값, 조립 단 수(3단) 표시
- "(고정)"은 Δ₂ 100에만 사용, 4s·2s·상면 2s는 "(규칙)"으로 표기
- 테스트: 기본값 P1에서 250 · 100 · 1723 · 500·250 · 500·3단 @400

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:23:57 +09:00
ypshimandClaude Haiku 5.5 ddd6d55a72 feat(rebar): 격자 실간격을 교각축(B1–B4·B9)과 교각축 직각(B5–B8·B11·B12)으로 나눠 입력
- footing-settings: s → sAxis(교각축) · sPerp(교각축 직각), 범위는 동일 (100–150)
- grid·gridPositions가 방향 키를 받음. B1–B4 grid는 sAxis, B5–B8 grid는 sPerp, B9 행·열은 sAxis, B11·B12는 sPerp
- 철근표 간격·실간격과 근거가 방향별 값을 씀 (B12는 교각축 직각 값, 승인 2026-10-26)
- 3D 확대기초 그림의 위치도 방향별 값을 씀
- 패널 입력 두 칸으로 분리

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:10:31 +09:00
ypshimandClaude Haiku 5.5 c40c58d27f feat(rebar): 확대기초 철근표 간격·실간격을 격자 실간격 s와 s_v에 연동
- B1–B8: 간격 2s, 실간격 s (cycle 2·4·6·8), 실간격 2s (B1·B3·B5·B7)
- B9: 간격 4s, 실간격 2s (엇갈림) · B11·B12: 간격 4s
- B10-1·B10-2: 간격·실간격 = s_v
- 근거: s 또는 s_v가 기본값과 다르면 '입력', 같으면 '기본값'

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:01:14 +09:00
ypshimandClaude Haiku 5.5 5a20a18185 feat(rebar): 확대기초 배근 입력 8개 (피복 3·여유·격자 s·s_v·e_top·n), FT01·FT02 검사
- core/rebar/footing-settings.ts: 입력 정의, 기본값(확대기초철근 (1).md), 범위(제안), 검사 (FT01 범위, FT02 n 정수)
- 확대기초 계산 함수가 설정을 인자로 받음 (기본값 = 기존 값, 기존 호출은 그대로)
- 3D 확대기초 그림의 125·100 하드코딩 제거, 철근표·3D·기둥 층 높이가 같은 설정을 씀
- 패널: 상면·측면·하면 피복을 칸 분리, s_v와 e_top 분리. 고정 규칙(k=2, Δ₂=100, 전단 4s·엇갈림 2s, cycle 교대)과
  B2·B6 디리는 읽기 전용으로 표시
- 기본값에서 P1 결과 불변 (기존 테스트 통과)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:59:08 +09:00
ypshimandClaude Haiku 5.5 550b508e7a feat(rebar): 단면 삽도 순서 P3·P4·P5, 치수선·규격 표기·커플러 지시선
- 단면 순서와 문자를 삽도에 맞춤: A 일반(P3), B 확대기초 안(P4, 반원 2·커플러 2), C 단부(P5, 커플러 1)
- 각 단면에 지름 2000과 125 · 875 치수선 표시 (D, c, r1에서 계산)
- 규격과 간격 표기: P1·P2 S32 Div.46, P3·P4·P5 H19 @ 입력값
- 커플러는 띠철근 위 점에서 지시선을 따라 원 밖의 작은 원으로 표시
- P4 형상과 기본 간격은 문서 값 유지 (입력으로 삽도 값 @100 입력 가능)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:54:27 +09:00
ypshimandClaude Haiku 5.5 caadc2fe77 fix(rebar): 단면 A·B·C를 한 행에 배치
- 기둥 패널의 단면 세 그림을 flex 한 행(nowrap)으로 두고, 좁은 화면에서는 가로 스크롤

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:44:05 +09:00
ypshimandClaude Haiku 5.5 baaec9d7e2 feat(rebar): 기둥 단면 A·B·C (각 그룹 첫 단, 커플러 θ+Δθ/2, P6 현 4본)
- view/column-section-svg.ts: A 일반(P3, 커플러 없음), B 단부(P5, 커플러 1), C 확대기초 안(P4, 반원 2·커플러 2)
- P1·P2는 같은 각도에 r 875·843.2로 배치, 띠철근 둘레·겹침·반원 길이 표시
- P6은 P6 단이 그 높이에 있을 때만 중심을 지나는 현 4본 (0 · 46.96 · 90 · 133.04°)
- 기둥 패널에서 정면 ↔ 단면 A·B·C 전환 (단면 높이는 각 그룹의 첫 단, 새 계산 없음)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:42:50 +09:00
ypshimandClaude Haiku 5.5 c82aff3713 feat(rebar): 기둥 정면 삽도 (P 번호, 단부 배치구간·기초 안 깊이 계산값 표시)
- view/column-elevation-svg.ts: 기둥 정면 SVG. 띠철근 P3·P5·P4·P6, 주철근 P1·P2, 커플러를 계산 결과 그대로 그림
- 번호는 P1–P6 (승인), 간섭(B11–P4)은 표시하지 않음 (검토 제외)
- 단부 배치구간 l_e = max(l_e,min, n·s + s/2)와 기초 안 깊이(0.5·H_f → m4·s)는 기존 계산값을 그림과 캡션에 표시
- 기둥 입력 라벨 K → P 번호

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:37:36 +09:00
ypshimandClaude Haiku 5.5 f619b9ea20 feat(rebar): 기둥 배근 입력 8개 (피복·띠철근 K3/K5/K4·K6·커플러·Δz·n_div), CL01·CL02 검사
- core/rebar/column-settings.ts: 입력 정의, 기본값(기둥철근 (1).md), 범위(제안), 검사 (CL01 범위, CL02 n_div 홀수)
- 주철근 하단 갈고리는 고정 (입력 없음)
- 기둥 탭 패널: 적용 버튼으로 반영, 계산 결과(K2 내측 r, 주철근·커플러 수량) 표시
- P1·P2 등분 수, P3·P5·P4·P6 간격, 커플러 간격·상승을 철근표 간격·비고와 근거(기본값/입력)에 연동
- 3D 주철근 개수도 n_div 입력을 사용 (COLUMN_P1 하드코딩 제거)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:22:47 +09:00
ypshimandClaude Haiku 5.5 496e0ea4e5 feat(rebar): 상면 주철근(C1–C6) 이음 무시/반영, 위치 기둥 중심/단부
- 기본 '이음 무시' (사양 결정). '반영'이면 정척(12000) 초과 철근을 l_s 겹침 2조각으로 나눔
- 위치: 기둥 중심 = 전체의 절반, 단부 = 정척 안에서 가장 끝 쪽 (짧은 조각 = 전체 + l_s − 12000, 긴 조각 = 12000)
- 철근표 조각 목록과 비고, 3D 두 조각(l_s 겹침)에 반영
- STANDARD_BAR를 common.ts로 옮겨 순환 import 방지

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:14:23 +09:00
ypshimandClaude Haiku 5.5 72053be420 feat(rebar): C15·C16 폭 간격을 2 × 주철근 기본간격에 연동
- stairBars가 pitch를 받는다 (기본 2 × 기본간격 = 250, P1 그대로)
- 3D와 철근표가 같은 pitch를 쓴다
- 철근표 간격·실간격: 2 × 기본간격, 근거는 기본값/입력

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 16:04:31 +09:00
ypshimandClaude Haiku 5.5 3cfbdf62f6 feat(rebar): 철근표 간격·실간격을 입력과 연동, 근거는 기본값/입력
- C1–C8: 간격 2 × 주철근 기본간격, 실간격 기본간격
- C9·C11 · C10 · C12·C13 · C14: 전단·측면·C14 간격 입력
- S1·S2: 블록 철근 간격 입력
- 근거: 관련 입력이 모두 기본값이면 '기본값', 하나라도 바뀌면 '입력'
- 입력이 없는 행(C15·C16, P3~P5, 커플러)은 기존 고정값 유지

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:54:47 +09:00
ypshimandClaude Haiku 5.5 1e6b8db7e9 feat(rebar): 주철근 기본간격·끝단 여유를 입력과 연동, CP04 홀수 개수 경고
- widthLayout이 코핑 배근 입력(mainSpacing, mainEndGap)을 받는다. 결과에 spacing 필드 추가
- 3D 주철근 위치의 125 하드코딩 제거 (철근표와 3D가 같은 간격을 씀)
- CP04: 주철근 개수 n+3이 홀수면 cycle-1·cycle-2 분할 불가 경고 (적용은 막지 않음)
- P1 기본값(125 · 80)에서는 결과와 경고 없음 (테스트로 확인)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:51:26 +09:00
ypshimandClaude Haiku 5.5 d2c5f90092 fix(rebar): 상면 단 가로 간격을 d(H29, 28.6 mm)로 수정
- 단마다 양끝이 안으로 들어가는 양을 2d에서 d로 변경
- 상면 단 길이 12744 / 12686.8 / 12629.6 (기존 12744 / 12629.6 / 12515.2)
- 3D 상면 주철근의 굽힘 시작점도 같은 값을 쓴다

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:45:51 +09:00
ypshimandClaude Haiku 5.5 2acb427bab feat(rebar): 상면 주철근 단 간격(세로) 입력 100 mm, 가로는 2d 고정
- 세로 단 간격은 입력(기본 100, 범위 80–120)으로 상면 C1–C6, C14 상면, 기둥 C3 높이에 쓴다
- 가로 단 간격은 2d(H29, 57.2 mm)로 고정 (코핑철근.md의 s_lay 하나를 둘로 나눔)
- P1 기준 값 갱신: 상면 높이 43.284 / 43.184 / 43.084, C14 상면 43.208 / 43.108, P1 위 끝 zTop1 14776

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:42:40 +09:00
ypshimandClaude Haiku 5.5 9c93a6aa01 feat(rebar): 코핑 배근 입력 12개 · CP01·CP02 검사 · 적용 버튼
- core/rebar/coping-settings.ts: 입력 정의, 기본값(코핑철근.md), 범위(코핑_입력범위_제안.md), 검사 함수
- 다리 수는 4·6·8 목록으로 두고 홀수는 CP02로 막음
- 값은 적용 버튼을 누를 때만 draft에 쓰고 다시 생성 (범위 밖이면 반영하지 않음)
- PierInput.copingRebar, 모델 copingRebar, 변경 추적 키 추가

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:26:20 +09:00
ypshimandClaude Haiku 5.5 ec402e22d7 feat(rebar): 단면·폐합 at two fixed stations side by side (단부 0.3 m, first column centre)
- The station input is removed. The section shows the 단부 (first shear
  station, from the 3D bar records) and the first column centre, side by side.
- The 상면 간격 label is removed.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:15:47 +09:00
ypshimandClaude Haiku 5.5 64539c63d6 feat(rebar): 단면·폐합 section shows only C1–C8 and C12·C13, with the top spacing labelled
- Other bars (C9–C11, C14–C16) are left out of the section; bubbles only for C1–6, C7·8, C12·13.
- The top-row chain carries the label 상면 간격.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:09:38 +09:00
ypshimandClaude Haiku 5.5 d5bf02e36b feat(rebar): 단면·폐합 section with the top-row and side-row chains and bar-group bubbles
- Top row (C1–C8) spacing along the 교축 from chainDims, between the coping's
  two long edges (±B/2).
- Side rows (C12·C13) along the EL, from the coping top EL down to the lowest
  side bar.
- One bubble per bar group cut at the station, with a leader to its bars.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:05:37 +09:00
ypshimandClaude Haiku 5.5 41c1ecd340 fix(rebar): draw the lower 정면 chain and the 기둥 중심 tick at the column position
- The chain is computed from the column centre (0) and is now drawn at the
  column's position on the coping (x = column s), so the 0 sits on the column.
- P1: the 10@1000 span runs from 1000 to 11000 mm, centred on the column at 6000 mm.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 15:01:08 +09:00
ypshimandClaude Haiku 5.5 a4ae6de485 fix(rebar): 정면 dimension labels larger and the lines spaced clear of the 코핑 길이 text
- The two chains are raised and their labels enlarged (220 mm).
- 코핑 길이 sits above both chains; 기둥 중심 has its own line between them.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:57:53 +09:00
ypshimandClaude Haiku 5.5 a18a15db7b feat(rebar): 정면 dimension chains computed from the 3D bar positions (기둥 중심 = 0)
- chainDims groups the repeated gaps (n@pitch = total) and writes a single gap as its length.
- Top chain: the 전단·띠 stations (C9 @250, C10 @300) from the coping ends.
- Lower chain: the upper C14 bars measured from the column centre (0), so
  the 10@1000 span starts at the column centre.
- Stations are the lowest s of their pieces; pieces within 160 mm are one station.
- P1 gives the 시안 values: 300 · 18@250=4500 · 8@300=2400 · 18@250=4500 · 300 and
  900 · 10@1000=10000 · 900.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:54:45 +09:00
ypshimandClaude Haiku 5.5 c0d46220fd feat(rebar): second dimension line and legend on the coping 정면 (시안 ③)
- The column-centre line 900 · 10@1000=10000 (기둥 중심부터) · 900, from the
  design values, under the first dimension.
- A legend of the bar groups and their colours under the drawing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:46:38 +09:00
ypshimandClaude Haiku 5.5 a509d00532 feat(rebar): bar-group bubbles and the length dimension on the coping 정면 (시안 ③)
- Nine bubbles (C1–6, C12·13, C9, C10, C11, C7·8, C14, C15, C16), each with a
  leader to the middle of its bars.
- The top dimension 300 · 18@250=4500 · 8@300=2400 · 18@250=4500 · 300, drawn
  only when it adds up to the coping length.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:45:16 +09:00
ypshimandClaude Haiku 5.5 32cf01a29f fix(rebar): section labels once per bar and spots once
- The coping section listed every piece of a bar as its own crossing, so the
  same spot and name were drawn many times. Each spot is drawn once and each
  bar name is written once.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:28:33 +09:00
ypshimandClaude Haiku 5.5 57f7c148ec feat(rebar): coping front view and 단면·폐합 section from the 3D bar records (승인 2026-10-26)
- rebar3d records every bar (name, stretch, local points, diameter) next to its
  mesh, so the 2D drawings use the same data as the 3D view.
- view/coping-rebar-svg.ts: the 정면 (along the coping length, EL vertical) and
  the 단면·폐합 at a chosen station (the bars crossing it, C9–C11 loops included).
- ③ coping tab: 정면 / 단면·폐합 toggle and the station input.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:27:03 +09:00
ypshimandClaude Haiku 5.5 32e8dad7dc fix(rebar): S1 layout dimensions on the outer side of each block in the plan
- The front block's S1 layout goes on the left and the back block's on the right,
  so the text no longer falls into the gap between the two blocks.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:22:00 +09:00
ypshimandClaude Haiku 5.5 f1b2a0241d fix(rebar): turn the S1 layout dimension to run along the 교각축 beside the block
- The S1 layout runs along the 교각축 (vertical in the plan), so its text sits
  beside the block, turned to match, instead of across the gap between blocks.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:21:02 +09:00
ypshimandClaude Haiku 5.5 fa1ec3e864 feat(rebar): dimensions on the block rebar plan
- The S2 layout along the 교축 (below the block), the S1 layout along the 교각축
  (beside it), and the block width, in the same form as the C–C section.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:19:52 +09:00
ypshimandClaude Haiku 5.5 dd590b899c feat(rebar): plan view of the block rebar with the 단면/평면 switch (승인 2026-10-26)
- view/block-rebar-plan-svg.ts: the selected pair from above — S2 lines along the
  교각축 (spaced at S2 across the 교축), S1 lines along the 교축 (spaced at S1),
  each end a dot (leg); the bar sets carry the row numbers only (S1, S2).
- The ③ card switches between the C–C section and the plan.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:18:37 +09:00
ypshimandClaude Haiku 5.5 521979b437 fix(rebar): cut the C–C section through the selected pair only
- The section was drawing every bearing on the same 교축 line, so the blocks and
  dimension text stacked on top of each other. It now cuts through the selected
  pair (①·⑥ …), which the ③ card also shows as chips, shared with ②.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:14:31 +09:00
ypshimandClaude Haiku 5.5 38bb26eda5 feat(rebar): block rebar settings card and C–C section on the ③ bearing tab
- Six inputs with their ranges and P1 defaults; a change regenerates the pier.
- The 적용 블럭 line shows the blocks (분리 n개 or 일체 n쌍, 전체).
- view/block-rebar-svg.ts: the section C–C along the 교축 with the S2 dots, the
  S1 lines and legs, and the dimensions (block widths, the S2 layout).
- 받침블럭 철근 설정 is tracked for changes (defaults vs the current draft).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:12:36 +09:00
ypshimandClaude Haiku 5.5 a6f362df56 feat(rebar): range checks for the block rebar settings (승인 2026-10-26)
- RB01 a setting outside its range (cover 50–100, side cover 50–100, first gap
  0–150, spacing S1/S2 100–200, leg 500–1000); RB02 S1 depth at or above the
  block height; RB03 the legs do not reach into the coping.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:10:49 +09:00
ypshimandClaude Haiku 5.5 e1497176ea feat(rebar): block rebar settings as input (S1·S2 spacing separate, S1 depth from the cover and bar diameters)
- PierInput.blockRebar (partial): cover top, side cover, first gap, spacing S1
  and S2 (separate), leg length. Defaults are the P1 values, so P1 is unchanged.
- S2 depth = top cover; S1 depth = top cover + S1/2 + S2/2 (H19: 69.1 at the default).
- The model carries the settings; the bearing-block rebar, the 3D bars, and the
  summary use them.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 14:08:58 +09:00
ypshimandClaude Haiku 5.5 c4d4957dd2 feat(bearing): show each bearing's 방위 in the plan and turn the overlays with it
- Blocks, solplates, and the dashed drawing outlines are turned by the bearing's
  방위 (rowSkewDeg), the same turn as the 3D block; each bearing is labelled
  with its 방위 in degrees.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 13:24:20 +09:00
ypshimandClaude Haiku 5.5 9b3b465bfa fix(bearing): show the offset between the two bearings as it is in the plan
- Blocks, solplates, and bearing centres sit at their real 교각축 positions;
  the pair's offset is not aligned away. The 편심 is written on the figure.
- C4 and C5 dimensions run from the block edges to the bearings.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 13:22:11 +09:00
ypshimandClaude Haiku 5.5 2f67efd449 fix(bearing): C4 and C5 are the 교각축 distances from the bearing to the block edges (승인 2026-10-26)
- bearingEdgeDistances measures along the 교각축: 분리 600 / 600; 일체 from the
  pair block centred on the mean 교각축 position (P1 outer margins 557).
- Table headings updated; C1 · C2 · C3 on the plan are measured on the 교축 from the drawn positions.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 13:17:50 +09:00
ypshimandClaude Haiku 5.5 29acfba1e1 feat(bearing): C4 and C5 as vertical dimensions on the left, as in the 시안
- C4 runs from the block top edge to the bearing row, C5 from the bearing row
  to the bottom edge. The values are the model's C4 and C5.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 13:16:31 +09:00
ypshimandClaude Haiku 5.5 da58fbfdbe feat(bearing): plan with the blocks on one row, axis arrows, and C1·C2·C3 dimensions
- Blocks and solplates are drawn on one line across the 교축; the 교각축 offset
  of the bearings is written as text.
- Arrows for the 교축 (horizontal) and the 교각축 방향 (vertical).
- Dimensions along the bottom: C1 (bearing to block edge), C2 (between the
  bearings), C1, and C3 (block span).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 13:14:12 +09:00
ypshimandClaude Haiku 5.5 0b847e7547 feat(bearing): section and solplate detail drawings with the drawing values overlaid (승인 2026-10-26)
- view/bearing-section-svg.ts: the pair's elevation — blocks (일체: one stepped
  outline), mortar, bearing body and solplate per bearing from the model; the
  drawing heights overlaid dashed. EL.X at the mortar top, E = h1 + h2 + h3 + h4.
- view/solplate-svg.ts: per bearing, the plan L × W and the taper T1 · T2
  (S %), with the drawing values dashed.
- ② bearing card: section figure and the two solplate figures under the plan.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 12:33:05 +09:00
ypshimandClaude Haiku 5.5 0708aa1354 fix(bearing): show only the outer block margins as C4 and C5
- A 일체 pair's inner sides face the other bearing, so they are not C4 or C5:
  they are null and shown as "—" in the 배치 규칙 table.
- The table headings now describe the 교축 margins (bearing to the outer block edge).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 12:30:21 +09:00
ypshimandClaude Haiku 5.5 9b79083d50 fix(bearing): C4·C5 are the 교축 distances from the bearing to the block edges (승인 2026-10-26)
- bearingEdgeDistances now reads the block geometry: 분리 1200 blocks are
  centred on the bearing (600 / 600); 일체 uses the pair's 2500 block (outer
  margins 601, within the 5 mm tolerance of 600).
- The plan labels C4 and C5 from these values; the coping-edge definition is removed.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 12:25:15 +09:00
ypshimandClaude Haiku 5.5 b3a62850ab feat(bearing): plan of a pair with block outline and overlaid drawing values (승인 2026-10-26)
- C4·C5 measured across the coping width (교각축 직각): the two coping edges
  at ±B/2 to the bearing centre. The former along-the-axis definition is replaced.
- view/bearing-plan-svg.ts: the plan of one pair with the model's solplates
  and the block outline(s) (일체: one 2500 × 1200; 분리: two 1200 × 1200), and
  the drawing A/B overlaid as dashed outlines.
- ② bearing card: 상세 보기 pair chips (①·⑥ …) and the overlay toggle.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 12:19:14 +09:00
ypshimandClaude Haiku 5.5 43a18182f3 feat(bearing): 일체 block as one stepped block per pair, with its rebar (승인 2026-10-26)
- integrated-block.ts: per pair (전열 k · 후열 k) one block centred on the
  pair midpoint, 2500 across the 교축 and 1200 along the 교각축, with a
  stepped top (each half to its own bearing row top). Only when 일체 is chosen
  and every pair is within 100 mm; otherwise 분리 is kept (B02).
- Rebar: S2 19 bars at 125 across the 2500 (10 front half, 9 back half), each
  leg from its half's top; S1 8 bars across the 1200, 3800 long, depth from
  the lower top. Totals per pier: S1 40, S2 95 (분리: 80 / 80).
- Scene and 3D rebar draw the stepped blocks instead of the per-bearing blocks.
- The per-bearing blocks stay for the solplate, the pads, and the body.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 12:02:33 +09:00
ypshimandClaude Haiku 5.5 2af5cfb144 feat(bearing): 일체 choice gated by the pair eccentricity rule (승인 2026-10-26)
- PierInput.bearingLayout: 분리 (default) or 일체, tracked for changes.
- 일체 is selectable only when there is at least one pair and every pair is
  within 100 mm; otherwise the chip is disabled with the reason.
- Validation: B01 (info) when 일체 is chosen and allowed, the block shape is
  still the 분리 shape; B02 (warning) when it is not allowed and the model
  falls back to 분리.
- The 일체 block shape (2500 × 1200) is not modelled yet.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 11:56:26 +09:00
ypshimandClaude Haiku 5.5 cd18665d6a feat(bearing): model C4/C5 and the front–back pair eccentricity (승인 2026-10-26)
- C4/C5 = distance from the coping edge to the bearing centre along the
  coping length, from the model; the drawing value is for comparison only.
- A pair is a front and back bearing of the same order within their row. A
  pair with an eccentricity above 100 mm forbids 일체 (분리 first).
- ② bearing card: read-only table of C4/C5 and the pair eccentricities.
- The 일체 block model is not built yet.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 11:49:27 +09:00
ypshimandClaude Haiku 5.5 d77f2bfd17 feat(bearing): 받침 종류·용량 as a text input (default 탄성받침)
- PierInput.bearingType: text, absent = 탄성받침. Tracked for changes, so it
  can be reverted. Saved in the project; no rule yet, so it does not change the model.
- Shown on the ② bearing card above the 공통 규칙.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 11:39:28 +09:00
ypshimandClaude Haiku 5.5 b6e7f36091 feat(ground): 해상 selectable with MSL levels, 고조위·저조위, and checks
- Rules confirmed (승인 2026-10-26): datum MSL; 고조위 HWL and 저조위 LWL as
  two levels; 세굴 깊이 as for 하상; 파랑과 선박 하중 excluded from this scope.
- Checks: G13 levels missing, G10 해저면 not below 고조위, G11 저조위 not
  below 고조위, G14 pile wall at or below the corrosion allowance reference.
- CORROSION_ALLOWANCE_MM = 1 is a PLACEHOLDER reference (not in the RAG
  documents); the card and G14 mark it as to be confirmed.
- Card: the 해상 inputs; the section draws 고조위 (solid), 저조위 (dashed),
  and labels the ground line 해저면 EL.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 11:11:31 +09:00
ypshimandClaude Haiku 5.5 26a5aff517 feat(ground): 하상 selectable; 설계홍수위 and 세굴 깊이 for 하상
- shape-options: a per-option "confirmed" flag; 하상 is confirmed, 해상 is not.
- The 위치 chips store the choice in the pier's draft; 선택 shows it.
- 하상: the groundwater inputs give way to 설계홍수위 DHWL (floodLevelEl) and
  세굴 깊이 (scourDepthM). The groundwater value is kept (남겨두기).
- Checks: G07 DHWL missing, G08 DHWL below the 지반고, G09 scour negative or
  the scour line below the footing bottom. The groundwater check is skipped for 하상.
- Section: the DHWL as a solid line and the 세굴선 dashed.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 11:06:10 +09:00
ypshimandClaude Haiku 5.5 7b5517e312 feat(ground): N value per layer row (text, blow count or 타수/관입량 mm)
- StrataRow.nValue: text. "23" is a blow count (0–100), "50/5" a refusal
  (50 blows for 5 mm, 1–300 mm). Empty means not known yet.
- G06 (warning): a malformed N value. Strict, because the values will feed the
  bearing-capacity and liquefaction checks.
- The layer table has an N값 column; the project file checks that the rows
  are well formed.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 10:48:37 +09:00
ypshimandClaude Haiku 5.5 7dd59dfc6c fix(ground): one 위치 control on the card and clearer layer labels
- The 위치 buttons duplicated the 형상 옵션 chips above the card. The chips
  stay the one place for 위치 (only the default is selectable until Q6).
- The water-level row lays out as a flex row, so its label and input do not
  overlap.
- The 연암 상면 caption sits just under the line instead of over the band label.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 10:41:21 +09:00
ypshimandClaude Haiku 5.5 325c841733 feat(ground): pile-tip embedment check and soil layers from the ground model
- ground.ts: G04 when a pile tip is above the 연암 상면 minus 1.0 × D; G05
  (info) when layers are entered but there is no 연암 row. No message while
  no layers are entered at all.
- ground-model.ts: reads the Python soil.layers as strata rows; the project
  file keeps and checks them.
- ② card: a button fills the layer rows from the ground model for the pier.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 10:35:41 +09:00
ypshimandClaude Haiku 5.5 16ab317094 feat(ground): 지반·지층 card inputs, layer rows, water level, section drawing
- types/ground.ts: 위치 (육상·하상·해상), 지하수위 고려 and EL, 지층 행
  (name and 하단 EL, from the top down). Checks G01 (layer order), G02 (water
  level range), G03 (layer name).
- The 지반고 still feeds the soil cover check; the layer rows and water level
  are inputs and do not change the 3D model.
- view/ground-svg.ts: the 삽도 drawn from the inputs and the generated
  footings and piles on one EL scale.
- 일괄 적용 copies 위치 and 지하수위 to the checked piers (속성 복사 item,
  off by default). Changes list shows arrays and booleans as text.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 10:11:42 +09:00
ypshimandClaude Haiku 5.5 0e70cfb969 refactor(ground): remove the unversioned-file fallback
- A file without a schema number is refused again; the example output in
  RAG/pierzainer_ground now has schema 2, so the temporary path is not needed.
- The legacy fixture is removed; tests cover the missing and null schema
  numbers and a pier without a ground object.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 18:09:50 +09:00
ypshimandClaude Haiku 5.5 bfd41d7c8d feat(ground): draw the terrain grid around the piers in the 3D view
- ground-model.ts: read schema 2 terrain_grid (origin, step, nx, ny, z),
  checked the same way as the stored project form; schema 1 is still read.
- view/terrain.ts: the grid as a mesh in pier-scene coordinates
  (x = E − pivot E, z = −(N − pivot N), y = EL), same as the pier frame.
  Cells with a missing corner are not drawn.
- scene.ts: draws the terrain in place of the 60 m plane when the model has a
  grid; the camera fits the members, not the terrain.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 17:57:30 +09:00
ypshimandClaude Haiku 5.5 be76425c8f feat(ground): accept ground_model.json written before the schema number
- A file with no `schema` key is read as schema 1, but every pier must have a
  `ground` object, so a renamed field is refused instead of loading as empty.
- `schema` null or any other number is still refused.
- The project file keeps the normalised model and checks it with its own
  check (checkStoredGroundModel), so a saved model reopens.
- Temporary: remove the no-schema branch once examples/out is regenerated.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 17:41:24 +09:00
ypshimandClaude Haiku 5.5 c3606011b5 feat(ground): load ground_model.json and apply the pier-centre ground EL
- ground-model.ts: read and check schema 1 of the Python ground model.
- ② 지반·지층 card: import the json, show the DTM value beside the excel
  value, and apply it only when the user presses the button (tracked as an
  override, revertible).
- groundEl becomes an editable, tracked input; the project file keeps the
  imported model and checks it on open.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:48:27 +09:00
ypshim 304b350481 Revert "fix(rebar): warn when the pile spacing along a 열 is above the 2250 mm maximum"
This reverts commit d61e5d082f.
2026-10-23 16:20:44 +09:00
ypshimandClaude Haiku 5.5 d61e5d082f fix(rebar): warn when the pile spacing along a 열 is above the 2250 mm maximum
The card only checked the minimum spacing. A 12000 mm footing with 5 piles per 열 gives 2650 mm, above the maximum. The card
now marks such a row ("최대 2250 mm를 넘습니다. 본수를 늘리세요") and the alert list gets a warning (P02). Tests check 5 and 6
piles on a 12000 mm footing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:20:37 +09:00
ypshimandClaude Haiku 5.5 65f8ca2279 test(rebar): the footing rebar follows the footing inputs (L, W, H); P1 unchanged
The B-bar counts are computed from the footing dimensions already, so no formula change was needed. Tests check the P1
values, that a wider and longer footing adds B1–B8 bars, and that a 2200 mm height builds rebar and 3D.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:16:47 +09:00
ypshimandClaude Haiku 5.5 174a026cc1 feat(view): dimension lines on the plan — overall length and width, and the pile chains (끝단 거리 700, 간격 2250)
The plan has overall dimension lines (length along the top, width at the right) and two chains: along the length, the
distances from the footing edge to the first pile and between piles; across the width, the same for the pile rows. The
chains are read from the pile positions, so they follow the layout.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:15:39 +09:00
ypshimandClaude Haiku 5.5 6050435af1 feat(view): dimension lines on the 정면 — footing length above, h1 at the right, the visible pile length at the left
The side view has dimension lines with 45° ticks: the footing length (mm) above the footing, the footing height h1 at its right,
and the visible pile length (끊음) at its left. The margins are wider (1.5 m) for the labels; the plan uses the same margin so the
two views stay aligned. The old h1 label is replaced by the dimension label.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:14:08 +09:00
ypshimandClaude Haiku 5.5 f76bfc9d5a fix(view): footing labels read at about 11 px (0.5 m in the 22 px/m drawing)
The dimension labels were 0.28 m, about 6 px on screen. They are 0.5 m now, so the mm values can be read.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:12:12 +09:00
ypshimandClaude Haiku 5.5 c0a4ce57ad fix(view): the 끊음 marks are short "//" breaks, and the pile label sits clear below them
The break lines ran across the members at a slant. They are now two short slanted strokes on the column stub and across the
pile group, and the pile label is moved below the break.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:11:21 +09:00
ypshimandClaude Haiku 5.5 a2e4648f7b feat(view): side view (정면) to the right of the footing plan on one scale; 본수 card, plan and side in one row
Plan and side use the same scale (22 px per m) and share their horizontal extent, so the footing lines up. The side view breaks
the column (3 m above the footing) and the piles (4 m below it) so its height stays near the plan's. The row is three columns
from 1100 px, the side view drops to its own row between 800 and 1100 px, and it stacks below 800 px.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:10:14 +09:00
ypshimandClaude Haiku 5.5 4477bbe52c feat(view): the 열별 본수 card sits beside the footing plan on ② (grid, stacks on narrow screens)
The pile-count card (−/+ and the 20본 total) is on the left and the plan on the right, in one row; the side view is below.
Changing a count is now seen on the plan next to it. The layout stacks below 800 px.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:07:52 +09:00
ypshimandClaude Haiku 5.5 675f8124ca feat(view): 확대기초·말뚝 plan and side drawings on ② (2단계), drawn from the model
The footing card shows a plan (footing rectangle, pile circles, column, pier axis, mm labels) and an elevation (footing,
piles to their tips, column, h1 and pile length). The drawings are SVG strings built from the model, so they follow the
inputs. θ is noted as not yet applied. Tests check the pile count, the mm labels and the width input.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:02:37 +09:00
ypshimandClaude Haiku 5.5 df19cc47e9 feat(view): 확대기초·말뚝 inputs on ② (입력만): footing L, W, h1, blinding margin and thickness, steel and PHC pile lists
The footing card takes L, W, h1 (default 2000), the blinding margin on each side (100) and thickness (100). The pile is picked
from the 강관 or PHC list by outer diameter and wall; the inner diameter, area and weight are read from the list. Defaults are
the 1단계 constants, so P1 is unchanged. The model reads them (footing width, height, blinding, pile diameter; the footing
length for grouping). 복합 말뚝 and the rule-pending items stay disabled; the footing rebar is not yet tied to these
inputs (1·2단계 후).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:01:02 +09:00
ypshimandClaude Haiku 5.5 e580677887 fix(view): round the lengths shown in the 재료표 and in the Excel rows to 0.1 mm
Single-piece lengths such as the B9 and C7 pieces showed long unrounded decimals (2128.1174619702915). They are rounded to
0.1 mm for display and in the Excel rows; the totals are unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 15:54:17 +09:00
ypshimandClaude Haiku 5.5 65c53f2b5d feat(view,rebar): column diameter D as a free input on ② (1200–3000 mm, 50 mm steps), with three checks
D is an input on the column card (default 2000 mm). The 3D column, the piles of a cast-in pier and the column rebar follow it;
n_div stays 46. Three checks run on each regenerate and appear in 알림: D below the Level width (2100), D + 2c within the
coping width, and the 주철근 arc spacing ≥ max(1.5·d_b, 40). Spec §5.2 records the rule (approved 2026-10-23).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 15:50:52 +09:00
ypshimandClaude Haiku 5.5 a6b92ae341 fix(view): pick the solplate table's header by its row (L, W, T, T1, T2), not by the first "S(%)" label
The drawing has two "S(%)" labels; the first one in the file belonged to another table, so the solplate header was missing.
The header is now the S(%) label with the most solplate column names on its row. The full 운곡교 교각도(2) DXF reads all ten
solplate rows; a test adds a stray label.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:58:12 +09:00
ypshimandClaude Haiku 5.5 22fd1dc5f4 feat(view): solplate taper across the 교각축 직각 (thick T1 at the (−) side); 교량받침 본체 as a box
The solplate's L (A + margin) runs across the 교각축 직각 and its W (B + margin) along the 교축; the top tapers across L with
T1 at the (−) side (T1 = T + L·|S|/200). The 교량받침 본체 is one box per bearing: the solplate plan less 100 mm on each
side, from the mortar top (EL.X) up h3 = 181 mm, turned with the bearing row. It is shown with the bearing group.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:56:26 +09:00
ypshimandClaude Haiku 5.5 a108a76707 fix(view): the reference fill also sets A, B and S, so the solplate appears; warn for bearings without solplate values
"도면값 채우기" set only EL.X, h1 and h2, so no solplate was drawn. It now also sets A, B and the solplate slope S from the
reference values. The bearing card warns how many bearings lack A, B or S.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:49:50 +09:00
ypshimandClaude Haiku 5.5 a50f4f5ee5 feat(view): solplate in the 3D model (2단계): wedges from the drawing's A, B, S; read the solplate table from DXF
Each bearing gets a solplate wedge: tapered along the 교축 with T1 on the 시점 side, underside at the bearing top (block
top + h3). A, B come from the drawing's ELEVATION table, S and T1/T2 from the SOLPLATE table (NO, S(%), L, W, T, T1, T2),
read by position. The 공통 규칙 (T 30, margin 100, h3 181) feed the plan; changing them regenerates the piers. A new
"솔플레이트" part can be shown or hidden. A solplate table is read only when its S values are found; a missing S is reported.
Also commits the option-1 test change (drawing EL.X minus Excel z).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:46:53 +09:00
ypshimandClaude Haiku 5.5 1d8746d533 feat(rebar): solplate geometry (pure) — tapered along the 교축, thick end T1 on the 시점 side
Per bearing: L = A + margin along the 교축 (s), W = B + margin across it; the underside is the bearing top (block top
EL.X + h3); the top tapers from T1 = T + L·|S|/200 at the 시점 side (−s) to T2 = T − L·|S|/200 at the 종점 side, so
T1 + T2 = 2T and the volume is L·W·T. Corners follow the bearing row (rowSkew). Tests cover L, W, T1, T2, the underside,
the volume and the centring. The model and the 3D do not use it yet.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:42:31 +09:00
ypshimandClaude Haiku 5.5 55abc4be13 fix(view): find the table's header and No column by their place on the table row, not by the first label in the file
The drawing has other "EL.X" and "NO" labels. The header is now the EL.X label with the most table column names to its right
on the same row; the No header is the NO label on that row. The full 운곡교 교각도(2) DXF reads all ten bearings (EL.X, h1, h2)
without errors. Tests add the distractor labels.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:36:50 +09:00
ypshimandClaude Haiku 5.5 4048c326e3 feat(view): read the bearing ELEVATION TABLE from a DXF drawing (교각도(2) P1) by position
The reader takes TEXT and MTEXT entities (x, y, text). The EL.X header row names the columns; the No column holds the
bearing numbers; each value is the nearest entry under its header on the same row. On the 운곡교 교각도(2) drawing all ten
bearings read back the reference values (EL.X, h1, h2). The 도면 불러오기 button accepts .dxf as well as sheets. The test
fixture holds only the table's text entries.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:34:33 +09:00
ypshimandClaude Haiku 5.5 6f32bd96c4 feat(view): 도면 불러오기 — read the bearing drawing values from an xlsx or csv sheet on ②
The sheet needs the header names No, EL.X, h1 and h2 (case, spaces, dots and units in parentheses are ignored). Rows are
checked: No must be a unique positive integer, EL.X must be in metres (30–100), h1 and h2 must be positive mm up to 1000.
Any error stops the import with the first messages; a valid sheet fills this pier's drawing values and regenerates the
pier. The parser is pure and tested.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:28:06 +09:00
ypshimandClaude Haiku 5.5 e4e141c801 feat(rebar,view): 받침 기준 — project-wide choice between Excel z (default) and drawing EL.X, with per-bearing drawing input on ②
The project has one basis: 엑셀 z (default) or 도면 EL.X. On ②, the bearing card lists EL.X, h1 and h2 for each bearing
(per pier), with a button to fill the reference values. With the drawing basis the model takes the drawing EL.X as the
bearing height; the coping tops stay within the 5 mm tolerance, the front block is 164 mm and the back 139 mm (excluding the
pad). The check compares EL.X − h1 − h2 with the Excel-basis coping top. The basis and the drawing values are saved in the
project file (optional fields). Changes regenerate every pier at once.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:25:44 +09:00
ypshimandClaude Haiku 5.5 802a1eab97 fix(view): EL.X = block top including the 50 mm mortar; coping top = EL.X − h1 − h2 (matches the model)
With this definition the drawing's coping top matches the model's coping top to within 1 mm on all ten bearings. The earlier
0.211 m offset came from reading EL.X as the solplate top, which was wrong. The reference table now uses EL.X − h1 − h2,
and the check tests the match.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:17:12 +09:00
ypshimandClaude Haiku 5.5 553c696638 feat(view): bearing 공통 규칙 inputs (mortar h2, bearing h3, solplate T, margin) and recalculated E, L, W, T1, T2
On the bearing card, four inputs drive E = h1 + h2 + h3 + h4, L = A + margin, W = B + margin and T1/T2 = T ± L·|S|/2. The
defaults are the drawing values, so every row gives back the drawing values; changed rows are marked. The values are screen
state for now and do not change the model or the project file (Q16 stays open).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:12:36 +09:00
ypshimandClaude Haiku 5.5 64795e0a19 fix(view): solplate reference shows centre T = 30 with the (−) and (+) side thicknesses (taper along the axis)
The solplate tapers along the bridge axis. T is the centre thickness (30), T1 the thickness on the 교각축 직각 (−) side
(38) and T2 on the (+) side (22); T1 + T2 = 2T. The table's T column had shown the (−) side value, so T is now 30 on every
row. A test checks T1 + T2 = 2T.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:10:23 +09:00
ypshimandClaude Haiku 5.5 ee6848c418 feat(view): bearing reference tables on ② (drawing values, read-only, not used in the model)
The P1 상세도 ELEVATION TABLE and 솔플레이트 TABLE are shown on the bearing card. The model does not use them (Q16). The
ELEVATION table compares the drawing's coping top (EL.X − E) with the model's coping top; the difference is a constant
0.211 m on all ten bearings. The solplate table checks T1 and T2 against T ± L·|S|/2 with the 공통 규칙 T = 30 mm; all
rows match. Tests check E = h1+h2+h3+h4, L and W, the T1/T2 rule, and the constant offset.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 14:02:27 +09:00
ypshimandClaude Haiku 5.5 4d5e3cc04e feat(rebar): P3 and P6 end at the coping middle level; e_top computed from it
The coping middle level is (Level underside + step top)/2. P3's top and P6's upper limit are this level, and e_top is the
step top minus it (P1: 1322, replacing the 1623 reverse-engineered value). On P1 P3 goes from 38 to 39 ties and P6 stays at
8 levels. With taper h2 = 3000 the middle level is 13275: P3 37 ties, P6 8 levels (32 bars), e_top 2072.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 13:30:28 +09:00
ypshimandClaude Haiku 5.5 f989315e02 feat(rebar): P1 top = C3 − 100 with e_P1 computed; coupler rule keeps 2.5 m below the P1 top
e_P1 is no longer an input: P1 top = C3 (lowest coping top − 127 − 2·57.2 = 43.170) − 100 = 43.070, so e_P1 = step top −
43.070 = 485 mm. The P1 top moves from 15147 to 14862 mm; the top piece shortens by 285 mm. Couplers are placed at k·3000
with at least 2500 mm below the P1 top (a value to confirm). On P1 the coupler count stays at four (3, 6, 9, 12 m). P2 and
the tie top do not change.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 13:19:09 +09:00
ypshimandClaude Haiku 5.5 f37a0bf9ce fix(rebar): column heights Hc and h_cop from the model (Level underside, step top) instead of P1 constants
Hc = Level underside − footing top, and h_cop = step top at the column centre − Level underside. P1 gives 12703 and 2644,
unchanged. With taper h2 = 3000 the Level underside moves down, so Hc = 11203 and the P2 top (Level underside + l_d)
moves to 13039, while the P1 top stays at the step top (15147). The 3D and the 철근표 use the same heights.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 13:10:51 +09:00
ypshimandClaude Haiku 5.5 df6aeb5c46 fix(rebar): side rows on the 250 grid up to the 400 mm top margin, not a fixed count of seven
C12 and C13 come from one grid from the Level underside + 127 at 250 mm, up to top − 400 mm (상면 여유). The fixed count of
seven rows is kept only for callers that give no top. P1 is unchanged (C12 5, C13 2); a taper of 3000 mm now gives C12 11
and C13 2, and the C13 first row is always the last C12 row plus 250.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 12:31:58 +09:00
ypshimandClaude Haiku 5.5 7ff2f7b53f docs(rebar): note on the C12 row that the drawing's bottom 6th row is C7·C8 (no added bars)
The 250 grid runs from the Level underside + 127 for C12 and C13 together. The drawing's sixth C12 row at the bottom is the
bottom bar C7·C8 (코핑철근.md §6.1), so no bars are added and the counts stay the same.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 12:16:48 +09:00
ypshimandClaude Haiku 5.5 355bf4ea75 feat(rebar): C12 in the taper band (h2) and C13 in the end band (h1), from the coping geometry
The split between C12 and C13 follows the end underside, not a fixed level: C12 rows lie between the Level underside and
the end underside (taper height h2), C13 rows between the end underside and the top (end height h1). The break is the end
underside + 127 mm, the taper line's start at the end face. P1 is unchanged (C12 41.288–42.288, C13 42.538–42.788). Tests
check the band rule for h1 and h2 changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 12:03:24 +09:00
ypshimandClaude Haiku 5.5 ecaa45306c docs(rebar): record that the side-row levels follow 코핑철근.md §6.1 (z_0 = Level underside + 127)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:52:49 +09:00
ypshimandClaude Haiku 5.5 0a5edfb152 feat(rebar,view): coping end height h1, taper h2 and Level width as inputs on ② (1단계)
The three values are inputs on the coping card, with the P1 values (1000 · 1500 · 2100) when absent, and they are tracked
like the other shape inputs. The geometry and the coping rebar read them from one CopingGeom: the U heights follow the
closed form (h1 − 2c) + h2·min(x_s, x_L0)/x_L0, which reproduces the P1 values. The side rows are assumed to keep their
position relative to the Level underside (명세 확인 필요). P1 results are unchanged; the full suite passes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:44:44 +09:00
ypshimandClaude Haiku 5.5 5b5db60657 feat(view): ② coping card shows d_IP2 and the 계단 구간 표 (read-only, from the model)
The coping card lists d_IP2 and a table of the step segments: range, front and back coping tops, the lateral step, and
the block heights including the 50 mm pad (150 / 200 as in the 삽도). The table is read from the model; nothing new is
computed or entered. Tests check the P1 values against the 삽도.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:40:09 +09:00
ypshimandClaude Haiku 5.5 b5eb0d68c0 feat(view): move all 3D info panels to the right stack (부재 표시, 시점, 색 기준, 원점)
The four panels are in one stack on the right of the 3D view, 180 px wide, with the ⓘ origin note opening to its left.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:33:45 +09:00
ypshimandClaude Haiku 5.5 0889ebfc34 feat(view): move all 3D info panels to the left stack (부재 표시, 시점, 색 기준, 원점)
The right stack is gone. 색 기준 and the ⓘ origin note now sit under 시점 in the left stack, so every 3D info panel is on the
left. The stack is 180 px wide; the origin note opens to the right of its button.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:33:06 +09:00
ypshimandClaude Haiku 5.5 86a4b2fd80 feat(view): drop the 3D title band; pier name in 교각 목록; view menu under 부재 표시, origin under 색 기준
On wide screens the pier name moves to the 교각 목록 (name · type), the band is gone and the 3D view takes the full height.
A left stack holds 부재 표시 and then 시점; a right stack holds 색 기준 and then the ⓘ origin note. The active pier is scrolled
into view when it changes. Below 600 px the title is kept above the model and the stacks sit below it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:31:46 +09:00
ypshimandClaude Haiku 5.5 e66c259d1e feat(view): collapsible 시점 menu, origin toggle, and remembered panel states on the 3D band
The title stays. The view buttons become a menu that shows the current view and closes on a choice, Esc or an outside
click. The origin note is an ⓘ toggle. 부재 표시 and 색 기준 are collapsed by default and show their state in the summary
(e.g. 부재 표시 7/7 ▾, 색 기준: 역할 ▾); their open state is remembered per viewer, with guarded storage access.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:24:43 +09:00
ypshimandClaude Haiku 5.5 678215267c feat(view): on narrow windows only, the 시점 buttons move to the right of the 3D title band
Between 601 and 1100 px the title stays on the left and the view buttons and origin note sit on the right. Wider windows
keep the current order; below 600 px the band wraps as before.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:19:32 +09:00
ypshimandClaude Haiku 5.5 2902404061 feat(view): 3D area with a thin title band and collapsible info panels left and right
The title, view buttons and origin sit in one 44 px band on the model. 부재 표시 is a collapsible panel on the left and
색 기준 (③ only) a collapsible panel on the right, both over the canvas, about 170 px wide, with 44 px touch targets.
Below 600 px the band wraps and the panels fall below the model.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:14:34 +09:00
ypshimandClaude Haiku 5.5 65e751e4bb feat(view): fixed frame with its own scroll for the side panels, the table and the model
On wide screens the page is one fixed-height frame: the left list, the centre (model band on top, table below) and the
right results each scroll on their own. The model band is 280–560 px (48vh) and the 3D view follows its container
through a ResizeObserver. The table header stays on top. Below 1100 px the panels stack with a 60vh height limit.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:08:20 +09:00
ypshimandClaude Haiku 5.5 61260413c6 feat(view): turn the bearing blocks, pads and block rebar to the bearing row (삽도)
Each block takes the skew of its bearing row against the perpendicular of its stretch axis (rowSkewDeg, from the bearing
azimuth). The blocks and pads are turned to that skew, and the S1/S2 bars are drawn in the block frame and turned with
it, so their lengths and embedments do not change. ② shows the row skew (P1: front −4.42°, back −3.11°). Approved
2026-10-23 with the drawing as reference.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 11:01:19 +09:00
ypshimandClaude Haiku 5.5 e8541b29cb feat(view): one top row for the status and backup, transient results as toasts
The status line and the backup banner share one row (the banner appears only when a backup exists). Results and notices
show as toasts that close after 4 s; problems stay until closed. The status line keeps only the empty-state hint.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 10:51:12 +09:00
ypshimandClaude Haiku 5.5 e999b11a21 feat(rebar): piece lengths for C9–C13 and P1·P2 so the 재료표 has no missing bars
A row can now carry pieces (length, count). C9, C10, C11 and C9·C11 사이 have U and 삿갓 pieces per position (3 loops each);
C12 and C13 have 일자 and ㄷ pieces per bar; P1 and P2 have their splice pieces, each counting all the bars. The
재료표 totals from the pieces, so no bar is left out. 개수 stays the 철근표 count; the piece count is kept beside it. The
삿갓 length h − 100 is an assumption (Q-K5) and is noted on the ④ screen.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 10:27:17 +09:00
ypshimandClaude Haiku 5.5 99c71b7277 feat(view): ④ 재료표 as its own result stage, with pier selection, Excel per pier and print
The 철근재료표 moves from ③ to a new stage ④ in the header. It shows the checked piers (or the current one), one table
per pier with 강종 → 직경 → 번호 and subtotals, and a total across piers. The Excel export has one sheet per pier and a
합계 sheet. Print uses A4 landscape without the header and buttons. ③ keeps a summary line and a link to ④.
Spec §5, §6.9 and §7 record the stage (approved 2026-10-23).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 10:22:11 +09:00
ypshimandClaude Haiku 5.5 b6bf087334 feat(rebar): 철근재료표 by 강종 → 직경 → 번호 with unit weights, 할증 and Excel export
The quantity table sits below the 철근표 for the whole pier. Lines group by grade and nominal diameter, with
subtotals, unit weight 0.00617·d² (kg/m), the total in kg and ton, and a 할증 total. 할증 is an input in 공통 설정,
default 0 as an assumption. Couplers are counted, not weighed. Bars with no length yet (C9, C10, C11, C12, P1, P2) are
listed as missing and kept out of the totals. The table exports to Excel with SheetJS.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 10:16:56 +09:00
ypshimandClaude Haiku 5.5 30e5e75c22 feat(view): round bar bends at the centre-line radius; bend factors as inputs on ③
Bars drawn through several points are one tube each, with every bend rounded by R·tan(φ/2) at the centre-line radius
(inner factor × d + d/2). The inside-radius factors (D16 and below, D19–D25, D29–D35, D38 and above) are inputs in 공통
설정, with KDS-based defaults 2 / 3 / 4 / 5. The size-class limits sit in one place (SIZE_CLASS), which also fixes
D25 (25.4) being read as the D29–D35 class in hookLength. The helper bendDeduction gives the centre-line deduction for
the length option, which is not yet applied to the 철근표 lengths.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 10:13:16 +09:00
ypshimandClaude Haiku 5.5 03bb1f9929 fix(rebar): stack the three C9·C10·C11 폐합 to the right so they do not overlap
The three 폐합 of one position were drawn at the same x, so their U bars overlapped. Loop i now sits at x + i·2d and its
삿갓 one bar (d) beside its U, so no U meets another loop's U or 삿갓. The 철근표 counts and lengths are unchanged.
The rule is geometry only; the spec (§4.3) needs the stacking note.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 10:04:36 +09:00
ypshimandClaude Haiku 5.5 f398b4341f feat(rebar): select several bars on ③ and show only the selected ones (선택만 보기)
The 철근표 has a selection checkbox per row. Select-all / clear and 선택만 보기 sit above the table. In 선택만 보기 the other
bars are hidden in 3D and the members stay at 50% for context. A 3D click or an alert [보기] selects one bar; the
selection clears when the member tab or the pier changes. The selection is screen state and is not saved to the project.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:57:04 +09:00
ypshimandClaude Haiku 5.5 b3533b69df feat(rebar): rebar strength per 규격 prefix as inputs on ③ (D SD300, H SD400, S SD500)
fyH and fyS become a grade per prefix (D · H · S), chosen from SD300 · SD400 · SD500. The defaults are the P1 values, so
the P1 results do not change. Each bar takes its grade from its 규격 (fyOf). The 철근표 has a 강도 column. Older files
that stored fyH / fyS are read into the grade map. Only fck is still an assumed value (I02). Approved 2026-10-23.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:51:36 +09:00
ypshimandClaude Haiku 5.5 398fa997e2 feat(view): ③ rebar view at 50% for members, ground and blinding; deeper rebar colour
On ③ the members, the ground and the blinding concrete are drawn at half opacity without depth writes, so the bars show
through. Outside ③ each part returns to its own opacity. Rebar colours are shaded to 0.8 and slightly glossier so they
read through the members. Approved 2026-10-23.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:24:53 +09:00
ypshimandClaude Haiku 5.5 e0e220f35c fix(view): put the ③ colour control in the 3D title row, centred
The colour basis control sits in the 교각 3D 뷰 title row between the 시점 buttons and the origin note.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:15:48 +09:00
ypshimandClaude Haiku 5.5 4140699007 fix(view): move the ③ colour control into the 3D viewer window
The colour basis control and legend sit below the 3D canvas and show only on ③, so they belong to the model window.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:12:31 +09:00
ypshimandClaude Haiku 5.5 d35e27e7de feat(view): colour the ③ 3D rebar by diameter or by member, with a legend
Role colours stay the default (spec §6.7). A control on ③ switches to diameter (nominal size, H and S of one size
share a colour, Okabe–Ito palette) or member (받침블럭 · 코핑 · 기둥 · 확대기초). The legend lists only the items
the model has. Highlighting and the state colours are unchanged. Approved 2026-10-23.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:10:20 +09:00
ypshimandClaude Haiku 5.5 5d5ad7e997 fix(view): show the per-member fck as a rebar-only change, not an orange pending change
The fck row on ② no longer uses the orange changed style, since fck does not change the shape and is not counted in 변경 n건.
The row says 배근에만 반영 instead.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 09:04:07 +09:00
ypshimandClaude Haiku 5.5 7cf5835689 feat(rebar): per-member fck on ② for column, coping and footing
Each member can take its own fck on its ② card. A member without one uses the ③ 공통 fck, and fy stays common.
The rebar table and the 3D model both read the resolved value. The I02 note stays until every fck member has its
own value. The project file stores the values as optional fckByMember and refuses a bad value on open.
Changing the fck is not a shape change, so it is not counted in the pending changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 08:53:39 +09:00
ypshimandClaude Haiku 5.5 d8fd6adcf0 fix(rebar): pass the ③ material to C15/C16, coping bottom and column bars
The stair bars in the 철근표 and the 3D model, and the 3D bottom and column bars, were built with the default fck,
so a changed fck did not reach them. buildRebar3D now takes the material, and a material change rebuilds the scene.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 08:52:13 +09:00
ypshim b35f5ff0ed feat(rebar): add 3D coupler modeling for P1/P2 (368) and P4/P5 (35) with separate summary table rows 2026-10-22 18:00:28 +09:00
ypshim 9900aa6d8e feat(rebar): apply 4-bar symmetric vertical stacking offset (±1.5 db, ±0.5 db) to P6 crossties to resolve centre intersection interference 2026-10-22 17:50:57 +09:00
ypshim a2317caf6c feat(rebar): add downward 90° hooks (135 mm) to P6 crossties in 3D rebar model 2026-10-22 17:45:22 +09:00
ypshimandClaude Haiku 5.5 4aa8dbb3cb fix(view): ② and ③ use the ① layout — model above the table in the centre column
The model sits at the top of the centre column and the table or member card
below it, between the pier list on the left and the results on the right, as in
the ① screen and the 시안.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:33:36 +09:00
ypshimandClaude Haiku 5.5 a692f1f507 feat(view): 철근표 and the 3D rebar model point at each other (③)
- The 3D model of ③ draws each bar family from the rebar modules (coping top and
  bottom bars, shear loops, side bars, column bars and ties, footing B1–B8, bearing
  S1/S2) and names every bar as its 철근표 number.
- A table row click highlights the bar in 3D (the others dim); a click on a 3D bar
  selects its row in the table and sets the member tab. Drags still rotate.
- The rebar is shown only on ③. Not drawn yet: C14, C15/C16, B9–B12, the couplers,
  and the bars of a bent coping.
- Tests: family names and counts (P1 46), highlight behaviour.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:31:26 +09:00
ypshimandClaude Haiku 5.5 8c96ab76f5 feat(view): show the 3D model on the 형상계획 and 철근배근 screens
The 3D viewer (views, canvas, part toggles) moves into a slot at the top of ②
and ③ while those screens are shown, and back to ① otherwise. Moving the
element keeps the WebGL context; the viewer is measured after its screen is
visible.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:28:02 +09:00
ypshimandClaude Haiku 5.5 e7f57f0a8a feat(view): 교각 목록 and bulk line in the ③ left column (시안 ③)
The ③ screen had no pier list. The left column now has the 교각 목록 with
checkboxes and a 배근 status (계산됨 / 오류), the 선택 n기 line with 속성 복사…,
then 부재 · 배근 타입. The checks are shared with ① and ②.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:25:32 +09:00
ypshimandClaude Haiku 5.5 1074fdf428 feat(view): shear-segment table for 2·3주형 on the ③ coping tab
The segment table lists each column's Level and the segments between columns
(추천안, Q-K2), so a 2주형 shows 좌 경사 3, Level 1 9, Level 2 9, 기둥 사이 1 18,
우 경사 3. One column is unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:22:04 +09:00
ypshimandClaude Haiku 5.5 13318e9393 feat(core): rebar for 2·3주형 — shear bars per column, column bars per column (plan)
- Coping §9: C10 at each column centre (@300, k_max as for one column), C9 / C11
  outside, and the gaps between columns filled @250 from both C10 groups with the
  remaining length shared evenly (추천안, Q-K2). One column gives the T형 result.
- Column bars and couplers repeat per column (P1 230 × 2 for 2주형, × 3 for 3주형).
- Footings: each footing's bars are summed per name; the longest length governs.
- C14 is kept as the T형 layout with an RB-M01 note (per-column rule open, Q-K11).
- Tests: counts for 2주형 and 3주형; T형 unchanged; too-close columns refused.
- Not yet: the ③ shear-segment table for multi columns (still single column), the
  C14 per column, and a drawing for multi columns. Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:20:49 +09:00
ypshimandClaude Haiku 5.5 8ac5d2973c feat(view): 전단철근 구간 표 on the ③ coping tab (시안 ③)
- Segments of C9 (좌 경사), C10 (Level), C11 (우 경사): first and last bar in
  metres, spacing, count, and bar number. From the bar positions (코핑철근.md §3).
- Test: 0.300–4.550 (18 @250), 4.800–7.200 (9 @300), 7.450–11.700 (18 @250).
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:17:12 +09:00
ypshimandClaude Haiku 5.5 488b65af31 fix(view): alert [보기] highlights the bar it is about (시안 ③, spec §6.1)
[보기] only switched the member tab. The alert now names its bar (RB-F08 → B2),
and [보기] switches to the member, highlights that row, and scrolls to it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:13:03 +09:00
ypshimandClaude Haiku 5.5 140d34a844 fix(view): ③ rebar table reads left to right and scrolls inside its panel
The text columns were right-aligned and the table pushed the 비고 column out of
view. Text columns are now left-aligned, numbers (길이, 개수) right-aligned, and
the table scrolls sideways inside its panel.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:09:47 +09:00
ypshimandClaude Haiku 5.5 cdc0e5ac9c feat(view): ③ screen follows the 시안 — table columns, basis badges, alert buttons
- 철근표 columns as in the 시안: 구분 · 번호 · 규격 · 간격 · 실간격 · 위치 · 방향 ·
  형상 · 길이 · 개수 · 근거 · 비고. Metadata per bar from the rebar documents.
- 근거 badges: 입력 / 기본값 / 계산 / 가정 (the 가정 badge is italic amber).
- 번호 click highlights that row.
- 알림: [보기] opens the member tab; I02 [입력] focuses the fck input.
- Member tabs show the warning count.
- 공통 설정 moved to the right column (알림 → 검토 필요 → 공통 설정), as in the 시안.
- The 시안's "fck를 입력해야 생성" blocker is not used: the defaults are assumed
  values (I02), as decided on 2026-10-22.
- Not in this step: the drawings and the 정면·단면 연동 (시안 도면 뷰어).
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:08:21 +09:00
ypshimandClaude Haiku 5.5 9ba7b55eab feat(core,view): ③ 공통 설정 — fck and fy as inputs (spec §6.2)
- Material {fck, fyH, fyS}, defaults 27 / 400 / 500 as assumed values (I02).
  The rebar calculations take the material: the C7/C8 splice, the P2 development
  length, the P3 lap, and the B2 split use it instead of fixed numbers.
- ③ screen: 공통 설정 inputs with a note that the defaults are assumed (I02).
- Project file stores the material as an optional field; older files open with
  the defaults.
- Tests: fck 27 → 35 shortens the laps by √(27/35); the C7 piece follows fck;
  a non-default fy drops I02; the file round trip.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:06:11 +09:00
ypshimandClaude Haiku 5.5 64d415f891 fix(view): stage navigation highlights the active stage
The highlight is the 'current' class, but the stage switch only changed
aria-current, so ① stayed highlighted while ③ was shown. The switch now moves
the class with aria-current.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:04:44 +09:00
ypshimandClaude Haiku 5.5 5cc166c2e1 feat(core): RB-C07 — delete P4 ties that interfere with the footing top bars
- A P4 is deleted when |z_P4 − z_bar| < (d_P4 + d_bar)/2 against B5 and B1
  (the 확대기초 top layer, from the 상면). B11/B12 are not checked (Q-C9 무시).
- The P6 crossties start from the first kept P4.
- Tests: the document's example keeps all 8; B5 moved to −70 deletes the P4 at
  −60; a P4 just outside the limit is kept.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:49:16 +09:00
ypshimandClaude Haiku 5.5 02d740d8ca fix(view): left-align the rebar table text and clarify the C14 note
- The 번호·규격 and 비고 columns of the ③ table read left to right; the note
  wraps instead of stretching the table.
- C14 note: "위 2줄 11본씩, 아래 5 · 6 · 3 · 2 (합 38)".

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:48:18 +09:00
ypshimandClaude Haiku 5.5 33d5edef35 fix(view): enable the import apply button after the sample names are filled
Setting the project name programmatically does not fire 'input', so the apply
button stayed disabled after 샘플 P1 사용 even with P1 checked. The button is
now refreshed after the names are filled.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:47:23 +09:00
ypshimandClaude Haiku 5.5 12239c6652 feat(view): standing input and names for the P1 project (운곡교P1 · 운곡교)
- The sample button and ?sample=1 fill the project name 운곡교P1 and the bridge
  name 운곡교. The sample is RAG/운곡교P1입력.xlsx.
- Test: the app's copy stays byte-identical to the RAG file (skipped when the
  RAG folder is absent) and reads one pier, P1, T형, 말뚝기초, 10 bearings.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:42:56 +09:00
ypshimandClaude Haiku 5.5 4d8bbf7f6e test(core): footing drawing-reproduction checks from the document's test table
- Leg offsets (B1 +25.4, B3 +22.25, B5 +28.6, B7 +23.85) and B11 / B12 heights
  (550 / 950 / 1350; 569.1 / 969.1 / 1369.1).
- Reproduction counts: W 7800 → B4 30 / B2 29; L 9350 → B8 36 / B6 35.
- Variables: W 8000 with s 150 → 50 steps, e 150; W 12000 → 92 steps.
- Splice cases: L 8700 → B2 11946 (no splice), L 12400 → B4 12200,
  W 8800 → B6 12046.
- Not covered: the 배근도 H 2200 case for B10 (the document's count is unclear).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:39:42 +09:00
ypshimandClaude Haiku 5.5 1c6194cd48 feat(core): cap bars of C9–C11 and piece count (추천안 for Q-K5)
- Recommended l_cap = h − 100 (top cover), so l_cap stays below h (RB-K04).
  Cap length = 1740 + 2·l_cap. The shear rows show U and cap ranges.
- Piece count 6 per position (3 closed stirrups × U + cap): C9 + C10 + C11 gives
  270 pieces, as in the document.
- P1/P2 per-line pieces are shown from the document (기둥철근.md §3.2).
- Tests: cap length and the 270 check.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:38:28 +09:00
ypshimandClaude Haiku 5.5 5641bbe265 feat(core): lengths for coping, column and the B2 split (추천안)
- Coping: C9/C10 lower U = 1740 + 2h with h linear along the slope and 2300 on
  the Level (3522 / 6098 / 6249 / 6340 from the document); C12 (3717–10183),
  C13 11746, C14 3447.5, C15 3852, C16 4070.
- Column: P3 = C_t + 1.3·l_d(H19) lap (추천안 for Q-C6, lap 1146.6), P5 = C_t.
- Footing: B2 13646 is split into two pieces at a splice with 1.3·l_d(S25,
  SD500) (추천안 for Q-B6), piece ≈ 7776 each.
- Not done: C9/C11 cap (삿갓) lengths (Q-K5 open), P1/P2 per-line pieces.
- Tests against the document values; P1 summary updated.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:37:08 +09:00
ypshimandClaude Haiku 5.5 73bff19aba feat(core): B9 shear bars of the footing (plan C5)
- B9 (확대기초철근 (1).md §9): H16 with the 135° stirrup hook, on the odd grid
  (i_W = 1, 5, …), 16 rows, 20 per row (even rows start at i_L 1, odd at 3),
  320 bars, length l_v 1750 + 2 × 189 ≈ 2128.
- The rebar summary now lists B9; the alert about B9 is gone. Positions and
  hooks are the document's proposed rules (Q-B18, Q-B19), noted on the row.
- Tests: the document's B9 values; P1 summary has 320 and only the splice alert.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:34:56 +09:00
ypshimandClaude Haiku 5.5 3af8729e9f feat(core,view): footing rebar B1–B12 (plan C5) and the ③ rebar screen v1
- Footing (확대기초철근 (1).md): grid counts from W and L, layer heights,
  B1–B4 and B5–B8 counts and lengths (B2 13646, B6 11396), B10-1/B10-2,
  B11 (60) and B12 (47) with their lengths. B9 is not computed yet.
- rebarSummary: one 철근표 per pier from the model (bearing, coping, column,
  footing), with alerts: RB-F08 (B2 needs a splice, Q-B6), RB-F09 (B9 not
  computed).
- ③ screen v1: stage nav button, member tabs (받침블럭 · 코핑 · 기둥 · 확대기초),
  rebar table with 번호 · 규격 · 개수 · 길이 · 비고, alert list, and the open
  questions (Q-B5, Q-B6, Q-C9). Drawings and the 강조 연동 are not in v1.
- Tests: footing values from the document; P1 summary totals; warnings.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:33:47 +09:00
ypshimandClaude Haiku 5.5 a403ab9641 feat(core): coping main bars C1–C8 (plan C3) and column rebar C4
- Nominal bar diameters (H29 28.6, S32 31.8, …) as used by the documents. With
  them, C7/C8 l_s = 1.3·l_d(28.6, fck 27) = 1717.6, which is the document's 1717.
- C1–C8 (코핑철근.md §5): width layout 127 · 110.5 · 21@125 · 110.5 · 127 with 24
  bars (12 + 12); heights 43.284 / 43.227 / 43.170; top bar lengths 12744 /
  12629.6 / 12515.2; bottom pieces ≈ 7448.
- C4 (기둥철근.md): P1 r 875 and P2 r 843.2; couplers P1 +3/6/9/12 m, P2 +150;
  230 + 230 main pieces and 368 couplers; tie radius 900.45; P3 38 at @300 from
  2.340; P5 19 at @120; P4 8 at @120 from −0.060; P6 8 levels × 4 = 32, length
  ≈ 2071.
- Not yet: C4 interference checks (P4 vs B11, Q-C9), bar lengths of P3/P5/P4
  and coupler shapes, the coping/column drawing checks, and the ③ screen.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:28:03 +09:00
ypshimandClaude Haiku 5.5 b962cf1a1c feat(core): bearing-block drawing check and coping rebar C3 (plan C2·C3)
- Drawing check (spec §6.3): an integrated 2500 × 1200 block gives 18@125 = 2250
  along (ends 50 + 75) and 7@125 = 875 across (ends 162.5).
- C3 coping rebar, from RAG/코핑철근.md (2026-10-22 final):
  - C10: 9 bars @300 at 4800–7200 (k_max 4, beyond the Level edge).
  - C9 / C11: 18 bars each @250 outward, ends at 300 and 11700 (end gap 300).
  - Refuses a coping too short for C9 (RB-K01).
  - Side bars C12 5 rows / C13 2 rows at the 42.538 break; C14 38 bars;
    C15 11 bars, C16 22 bars.
- spec §6.4 is older than 코핑철근.md (C10/C9/C11 layout, C12 row count, C14
  dimensions). This follows the final document; spec §6.4 needs an update.
- Not yet: C1–C8 main bars (shape and lengths), the C12/C13 bar lengths and
  shapes, the drawing check of the coping sheet, and the ③ screen.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:08:27 +09:00
ypshimandClaude Haiku 5.5 daf78d0586 feat(core): rebar common rules (plan C1) and bearing-block bars (plan C2)
- C1: development length l_d = 0.6·d_b·fy/(λ√fck), splice 1.3·l_d, standard
  hooks (main 90°, tie 90°, stirrup 135° as written in the spec). fck 27 and
  fy 400/500 are marked as assumed values (I02).
- C2: bearing-block bars, one block per bearing (배치 분리). Bars S1 and S2 at
  @125 with 8 bars per 1200 mm side (7 gaps = 875, ends 162.5), 2500 mm long,
  coping embedment from the block height (pad included, Q16 결정).
- Tests: development and splice lengths; hook table limits; embedment 600 /
  550 / 619.1 / 569.1; P1 has 80 bars each of S1 and S2 over 10 blocks.
- Not yet: the ③ screen and the drawing check against the bearing-block drawing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:05:27 +09:00
ypshimandClaude Haiku 5.5 e297db1251 fix(core): replace abolished E04 with I02 in the unimplemented list
E04 (fck 미입력 차단) was abolished on 2026-10-22; fck and fy are now inputs
with assumed defaults, reported as I02 in the rebar stage (spec §10, §13 Q8).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 11:03:14 +09:00
ypshimandClaude Haiku 5.5 17b5b24682 feat(core,view): per-row pile counts 열별 본수 (plan C4)
- A 열 is one row across the footing width; each has its own count along the
  length. Default floor((L − 1400) / 2250) + 1 per 열, as in spec §4.6.
- Counts are validated: one per 열, whole numbers 2–30. Spacing below the
  2250 mm minimum is shown as a warning, not refused (the plan's 6본 → 5@1800
  example).
- PierInput gains an optional pileRows; absent means the defaults, so existing
  files and the P1 results are unchanged.
- Change tracking compares arrays by value; 열별 본수 can be reverted and
  copied (copy item off by default).
- The footing card has −/+ per 열 with spacing, total, and the display string.
- Tests: defaults 4열 × 5본 = 20 and the 1단계 text; 6본 → 5@1800; limits;
  model-level 21 piles.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 10:34:39 +09:00
ypshimandClaude Haiku 5.5 5b162c2441 feat(core,view): shape-option rules (plan C5) and pier selection rules (plan C6)
- C5: each member's options come from one table. Only the defaults (the 1단계
  model) are selectable. The others show as disabled chips with 규칙 미정 (Q6).
  The member summary is built from the defaults.
- C6: 전체 선택 acts only on visible, buildable piers; it reads 선택 해제 only
  when all of those are checked. A check survives a change of the type filter.
  The pier list scrolls past 300 px, for 20 piers.
- Tests: defaults are the only choices; unknown options refused; the 20-pier
  mixed list with two failed piers; filter and check persistence.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 10:15:03 +09:00
ypshimandClaude Haiku 5.5 56362570ec feat(view): 형상계획 ② screen skeleton with five members (plan.md C1)
- ① and ② are switched from the stage nav. ② shows the pier list with change
  counts, the five members (교량받침, 코핑, 기둥, 확대기초·말뚝, 지반·지층) with
  a change count each, a member card, and a change list with per-item revert.
- The member card shows 기본 and 선택 summaries separately. Only members with
  existing inputs get fields (코핑 폭·길이, 말뚝 길이); the others show values
  and a note that their inputs come in a later step. Unselected members' inputs
  are not shown.
- The field rows are shared between ① and ②.
- Added a global [hidden] rule so hidden screens stay hidden.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 10:07:34 +09:00
ypshimandClaude Haiku 5.5 f75431d898 feat(view): attribute-copy dialog (시안 ⑥, plan C8)
- 속성 복사… opens the four-step dialog: source (current inputs), items,
  targets (same-type filter on by default), and a preview with changed values
  and skipped items per target. Apply changes only the visible, ticked targets.
- Items that the model does not have yet (기둥, 받침, 배근, 기초 형상) are shown
  as 예정 and disabled. Coping length and pile length are off by default.
- Option: regenerate the targets right after applying (default on); otherwise
  they show as 재생성 필요 through the normal change tracking.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 10:01:18 +09:00
ypshimandClaude Haiku 5.5 4accf1f3be feat(core): attribute-copy engine (plan C7)
- planCopy previews the changes and the skipped items for one target; applyCopy
  applies exactly the planned changes.
- Default selection copies only the coping width; coping length and pile length
  are off by default (spec §9). Pile items are skipped when the foundation type
  differs. Coordinates, IPs, bearings and elevations are not in any item.
- Equal values are not counted, so the preview count equals the applied count.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:59:48 +09:00
ypshimandClaude Haiku 5.5 fae8d7b9b8 feat(view): reflect 시안 ① main screen and ⑤ save dialog
- Header follows the mockup: dark bar, project line, stage chips (② shows the
  pending change count), save status, 저장 / 엑셀 불러오기 / 프로젝트 열기 and
  the primary 선택 교각 다시 생성 · 변경 n button.
- Left column: pier list with header row, 선택 n기 bulk bar, 입력값 and the
  2단계 input card. The bottom input panel is gone.
- First save opens 시안 ⑤ (project name, bridge, client, author, 좌표계, memo);
  later Ctrl+S / 저장 write the same file, as the spec's B5 requires.
- Project info (client, author, 좌표계, memo) is kept in the project file.
- Style layer uses the mockup's tokens (#18212B header, #1F5FA8 primary,
  #D5DBE2 borders, #E3EDF8 selected row, JetBrains Mono for numbers).
- Not reflected: ② and ③ screens (not built yet), and the mockup's static
  front preview (the app draws the model in 3D). Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:57:02 +09:00
ypshimandClaude Haiku 5.5 0b62f694c5 feat(core,view): input cards with change tracking (plan B1 · C2)
- Three values per pier: defaults (as imported), input (generated), draft
  (current cards). Overrides = draft vs defaults; pending = draft vs input.
- Editable now: 코핑 폭, 코핑 길이, 말뚝 길이. Changing a card does not touch the
  3D view until 다시 생성; the header and the card show 변경 n.
- Revert puts a field back to its imported default.
- Project files store defaults and draft (optional; v1 files still open).
- Tests: 코핑 폭 3100 → 3300 gives one override and one pending change;
  regenerating clears pending but keeps the override; revert; file round trip.
- Not verified in a browser (no debuggable Chrome in this session).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:48:47 +09:00
ypshimandClaude Haiku 5.5 f5303e4c2b feat(view): project save/open, Ctrl+S, save status, IndexedDB auto-backup (plan B2–B5)
- 저장 (Ctrl+S) downloads <교량명>_교각설계.pzr.json; 프로젝트 열기 reads it
  back and regenerates every pier without the source workbook.
- Save status in the header: 저장 전 / 변경 있음 · 미저장 / 저장됨. The
  snapshot excludes the history so a save is not counted as a change.
- Auto-backup to IndexedDB 0.8 s after changes while unsaved; on start a banner
  offers recovery or discard. Storage failures are reported, not fatal.
- beforeunload warns while there are unsaved changes.
- B1 (default-vs-changed tracking) is not added yet: inputs are not editable
  until the 2단계 input cards exist.
- Not verified in a browser (no debuggable Chrome in this session).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:44:49 +09:00
ypshimandClaude Haiku 5.5 5ce6d0e2f1 feat(core): project file save/open with schema check (plan B3)
- serializeProject / parseProject for the .pzr.json format (spec §8,
  schemaVersion 1). Parsing refuses other versions and damaged piers, and
  names the first broken pier.
- The 3D model is not stored; it is regenerated on open.
- Tests: save → open equality without the source workbook; regenerated
  models equal for 20 piers; version and damage refusals.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:39:44 +09:00
ypshimandClaude Haiku 5.5 9e1e25f8fe feat(core,view): bent coping stage 3 — footings and piles in stretch frames
- Footings, blindings and piles on a bent axis are placed in their stretch's
  frame; 일체기초 is grouped per stretch, so a combined footing never crosses
  the kink (separate footings, each aligned with its stretch).
- Footings, blindings and piles are trimmed at the mitre plane like the coping.
- The stage-2 refusal for bent foundations is removed; the Level-half-width
  refusal for columns at the kink remains.
- Tests: T형 footing crossing the kink stays in stretch 0; 2주형 with columns
  on both sides gives one footing per stretch, with mitre clipping in the scene.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:38:01 +09:00
ypshimandClaude Haiku 5.5 c9dae4ff9b fix(core): refuse bends that double back; use a valid synthetic bend in tests
The earlier synthetic bend (IP3 at (6, 2)) put IP4 ahead of IP3 on the turned
line, so the axis folded back on itself. buildPier now refuses a kink behind
IP1 along IP1→IP2 or an IP3 behind the kink along the turned direction. Tests
use IP3 (9, −3.464), a valid 60° right turn with kink (7, 0).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:33:09 +09:00
ypshimandClaude Haiku 5.5 5371932cca feat(core,view): bent coping stage 2 — mitred coping, stretch-local bearings, blocks and columns
- buildPier builds on buildAxis: each object carries its stretch k and a local
  s from that stretch's base; coping parts are per stretch with the mitre plane
  trimming the overlap in the scene (renderer.localClippingEnabled).
- Straight P1 output is unchanged (regression tests pass).
- Bent coping is supported for 현장타설말뚝 only; footings and piles on a bent
  axis remain 미실시 until stage 3. Kink outside the coping and columns within
  the Level half-width of the kink are refused.
- W03/W04 use coping coordinates (g).
- Tests: constructed 60° bend — world coordinates of bearings, blocks and the
  column survive the stretch frames; mitre sides; scene mesh count; refusals.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:22:57 +09:00
ypshimandClaude Haiku 5.5 46709be532 feat(core): polyline coping axis with per-stretch frames (bent coping stage 1)
- buildAxis: IP1 → IP4 → IP3 as stretches with their own frames; arc length s
  from IP1; mitre normal u1 + u2 at the kink.
- toAxis / fromAxis: world ↔ (k, s, n) round trip; stretch chosen by the mitre plane.
- copingSpan (centred on L_IP/2) and nearKink (columns within the Level half-width).
- Straight P1 regression against spec §12 bearing values; bent round trip and continuity.
- Not wired into buildPier yet; the model still refuses bent coping (미실시).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:18:31 +09:00
ypshimandClaude Haiku 5.5 d8944e9023 fix(core): clockwise-positive bend angle for IP4 (right turn when travelling IP1→IP2)
Sign convention approved: a right (clockwise) deflection is positive.
solveIp4 now rotates the IP1→IP2 direction by −θ. Test covers a +10°
right turn with IP4 at (5, 0).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:13:54 +09:00
ypshimandClaude Haiku 5.5 d0fa9b94eb feat(core): lateral coping step (Q1·Q2) and IP4 bend-point solve (spec §4.1)
- Front and back coping tops that differ by 5 mm or more in any segment are
  drawn as two coping parts split at the midline between the bearing rows.
  Tolerance 5 mm and midline position are the draft assumptions (Q1·Q2).
- Scene extrudes each coping part across its own width.
- solveIp4 computes IP4 as the intersection of the IP1→IP2 line with the
  line through IP3 turned by the bend angle (positive = counter-clockwise,
  sign convention to be confirmed). Bent coping geometry remains 미실시.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:04:12 +09:00
ypshimandClaude Haiku 5.5 ad59c0c74d feat(core): 일체기초 footings for 2·3주형 with per-footing pile grid
- Columns closer than one footing length (10400) share a 일체기초 whose
  length is the outer-column distance + 10400, centred between them (spec §4.6).
- Pile grid is computed from each footing's length (rows across 8150,
  pile count along the length from (length − 1400) / 2250 + 1).
- Blinding concrete follows each combined footing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 09:01:40 +09:00
ypshimandClaude Haiku 5.5 5466b3522e feat(core): haunch-and-Level-300 coping underside, steel pile 609.6, W03/W04 checks
- Multi-column coping (2·3주형): underside between columns drops 300 below
  Level with 300 × 300 haunches (spec §4.5, Q3 추천안).
- Steel pipe pile diameter 609.6 mm (spec §4.5, Q5 추천안).
- Direct foundation keeps the 100 mm blinding concrete (Q4 추천안, test added).
- W03: bearing centre closer than half a block width to a step boundary.
- W04: block footprint outside the coping plan.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 08:58:57 +09:00
ypshimandClaude Haiku 5.5 112f460f1f test(ui): keep verification run logs as evidence (force-add, *.log is ignored)
- rag-input-run-2026-10-21.log: RAG input uploaded directly
- console-run-2026-10-21.log: V10 3 console check

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 18:19:33 +09:00
ypshimandClaude Haiku 5.5 68e56d1037 feat(input): use RAG/운곡교P1입력.xlsx as the P1 input
- public/samples/운곡교P1입력.xlsx is a byte copy of RAG/운곡교P1입력.xlsx
- loadP1 and the sample loader read the three-sheet input
- spec workbook (intent.PR) stays for the single-sheet regression tests
- test: input file has sheets 교각 · IP · 받침 and parses to P1 with no issues

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 18:18:51 +09:00
ypshimandClaude Haiku 5.5 def1e1b9fc test(ui): verify the template download button saves the file in Chrome
- scripts/verify-template-download.cjs clicks 입력 템플릿 다운로드 and reports the saved file
- result: 교각입력템플릿.xlsx (19,391 bytes), sheets 교각 · IP · 받침
- verify/template-download-2026-10-21.xlsx keeps the saved copy as evidence

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 18:17:27 +09:00
ypshimandClaude Haiku 5.5 6319cccb8e feat(import): input template download with three sheets (spec 2.3 step 4)
- buildTemplateWorkbook: 교각 · IP · 받침 sheets with the headers the parser
  reads; value cells left empty so no blank-name rows raise E05
- dialog button 입력 템플릿 다운로드 (.xlsx)
- tests: sheet order, parser recognition, write-and-read round trip

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 18:14:33 +09:00
ypshimandClaude Haiku 5.5 0b7ae1ef3f test(ui): capture console errors and exceptions during the UI check (V10 3)
- verify-ui.cjs collects console error/warning, uncaught exceptions, and log
  entries over the whole run; prints CONSOLE_EVENTS
- run with the user's three-sheet workbook: 0 events

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 18:11:57 +09:00
ypshimandClaude Haiku 5.5 353931c767 test(ui): CDP verification of the import dialog and four views
- scripts/verify-ui.cjs drives Chrome over DevTools (run with Windows Node,
  same machine as Chrome): loads the user's three-sheet workbook, reads the
  sheet report, applies P1, and captures the four view presets
- verify/shots-2026-10-21: screenshots used as evidence for V10 2 and V11

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 18:09:55 +09:00
ypshimandClaude Haiku 5.5 727cd3b2e2 feat(parse): join pier, IP, and bearing tables across sheets by 교각명
- one workbook may hold the three tables on separate sheets (user decision,
  recorded in DOC/03_설계); spec 2.2 one-sheet-per-pier is superseded
- E05 for rows whose 교각명 has no matching 교각 정보 row, or a pier missing IP/받침
- helper sheets (IP only, 받침 only) are shown as 보조 표 시트, not selectable
- test: three-sheet workbook built from the P1 sheet

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:59:26 +09:00
ypshimandClaude Haiku 5.5 4f21bd63bf fix(parse): reject split pier tables and block sheets that fail to build
- E05: a sheet whose pier, IP, or bearing table is not on the same sheet is
  not selectable (spec 2.2: one sheet per pier)
- a sheet is selectable only if every pier in it builds; the reason is shown
  next to the sheet instead of a selectable sheet with an unchecked pier

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:55:46 +09:00
ypshimandClaude Haiku 5.5 69922cfa35 feat(ui): align stage-1 screens with the design mockup
- main screen follows 시안 ①: header steps, pier list with type filter and
  multi-select, viewer with 아이소/정면/측면/평면, part toggles in mockup order,
  input panel and result sections
- import moved to a modal dialog following 시안 ④: project name (required),
  file drop and pick, per-sheet recognition with selectable piers, preview of
  pier and bearing tables, glossary of Excel column names
- Esc closes the dialog and focus stays inside it (native dialog)
- 44px touch targets and 2px focus rings; colours from the mockup tokens

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:49:04 +09:00
ypshimandClaude Haiku 5.5 01d2bf4958 feat(parse): report per-sheet recognition and block error sheets
- parseWorkbook returns a report per sheet (table counts, issues, ok)
- sheets with E-level issues cannot be selected (spec section 2.3)
- pier input carries its source sheet name

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:43:36 +09:00
ypshimandClaude Haiku 5.5 35d89dc4e2 chore(verify): store headless capture script used as verification evidence
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:31:43 +09:00
ypshimandClaude Haiku 5.5 71a77608f8 feat(view): load bundled sample from ?sample=1 deep link
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:31:24 +09:00
ypshimandClaude Haiku 5.5 ad8e437c99 feat(view): add 3D pier viewer and P1 sample page
- three.js scene in the pier frame (pivot at first column centre)
- coping as extruded elevation outline; columns, footings, piles, blinding, bearing blocks and pads
- four view presets, per-part visibility toggles
- workbook load (sample or file), result table, issue list and undetermined defaults
- frame orientation test and bounding-box test

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:28:02 +09:00
ypshimandClaude Haiku 5.5 d963d8ed3c feat(core): parse P1 workbook and build T-type pier shape
- parse Excel input by header strings (pier, IP, bearing tables)
- DMS azimuth parser (E03), input validation (E01, E02)
- pure geometry: axis, bearings, stepped coping, column, footing, piles, blinding
- warnings W01, W02, W05, W07, I01
- regression tests against spec.md section 12 (P1)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:26:16 +09:00
315 changed files with 18975 additions and 56619 deletions

No files matched your search

-10
View File
@@ -1,10 +0,0 @@
node_modules
dist
build
.git
.gitignore
.env
npm-debug.log
uploads
*.xlsx
*.log
-17
View File
@@ -1,17 +0,0 @@
# Database Configuration
DB_HOST=172.16.8.151
DB_PORT=3306
DB_USER=itam_admin
DB_PASS=itam1234
DB_NAME=itam
# Application Configuration
NODE_ENV=development
PORT=3000
# Logging (optional)
LOG_LEVEL=info
# Security (for production)
# API_KEY=your_api_key_here
# JWT_SECRET=your_jwt_secret_here
-7
View File
@@ -1,7 +0,0 @@
{
"Path": "./backend/coverage.out",
"Thresholds": {
"baron-sso-backend/internal/handler": 10,
"baron-sso-backend/internal/service": 10
}
}
-47
View File
@@ -1,47 +0,0 @@
name: ITAM Code Check
on:
push:
branches:
- Dockerizing
- main
pull_request:
workflow_dispatch:
jobs:
build-and-config-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare CI env file
run: |
cat <<'EOF' > .env
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=itam_ci
DB_PASS=itam_ci_password
DB_NAME=itam
NODE_ENV=production
PORT=3000
LOG_LEVEL=info
EOF
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Frontend TypeScript and Vite build
run: npm run build
- name: Validate test compose
run: docker compose -f docker-compose.test.yaml config
- name: Validate prod compose
run: docker compose -f docker-compose.prod.yaml config
@@ -1,69 +0,0 @@
name: ITAM Docker Build Check
on:
push:
branches:
- Dockerizing
- main
paths:
- "Dockerfile.frontend.prod"
- "Dockerfile.backend.prod"
- "docker-compose.prod.yaml"
- "docker-compose.test.yaml"
- "docker/**"
- "src/**"
- "server.js"
- "package.json"
- "package-lock.json"
- "vite.config.ts"
- "index.html"
- "img/**"
- "public/**"
pull_request:
paths:
- "Dockerfile.frontend.prod"
- "Dockerfile.backend.prod"
- "docker-compose.prod.yaml"
- "docker-compose.test.yaml"
- "docker/**"
- "src/**"
- "server.js"
- "package.json"
- "package-lock.json"
- "vite.config.ts"
- "index.html"
- "img/**"
- "public/**"
workflow_dispatch:
jobs:
docker-build-check:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare CI env file
run: |
cat <<'EOF' > .env
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=itam_ci
DB_PASS=itam_ci_password
DB_NAME=itam
NODE_ENV=production
PORT=3000
LOG_LEVEL=info
EOF
- name: Build backend production image
run: docker build -f Dockerfile.backend.prod -t itam-backend:ci .
- name: Build frontend production image
run: docker build -f Dockerfile.frontend.prod -t itam-frontend:ci .
- name: Validate production compose with CI env
run: docker compose -f docker-compose.prod.yaml config
-137
View File
@@ -1,137 +0,0 @@
name: ITAM Production Deploy
on:
workflow_dispatch:
inputs:
target_branch:
description: "Branch to deploy"
required: true
default: "Dockerizing"
type: string
jobs:
deploy-production:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.PROD_SSH_PRIVATE_KEY }}
- name: Validate required production variables
env:
PROD_HOST: ${{ vars.PROD_HOST }}
PROD_USER: ${{ vars.PROD_USER }}
PROD_DEPLOY_PATH: ${{ vars.PROD_DEPLOY_PATH }}
PROD_GIT_URL: ${{ vars.PROD_GIT_URL }}
DB_HOST: ${{ vars.PROD_DB_HOST }}
DB_PORT: ${{ vars.PROD_DB_PORT }}
DB_USER: ${{ vars.PROD_DB_USER }}
DB_PASS: ${{ secrets.PROD_DB_PASS }}
DB_NAME: ${{ vars.PROD_DB_NAME }}
run: |
set -euo pipefail
required_keys="PROD_HOST PROD_USER PROD_DEPLOY_PATH PROD_GIT_URL DB_HOST DB_PORT DB_USER DB_PASS DB_NAME"
for key in ${required_keys}; do
if [ -z "${!key:-}" ]; then
echo "::error::Missing required variable or secret: ${key}"
exit 1
fi
done
- name: Create production env file
env:
DB_HOST: ${{ vars.PROD_DB_HOST }}
DB_PORT: ${{ vars.PROD_DB_PORT }}
DB_USER: ${{ vars.PROD_DB_USER }}
DB_PASS: ${{ secrets.PROD_DB_PASS }}
DB_NAME: ${{ vars.PROD_DB_NAME }}
LOG_LEVEL: ${{ vars.PROD_LOG_LEVEL }}
run: |
set -euo pipefail
EFFECTIVE_LOG_LEVEL="${LOG_LEVEL:-info}"
cat > .env.deploy <<EOF
DB_HOST=${DB_HOST}
DB_PORT=${DB_PORT}
DB_USER=${DB_USER}
DB_PASS=${DB_PASS}
DB_NAME=${DB_NAME}
NODE_ENV=production
PORT=3000
LOG_LEVEL=${EFFECTIVE_LOG_LEVEL}
EOF
- name: Deploy to production host
env:
PROD_HOST: ${{ vars.PROD_HOST }}
PROD_USER: ${{ vars.PROD_USER }}
PROD_DEPLOY_PATH: ${{ vars.PROD_DEPLOY_PATH }}
PROD_BACKUP_ROOT: ${{ vars.PROD_BACKUP_ROOT }}
PROD_GIT_URL: ${{ vars.PROD_GIT_URL }}
TARGET_BRANCH: ${{ github.event.inputs.target_branch }}
run: |
set -euo pipefail
ssh-keyscan -H "${PROD_HOST}" >> ~/.ssh/known_hosts
ssh "${PROD_USER}@${PROD_HOST}" "mkdir -p '${PROD_DEPLOY_PATH}'"
EFFECTIVE_BACKUP_ROOT="${PROD_BACKUP_ROOT:-${PROD_DEPLOY_PATH%/}_backups}"
ssh "${PROD_USER}@${PROD_HOST}" "export DEPLOY_PATH='${PROD_DEPLOY_PATH}' BACKUP_ROOT='${EFFECTIVE_BACKUP_ROOT}'; sh -eu -s" <<'REMOTE_BACKUP'
case "$BACKUP_ROOT" in
"$DEPLOY_PATH"|"$DEPLOY_PATH"/*)
echo "Backup path must be outside deploy path: $BACKUP_ROOT"
exit 1
;;
esac
if [ -d "$DEPLOY_PATH/.git" ]; then
mkdir -p "$BACKUP_ROOT"
cd "$DEPLOY_PATH"
if [ -f Makefile ] && [ -f scripts/backup.sh ]; then
make predeploy-backup BACKUP_ROOT="$BACKUP_ROOT"
else
echo "Skipping pre-deploy backup because current deployed revision does not contain Makefile backup tooling."
fi
else
echo "Skipping pre-deploy backup because no existing deployment was found."
fi
REMOTE_BACKUP
ssh "${PROD_USER}@${PROD_HOST}" "if [ ! -d '${PROD_DEPLOY_PATH}/.git' ]; then git clone '${PROD_GIT_URL}' '${PROD_DEPLOY_PATH}'; else cd '${PROD_DEPLOY_PATH}' && git remote set-url origin '${PROD_GIT_URL}'; fi"
ssh "${PROD_USER}@${PROD_HOST}" "cd '${PROD_DEPLOY_PATH}' && git fetch origin '${TARGET_BRANCH}' && git checkout -B '${TARGET_BRANCH}' FETCH_HEAD && git reset --hard FETCH_HEAD && git clean -fd"
ssh "${PROD_USER}@${PROD_HOST}" "cd '${PROD_DEPLOY_PATH}' && mkdir -p uploads logs/nginx"
scp .env.deploy "${PROD_USER}@${PROD_HOST}:${PROD_DEPLOY_PATH}/.env"
ssh "${PROD_USER}@${PROD_HOST}" "cd '${PROD_DEPLOY_PATH}' && chmod 600 .env && docker compose -f docker-compose.prod.yaml config && docker compose -f docker-compose.prod.yaml up -d --build"
- name: Post-deploy status check
env:
PROD_HOST: ${{ vars.PROD_HOST }}
PROD_USER: ${{ vars.PROD_USER }}
PROD_DEPLOY_PATH: ${{ vars.PROD_DEPLOY_PATH }}
run: |
set -euo pipefail
ssh "${PROD_USER}@${PROD_HOST}" "cd '${PROD_DEPLOY_PATH}' && docker compose -f docker-compose.prod.yaml ps"
- name: Post-deploy smoke checks
env:
PROD_HOST: ${{ vars.PROD_HOST }}
PROD_USER: ${{ vars.PROD_USER }}
PROD_DEPLOY_PATH: ${{ vars.PROD_DEPLOY_PATH }}
run: |
set -euo pipefail
ssh "${PROD_USER}@${PROD_HOST}" "curl -fsS http://localhost/health"
ssh "${PROD_USER}@${PROD_HOST}" "curl -fsS http://localhost/ > /dev/null"
ssh "${PROD_USER}@${PROD_HOST}" "cd '${PROD_DEPLOY_PATH}' && docker compose -f docker-compose.prod.yaml exec -T backend curl -fsS http://localhost:3000/ready"
- name: Cleanup generated env file
if: ${{ always() }}
run: rm -f .env.deploy
-5
View File
@@ -1,8 +1,3 @@
node_modules/ node_modules/
.gemini
.env
dist/ dist/
*.log *.log
.DS_Store
Thumbs.db
backups/
+22
View File
@@ -0,0 +1,22 @@
# CLAUDE.md — Code/3d-drawing 작업 규칙
> 근거: `RAG/Task: Pierzainer 개발.yaml` ("유의미한 코드 생성 및 수정시 git log 자동 수행", "생성 코드 작업 위치(git 포함): Code\3d-drawing").
> 전역 지침은 `.claude/taskexecutionagent.md`이며, 커밋 규칙은 여기에만 있다.
## 커밋 자동 수행
**대상 변경:** `src/`, `tests/`, `scripts/`, `verify/`, `index.html`, `package.json`, `package-lock.json`, `tsconfig.json`, `public/`.
**커밋하지 않는 것:** `dist/`, `node_modules/`, 저장소 밖의 `RAG/`, `DOC/`, `context-migration/`, `prompt/`.
**순서**
1. 대상 변경을 끝낸 뒤 `npx vitest run`을 실행한다.
2. 모두 통과할 때만 커밋한다. 실패하면 커밋하지 않고 실패 내용을 보고한다.
3. 경로를 지정해 스테이징한다. `git add -A`는 쓰지 않는다.
4. 작업과 무관한 변경이 남아 있으면 멈추고 확인한다.
5. 한 커밋에는 한 가지 변경만 담는다. 커밋 해시를 보고한다.
**메시지**
- 형식: `type(scope): summary` (예: `feat(rebar): ...`, `fix(view): ...`). 요약에 한국어를 써도 된다.
- 끝에 `Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>`을 붙인다.
**push 금지:** 커밋만 한다. `origin`(gitea)으로 push하지 않는다. push는 별도 확인을 받는다.
-12
View File
@@ -1,12 +0,0 @@
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "run", "server"]
-48
View File
@@ -1,48 +0,0 @@
FROM node:20-alpine
LABEL maintainer="ITAM Team <devops@itam.local>"
# Set production environment
ENV NODE_ENV=production
WORKDIR /app
# Install curl for health checks and dumb-init for proper signal handling
RUN apk add --no-cache curl dumb-init
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy application code
COPY server.js ./
COPY src ./src
# Create non-root user 'appuser' with UID 1001 (1000 already in use by node image)
RUN addgroup -g 1001 appuser && \
adduser -D -u 1001 -G appuser appuser
# Set ownership of application files to appuser
RUN chown -R appuser:appuser /app
# Create logs directory
RUN mkdir -p /app/logs && \
chown -R appuser:appuser /app/logs
# Switch to non-root user
USER appuser
# Expose port
EXPOSE 3000
# Health check - backend should implement /health endpoint
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
# Use dumb-init from PATH to avoid distro-specific absolute path issues
ENTRYPOINT ["dumb-init", "--"]
# Run application
CMD ["npm", "run", "server"]
-12
View File
@@ -1,12 +0,0 @@
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 8080
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
-62
View File
@@ -1,62 +0,0 @@
# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY tsconfig*.json ./
COPY vite.config.ts ./
# Install all dependencies (including devDependencies for build)
RUN npm ci
# Copy source code
COPY src ./src
COPY public ./public
COPY index.html ./
# Build application
RUN npm run build
# Verify build output
RUN ls -la dist/ && echo "Build completed successfully"
# Stage 2: Runtime
FROM nginx:stable-alpine
LABEL maintainer="ITAM Team <devops@itam.local>"
# Install curl for health checks
RUN apk add --no-cache curl
WORKDIR /usr/share/nginx/html
# Copy built assets from builder
COPY --from=builder /app/dist .
# Copy static image assets referenced by literal /img/... paths
COPY img ./img
# Copy root-level logo asset referenced directly by index.html
COPY ["image 92.png", "./image 92.png"]
# Copy Nginx static file serving configuration (not reverse proxy)
COPY docker/frontend/default.conf /etc/nginx/conf.d/default.conf
# Create nginx runtime user and directories
RUN mkdir -p /var/log/nginx && \
chown -R nginx:nginx /usr/share/nginx/html && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD curl -f http://localhost:80/ || exit 1
# Run nginx
CMD ["nginx", "-g", "daemon off;"]
-64
View File
@@ -1,64 +0,0 @@
# [보고서] IT 자산 실시간 통합 관리 시스템(RMM) 도입 계획서
## 1. 도입 배경 및 목적
- **현황**: 현재 시스템은 수동 입력 기반의 정적 자산 대장으로 운영되어, 실제 장비의 가동 상태나 장애 여부를 실시간으로 파악하는 데 한계가 있음.
- **목적**: 전산자산(서버, PC)의 실시간 상태 정보를 자동 수집하고 장애 징후를 사전에 탐지하여, 선제적 유지보수 체계를 구축하고 운영 효율성을 극대화함.
## 2. 시스템 주요 기능
### 2.1 실시간 가동 상태 모니터링
- 주요 자원(CPU, Memory, Disk) 사용률 실시간 수집
- 운영체제(OS) 및 주요 시스템 서비스의 정상 작동 여부 확인
- 자산 리스트 내 상태 인디케이터(정상/주의/장애) 표시
### 2.2 원격 제어 및 지원 통합
- **기술적 구현 방식 (원클릭 자동 연결)**: 웹사이트에서 전화번호를 누르면 전화 앱이 켜지거나, 이메일 주소를 누르면 메일 창이 뜨는 것과 동일한 원리인 'URL 프로토콜 핸들러' 기술을 적용함.
- **자동화 프로세스**: 관리자가 화면의 [연결] 버튼을 클릭하면, 시스템이 팀뷰어나 애니데스크에 "A장비로 연결해줘"라는 신호를 직접 보냄.
- **편의성**: 관리자가 대상 장비의 ID나 비밀번호를 직접 복사해서 프로그램에 입력할 필요 없이, 클릭 한 번으로 내 PC에 설치된 원격 소프트웨어가 자동 실행되며 즉시 화면이 연결되도록 구현함.
- **유연한 접속 모드 지원**:
- **무인 접속(Unattended Access)**: 서버 및 공용 장비의 경우, 사전에 등록된 자격 증명을 통해 관리자 승인만으로 즉시 접속하여 야간 또는 긴급 장애에 대응함.
- **사용자 승인 접속(Attended Access)**: 개인용 PC의 경우, 사용자의 화면에 접속 요청 팝업을 띄우고 승인 시에만 화면 공유를 시작하여 개인정보 보호 및 보안 규정을 준수함.
- **보안 및 감사 로그 자동화**:
- 원격 접속이 시작되는 시점에 관리자 정보, 접속 목적, 대상 장비 정보를 DB에 자동 기록함.
- 세션 종료 후 총 작업 시간 및 조치 내역을 입력하도록 유도하여 투명한 유지보수 이력을 관리함.
### 2.3 원격 지원 상세 워크플로우 (Remote Support Workflow)
관리자가 장애를 인지하고 조치를 완료하기까지의 표준 프로세스는 다음과 같습니다.
1. **지원 요청 및 대상 선택**: 관리자가 ITAM 대시보드 또는 리스트에서 장애가 발생한 자산을 선택하고 '원격 지원 시작' 버튼을 클릭함.
2. **접속 모드 자동 판별**:
- **서버(무인)**: 시스템이 저장된 자격 증명을 확인하고 관리자에게 '즉시 연결' 팝업을 띄움.
- **PC(유인)**: 관리자가 '접속 요청' 버튼을 누르면, 대상 PC 화면에 "관리자가 원격 제어를 요청했습니다. 승인하시겠습니까?" 팝업이 전송됨.
3. **세션 초기화 및 로그 생성**: 접속 시도가 승인되면 서버는 즉시 [접속 일시, 관리자 ID, 대상 자산 번호]를 포함한 '세션 로그'를 생성하고 상태를 '진행 중'으로 변경함.
4. **프로토콜 핸들러 실행**: 브라우저가 관리자 PC의 원격 제어 앱(TeamViewer 등)을 자동으로 실행하며, 대상 장비의 ID와 패스워드 정보를 암호화된 인자로 전달하여 즉시 화면이 연결됨.
5. **조치 및 지원 수행**: 관리자가 실시간으로 장비를 제어하여 장애를 복구함.
6. **세션 종료 및 결과 기록**:
- 관리자가 원격 제어 앱을 종료하면, ITAM 웹 화면에 '조치 결과 입력' 창이 활성화됨.
- 관리자가 조치 내용(예: 서비스 재시작, 패치 적용 등)을 입력하고 저장하면 세션 로그가 최종 확정됨.
7. **이력 보관**: 완료된 모든 이력은 '자산 상세 정보 > 유지보수 이력' 탭에서 언제든지 열람 및 보고서 출력이 가능함.
### 3.3 장애 사전 탐지 및 알림
- 설정된 임계치(예: 디스크 잔량 10% 미만) 초과 시 즉시 알림 발송
- 장기 미접속 또는 점검 누락 장비의 실시간 식별
## 3. 운영 프로세스 및 메커니즘
1. **데이터 수집 (Collection)**: 각 자산에 배치된 에이전트가 시스템 정보를 주기적으로 추출함.
2. **분석 및 판별 (Analysis)**: 수집된 데이터를 중앙 서버에서 분석하여 장비의 상태 등급을 판정함.
3. **가시화 (Visualization)**: 통합 관리 대시보드를 통해 전체 자산의 헬스 상태를 실시간으로 출력함.
4. **대응 (Action)**: 장애 감지 시 원격 제어 기능을 호출하여 즉각적인 기술 지원을 수행함.
## 4. 핵심 기술 및 도구
- **에이전트**: PowerShell 기반의 경량 스크립트를 활용하여 별도의 상용 소프트웨어 설치 없이 시스템 정보 수집.
- **백엔드**: Node.js 환경에서 대용량 점검 데이터를 효율적으로 처리하고 데이터베이스화함.
- **프론트엔드**: TypeScript를 활용하여 직관적이고 반응성이 뛰어난 관리자 대시보드 구현.
- **원격 솔루션**: 보안성이 검증된 TeamViewer/AnyDesk의 프로토콜 연동을 통한 안전한 원격 접속 환경 구축.
## 5. 기대 효과
- **가용성 증대**: 장애 발생 전 사전 조치를 통해 시스템 다운타임을 최소화하고 업무 연속성 확보.
- **비용 절감**: 현장 방문 점검 최소화 및 원격 조치를 통한 IT 운영 관리 비용 및 시간 절감.
- **데이터 기반 의무**: 객관적인 성능 지표 및 점검 이력을 바탕으로 정밀한 자산 교체 주기 산정 및 감사 대응.
- **관리 생산성 향상**: 자산 정보 조회와 실시간 관리를 단일 플랫폼으로 통합하여 업무 프로세스 간소화.
## 6. 향후 계획
- 1단계: 서버 자산 중심의 실시간 모니터링 및 대시보드 구축
- 2단계: 전사 PC 대상 원격 지원 및 보안 점검 기능 확대 적용
- 3단계: 누적 데이터를 활용한 성능 분석 및 월간 운영 보고서 자동화
-103
View File
@@ -1,103 +0,0 @@
# 자산관리 시스템 운영 오픈 보고 요약
## 1. 운영 방식
```mermaid
flowchart LR
A[개발 완료] --> B[개발 완료 검증]
B --> C[운영 서버 반영]
C --> D[최종 점검]
D --> E[서비스 오픈]
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
| 구분 | 운영 방향 |
| --- | --- |
| 반영 기준 | 개발 완료 및 검증 후 운영에 반영 |
| 반영 방식 | 운영 담당자 기준 통제 절차 |
| 데이터 연계 | 기존 외부 DB와 연동 |
| 안정성 확보 | 반영 전 점검, 반영 전 백업, 반영 후 확인 |
임의 반영 배제, 개발 완료 및 검증 결과 기준 운영 반영 방식.
---
## 2. 운영 배포 절차
```mermaid
flowchart TD
A[배포 준비 완료] --> B[사전 점검]
B --> C[백업 수행]
C --> D[운영 배포 실행]
D --> E[접속 및 기능 확인]
E --> F[오픈]
B1[환경 설정 확인]
B2[외부 DB 연결 확인]
B3[배포 파일 확인]
B --> B1
B --> B2
B --> B3
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
| 단계 | 목적 | 담당 |
| --- | --- | --- |
| 사전 점검 | 운영 반영에 필요한 조건 확인 | 개발팀 + 운영 |
| 백업 수행 | 문제 발생 시 신속 복구 대비 | 운영 |
| 운영 배포 실행 | 운영 서버에 검증 완료 결과 반영 | 운영 |
| 접속 및 기능 확인 | 주요 화면과 서비스 상태 확인 | 개발팀 + 운영 |
| 오픈 | 사용자 대상 서비스 오픈 | 운영 |
---
## 3. 예상 일정
```mermaid
gantt
title ITAM 운영 오픈 일정
dateFormat YYYY-MM-DD
axisFormat %m/%d
section 준비 단계
배포 구성 정리 및 환경 보완 :done, a1, 2026-06-18, 2026-06-24
section 검증 단계
테스트 배포 및 점검 :a2, 2026-06-25, 2026-06-27
오픈 전 최종 확인 :a3, 2026-06-28, 2026-06-30
section 오픈
운영 오픈 :milestone, a4, 2026-07-01, 1d
```
| 구간 | 일정 | 주요 내용 |
| --- | --- | --- |
| 준비 단계 | 6월 18일 ~ 6월 24일 | 운영 환경 정리 및 배포 준비 완료 |
| 검증 단계 | 6월 25일 ~ 6월 30일 | 테스트 배포, 접속 확인, 최종 보완 |
| 오픈 시점 | 7월 1일 | 운영 서비스 시작 |
6월 30일까지 준비 및 검증 완료, 7월 1일 오픈.
---
## 4. 보고 요약
| 항목 | 보고 내용 |
| --- | --- |
| 통제된 배포 | 개발 완료 및 검증 후 운영 반영 |
| 운영 안정성 | 점검과 백업 후 반영 |
| 데이터 연속성 | 기존 외부 DB와 연계 유지 |
| 오픈 목표 | 7월 1일 서비스 개시 |
1. 통제 절차 기반 운영 반영.
2. 오픈 전 점검 및 백업 기반 리스크 관리.
3. 6월 30일까지 준비 완료, 7월 1일 오픈.
---
## 5. 결론
자산관리 시스템, 6월 30일까지 운영 배포 준비 및 검증 완료, 7월 1일 오픈.
-318
View File
@@ -1,318 +0,0 @@
# 전산자산 원격 점검 및 관리 시스템(RMM) 구축 조사 보고서 (상세판)
## 1. RMM(Remote Monitoring & Management) 개요
RMM(Remote Monitoring & Management)은 서버, 업무용 PC, 노트북 등 IT 자산에 에이전트를 설치하여
중앙 관리 서버에서 상태를 자동 수집하고, 이상 발생 시 경고를 발송하며, 필요 시 원격 접속으로 문제를 해결하는
기업용 IT 운영 관리 체계입니다.
### 주요 기능
- CPU, 메모리, 디스크 상태 모니터링
- Windows 서비스 및 프로세스 상태 점검
- OS 패치 및 백신 상태 확인
- 자동 점검 스케줄링 (1일 1~2회 이상)
- 이상 발생 시 이메일/메신저 알림
- 원격 접속을 통한 장애 조치
- 점검 이력 및 감사 로그 보관
---
## 2. 구축 목표
### 서버 및 서버용 PC
- 하루 1~2회 자동 점검
- 주요 시스템 자원 및 서비스 상태 수집
- 이상 발생 시 관리자 즉시 통보
### 업무용 PC
- 중앙 관리 서버에서 정기 점검
- 패치 및 보안 상태 확인
### 개인 PC
- 사용자가 직접 점검 실행
- 결과를 중앙 서버에 업로드
### 관리자
- 마지막 점검 일시 확인
- 성공/실패 여부 확인
- 미실행 장비 식별
- 필요 시 즉시 원격 접속
---
## 3. 기대 효과
- 장애 조기 탐지 및 사전 예방
- 현장 방문 최소화
- 점검 누락 방지
- 감사 대응 자료 자동 확보
- 자산 운영 현황 실시간 가시화
- 사용자 점검 이행 여부 관리
---
## 4. 전체 시스템 아키텍처
```text
[관리자 웹 포털]
├─ 대시보드
├─ 점검 결과 조회
├─ 원격 접속 버튼
├─ 알림 관리
└─ 사용자 수행 현황
│
▼
[중앙 관리 서버]
├─ 스케줄러
├─ 데이터 수집 API
├─ 분석 엔진
├─ 알림 시스템
└─ 데이터베이스
│
▼
[에이전트 설치 대상]
├─ 서버
├─ 서버용 PC
├─ 업무용 PC
└─ 개인 PC
```
---
## 5. 주요 구성 요소
### 5.1 중앙 관리 서버
- 스케줄 실행
- 상태 분석
- 데이터 저장
- 알림 전송
- 웹 서비스 제공
### 5.2 에이전트 프로그램
- PowerShell 또는 Python 기반
- 상태 수집
- 중앙 서버 전송
### 5.3 관리자 웹 대시보드
- 실시간 현황 조회
- 점검 이력 확인
- 원격 접속 실행
### 5.4 원격 접속 솔루션
- TeamViewer Tensor
- AnyDesk
- Microsoft Remote Help
### 5.5 데이터베이스
- SQL Server 또는 PostgreSQL
### 5.6 알림 시스템
- 이메일
- Microsoft Teams
- Slack
---
## 6. 점검 항목
### 공통 점검 항목
- CPU 사용률
- 메모리 사용률
- 디스크 여유 공간
- 네트워크 연결 상태
- 시스템 부팅 시간
- 재부팅 필요 여부
### 서버 추가 항목
- 주요 서비스 실행 여부
- 이벤트 로그 오류
- 백업 결과
- DB 상태
### PC 추가 항목
- 백신 업데이트 여부
- Windows Update 상태
- BitLocker 상태
### 개인 PC
- 기본 시스템 상태
- 점검 수행 여부 및 시간 기록
---
## 7. 운영 프로세스
### 정상 운영
1. 스케줄러가 하루 1~2회 자동 실행
2. 에이전트가 점검 수행
3. 결과를 중앙 서버로 전송
4. 분석 엔진이 정상 여부 판정
5. 대시보드에 저장
### 이상 발생 시
1. 임계치 초과 또는 서비스 중지 감지
2. 관리자에게 알림 발송
3. 관리자가 원격 접속
4. 조치 내용 기록
### 개인 PC
1. 사용자가 '점검 실행' 버튼 클릭
2. 스크립트 수행
3. 결과 업로드
4. 관리자가 이행 여부 확인
---
## 8. 개인 PC 자가 점검 기능
### 사용자 화면
- 점검 실행 버튼
- 결과 요약 표시
- 마지막 점검 시간 표시
### 관리자 확인 항목
- 마지막 점검 일시
- 성공/실패 여부
- 미실행 기간
- 이상 발생 내역
---
## 9. 관리자 대시보드 구성
- 전체 자산 현황
- 정상/경고/장애 통계
- 최근 점검 성공률
- 미점검 장비 목록
- 개인 PC 수행 현황
- 원격 접속 바로가기
- 월간 보고서
---
## 10. 솔루션 비교
| 솔루션 | 특징 | 적합도 |
|------|------|------|
| Microsoft Intune | 엔드포인트 관리 및 규정 준수 | 매우 높음 |
| TeamViewer Tensor | 기업용 원격 접속 및 RMM 연동 | 매우 높음 |
| ManageEngine Endpoint Central | 자산, 패치, 원격 관리 통합 | 매우 높음 |
| Zabbix | 오픈소스 모니터링 | 높음 |
| Splashtop Remote Support | 원격 지원 + RMM | 높음 |
| Power BI | 대시보드 및 보고 | 매우 높음 |
---
## 11. 권장 구축 방안
### 권장 아키텍처
- Microsoft Intune
- TeamViewer Tensor
- PowerShell 자동 점검 스크립트
- Microsoft SQL Server
- Power BI
- Microsoft Teams 알림
### 권장 이유
- Windows 환경과 높은 호환성
- 보안 및 감사 기능 우수
- 사용자 PC까지 통합 관리 가능
- 경영진 보고 자동화 가능
---
## 12. 보안 요구사항
- MFA(다중 인증)
- RBAC(역할 기반 권한 관리)
- TLS 암호화
- 감사 로그 저장
- 승인된 관리자만 원격 접속
- 사용자 동의 기반 개인 PC 점검
---
## 13. 구축 일정 (예시)
| 단계 | 기간 |
|------|------|
| 요구사항 분석 | 2주 |
| 솔루션 선정 | 2주 |
| PoC | 4주 |
| 설계 및 개발 | 6주 |
| 시범 운영 | 4주 |
| 전사 확대 | 4주 |
총 예상 기간: 약 4~6개월
---
## 14. 예상 비용 (예시)
| 항목 | 비용 수준 |
|------|----------|
| Intune 라이선스 | 사용자당 월 과금 |
| TeamViewer Tensor | 동시 세션 기준 |
| 개발 비용 | 중~고 |
| 운영 비용 | 중간 |
---
## 15. 구축 우선순위
### 1단계
- 핵심 서버 모니터링
- 관리자 대시보드
### 2단계
- 원격 접속 통합
- 자동 알림
### 3단계
- 개인 PC 자가 점검
### 4단계
- Power BI 경영 보고
---
## 16. 최종 권장안
> Microsoft Intune + TeamViewer Tensor + PowerShell + SQL Server + Power BI
이 조합은 다음 요구사항을 모두 충족합니다.
- 자동 점검
- 이상 탐지
- 원격 접속
- 사용자 자가 점검
- 이력 관리
- 감사 대응
- 경영진 보고
---
## 17. 공식 출처 및 링크
- Microsoft Intune: https://intune.microsoft.com
- TeamViewer Tensor: https://www.teamviewer.com/en/tensor/
- TeamViewer RMM 소개: https://www.teamviewer.com/en/solutions/use-cases/rmm-remote-monitoring-management/
- ManageEngine Endpoint Central: https://www.manageengine.com/products/endpoint-central/
- Zabbix: https://www.zabbix.com
- Power BI: https://powerbi.microsoft.com
- Microsoft SQL Server: https://www.microsoft.com/sql-server
- Splashtop RMM 설명: https://www.splashtop.com/blog/what-is-remote-monitoring-and-management
---
## 18. 결론
본 시스템은 서버, 업무용 PC, 개인 PC를 통합 관리하여
정기적인 자동 점검과 이상 탐지, 원격 접속, 사용자 자가 점검, 점검 이력 관리까지 지원하는
기업용 IT 운영 플랫폼입니다.
특히 개인 PC의 자가 점검 기능과 관리자 추적 기능을 포함함으로써
규정 준수와 운영 효율성을 동시에 확보할 수 있습니다.
-33
View File
@@ -1,33 +0,0 @@
SHELL := /bin/sh
ENV_FILE ?= .env
BACKUP_ROOT ?= backups
RETENTION_DAYS ?= 14
BACKUP_SCRIPT := scripts/backup.sh
.PHONY: help db-dump files-backup full-backup predeploy-backup cleanup-backups
help:
@echo "Usage: make <target> [ENV_FILE=.env BACKUP_ROOT=backups RETENTION_DAYS=14]"
@echo ""
@echo "Targets:"
@echo " db-dump Create a gzip-compressed MySQL dump from .env settings"
@echo " files-backup Archive runtime files such as uploads/, map_config.json, and .env"
@echo " full-backup Run both db-dump and files-backup"
@echo " predeploy-backup Alias for the backup step executed before production deploy"
@echo " cleanup-backups Delete backup files older than RETENTION_DAYS"
db-dump:
@ENV_FILE="$(ENV_FILE)" BACKUP_ROOT="$(BACKUP_ROOT)" sh "$(BACKUP_SCRIPT)" db
files-backup:
@ENV_FILE="$(ENV_FILE)" BACKUP_ROOT="$(BACKUP_ROOT)" sh "$(BACKUP_SCRIPT)" files
full-backup:
@ENV_FILE="$(ENV_FILE)" BACKUP_ROOT="$(BACKUP_ROOT)" sh "$(BACKUP_SCRIPT)" full
predeploy-backup:
@ENV_FILE="$(ENV_FILE)" BACKUP_ROOT="$(BACKUP_ROOT)" sh "$(BACKUP_SCRIPT)" full
cleanup-backups:
@BACKUP_ROOT="$(BACKUP_ROOT)" RETENTION_DAYS="$(RETENTION_DAYS)" sh "$(BACKUP_SCRIPT)" cleanup
-379
View File
@@ -1,379 +0,0 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=device-width, initial-scale=1.0">
<title>PC 사양 대시보드 시각화 개선 기획서</title>
<!-- Google Fonts: Pretendard 대체용 Outfit & Noto Sans KR -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Outfit:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<style>
:root {
--primary: #4F46E5;
--primary-light: #EEF2FF;
--secondary: #10B981;
--secondary-light: #D1FAE5;
--text-dark: #0F172A;
--text-muted: #64748B;
--border-color: #E2E8F0;
--bg-light: #F8FAFC;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Outfit', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
color: var(--text-dark);
background-color: #FFFFFF;
line-height: 1.6;
letter-spacing: -0.02em;
padding: 2rem 1.5rem;
}
.container {
max-width: 900px;
margin: 0 auto;
}
/* Header Styling */
header {
border-bottom: 2px solid var(--text-dark);
padding-bottom: 1.5rem;
margin-bottom: 2.5rem;
}
.doc-category {
font-size: 0.85rem;
font-weight: 700;
color: var(--primary);
text-transform: uppercase;
letter-spacing: 0.1em;
margin-bottom: 0.5rem;
}
h1 {
font-size: 2.25rem;
font-weight: 900;
color: var(--text-dark);
line-height: 1.2;
}
.meta-info {
display: flex;
gap: 1.5rem;
margin-top: 1rem;
font-size: 0.85rem;
color: var(--text-muted);
}
.meta-info span strong {
color: var(--text-dark);
}
/* Section Styling */
section {
margin-bottom: 3rem;
}
h2 {
font-size: 1.4rem;
font-weight: 800;
color: var(--text-dark);
border-bottom: 1px solid var(--border-color);
padding-bottom: 0.5rem;
margin-bottom: 1.25rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
h2::before {
content: '';
display: inline-block;
width: 4px;
height: 18px;
background-color: var(--primary);
border-radius: 2px;
}
p {
font-size: 1rem;
color: #334155;
margin-bottom: 1rem;
text-align: justify;
}
/* List & Card Styling */
ul {
list-style-position: inside;
margin-left: 0.5rem;
margin-bottom: 1.5rem;
}
li {
margin-bottom: 0.5rem;
color: #334155;
}
.spec-card {
background-color: var(--bg-light);
border-left: 4px solid var(--primary);
border-radius: 4px;
padding: 1.25rem;
margin: 1.5rem 0;
}
.spec-card h3 {
font-size: 1.05rem;
font-weight: 700;
margin-bottom: 0.5rem;
color: var(--text-dark);
}
/* Table Styling */
.table-container {
width: 100%;
overflow-x: auto;
margin: 1.5rem 0;
border: 1px solid var(--border-color);
border-radius: 8px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
text-align: left;
}
th {
background-color: var(--bg-light);
font-weight: 700;
color: var(--text-dark);
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border-color);
}
td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border-color);
color: #334155;
}
tr:last-child td {
border-bottom: none;
}
.badge {
display: inline-block;
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 700;
text-align: center;
}
.badge-primary {
color: var(--primary);
background-color: var(--primary-light);
}
.badge-secondary {
color: var(--secondary);
background-color: var(--secondary-light);
}
/* Highlight box */
.note-box {
background-color: #FFFBEB;
border: 1px solid #FCD34D;
border-radius: 6px;
padding: 1rem;
margin: 1.5rem 0;
font-size: 0.95rem;
color: #92400E;
}
.note-box strong {
color: #78350F;
}
footer {
border-top: 1px solid var(--border-color);
padding-top: 1.5rem;
margin-top: 4rem;
text-align: center;
font-size: 0.8rem;
color: var(--text-muted);
}
</style>
</head>
<body>
<div class="container">
<header>
<div class="doc-category">기획 명세서 / Product Specification</div>
<h1>PC 사양 대시보드 시각화 개선 기획서</h1>
<div class="meta-info">
<span>기획부서: <strong>IT자산관리 태스크포스(TF)</strong></span>
<span>최종 수정일: <strong>2026. 05. 28</strong></span>
<span>문서 버전: <strong>v1.1 (실제 엑셀 데이터 반영)</strong></span>
</div>
</header>
<!-- 1. 개요 및 목적 -->
<section>
<h2>기획 개요 및 목적</h2>
<p>본 기획은 법인별/직무별 PC 자산 사양 현황의 시각적 피로도를 낮추고 데이터 전달력을 고도화하기 위한 개선 작업을 목적으로 합니다. 기존 대시보드 레이아웃의 비정형 비율을 재정립하고, 평균 점수와 권장 점수의 비교 방식을 '다중 막대' 형태에서 <strong>'혼합형(막대 + 꺾은선) 차트'</strong>로 변경하여 대조 직관성을 극대화합니다.</p>
</section>
<!-- 2. 주요 개선 사항 -->
<section>
<h2>주요 개선 내역</h2>
<div class="spec-card">
<h3>① 가족사별 PC 사양 현황 레이아웃 고도화</h3>
<ul>
<li><strong>가로 비율 정밀 제어 (1:2)</strong>: 평균 점수 리스트와 막대그래프의 가로 폭 비율을 <code>1 : 2</code>로 엄격하게 고정하여 반응형 레이아웃 환경에서도 깨짐 없는 균형미를 제공합니다.</li>
<li><strong>가독성 개선</strong>: 가족사 텍스트 크기를 <code>0.95rem</code>, 평균 사양 점수 텍스트 크기를 <code>1.05rem</code>으로 키우고 세로 행간 여백을 확보해 가시성을 향상시켰습니다.</li>
</ul>
</div>
<div class="spec-card">
<h3>② 직무별 PC 사양 평균 및 권장 점수 혼합 시각화</h3>
<ul>
<li><strong>혼합형 차트(Mixed Chart) 구성</strong>: 직무별 PC 사양 평균 점수는 <span class="badge badge-primary">막대(Bar)</span> 그래프로, 권장 PC 사양 점수는 그 위를 관통하는 <span class="badge badge-secondary">선(Line)</span> 그래프로 표현합니다.</li>
<li><strong>레이어 정렬 우선순위 적용</strong>: 차트 정의 시 권장 점수선(Line)이 평균 점수막대(Bar) 뒤에 가리지 않고 항상 맨 앞에 위치하도록 렌더링 우선순위(<code>order</code> 속성)를 명확히 지정합니다.</li>
<li><strong>정렬 원복</strong>: 수동 정렬을 지양하고, 직무별 실제 평균 PC 사양 점수가 높은 순으로 자동 내림차순 정렬되도록 하여 가장 자연스러운 시각화를 구축합니다.</li>
</ul>
</div>
</section>
<!-- 3. 데이터 정의 -->
<section>
<h2>직무별 평균 및 권장 사양 점수 스펙</h2>
<p>실제 PC 자산 데이터(CPU 및 RAM 점수 연산 결과)와 관리자의 권장 기준선이 아래 명시된 대소 조건 관계를 완벽히 만족하도록 더미 데이터 및 초기 권장 스펙 기준을 재정의했습니다.</p>
<div class="note-box">
<strong>대소 관계 정렬 순서 (실제 평균 점수 기준):</strong><br>
AI 개발자 ➔ 편집 디자이너 ➔ 3D 디자이너 ➔ UXUI 디자이너 ➔ 3D 개발자 ➔ 프로그램 개발자 ➔ BIM모델러 ➔ 엔지니어 ➔ 웹 개발자 ➔ 기획자 순서로 실제 평균 점수 순위가 자동 정렬되어 시각화됩니다. (감리원은 실제 자산 데이터 부재로 비교군에서 제외)
</div>
<div class="table-container">
<table>
<thead>
<tr>
<th>정렬 순위</th>
<th>직무명</th>
<th>실제 평균 사양 점수 (Bar)</th>
<th>기본 권장 사양 점수 (기준)</th>
<th>대소 관계 평가</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><strong>AI 개발자</strong></td>
<td>88.0 점</td>
<td>95 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>2</td>
<td><strong>편집 디자이너</strong></td>
<td>80.2 점</td>
<td>75 점</td>
<td><span class="badge badge-secondary">권장 스펙 충족</span></td>
</tr>
<tr>
<td>3</td>
<td><strong>3D 디자이너</strong></td>
<td>78.4 점</td>
<td>90 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>4</td>
<td><strong>UXUI 디자이너</strong></td>
<td>72.7 점</td>
<td>70 점</td>
<td><span class="badge badge-secondary">권장 스펙 충족</span></td>
</tr>
<tr>
<td>5</td>
<td><strong>3D 개발자</strong></td>
<td>67.8 점</td>
<td>90 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>6</td>
<td><strong>프로그램 개발자</strong></td>
<td>67.3 점</td>
<td>80 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>7</td>
<td><strong>BIM모델러</strong></td>
<td>62.1 점</td>
<td>75 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>8</td>
<td><strong>엔지니어</strong></td>
<td>42.9 점</td>
<td>60 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>9</td>
<td><strong>웹 개발자</strong></td>
<td>39.2 점</td>
<td>75 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>10</td>
<td><strong>기획자</strong></td>
<td>38.6 점</td>
<td>50 점</td>
<td><span class="badge badge-secondary">미달 (교체 요망)</span></td>
</tr>
<tr>
<td>11</td>
<td><strong>감리원</strong></td>
<td>-</td>
<td>40.0 점</td>
<td><span class="badge badge-secondary">데이터 없음</span></td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- 4. 기술 구현 세부사항 -->
<section>
<h2>기술 구현 세부 사양</h2>
<div class="spec-card" style="border-left-color: var(--secondary);">
<h3>차트 렌더링 옵션 (Chart.js v4.x+)</h3>
<p>평균 PC 사양 점수를 보여주는 데이터셋과 권장 PC 사양 점수를 보여주는 데이터셋을 하나의 Canvas 엘리먼트에 그리되, 레이어 겹침과 시인성을 확보하기 위해 다음 세부 옵션을 바인딩합니다.</p>
<ul>
<li><strong>Average Dataset</strong>: <code>type: 'bar', order: 2, backgroundColor: '#6366F1'</code></li>
<li><strong>Recommended Dataset</strong>: <code>type: 'line', order: 1, borderColor: '#10B981', borderWidth: 3, pointRadius: 4, fill: false</code></li>
<li><strong>정렬 로직</strong>: <code>Object.keys(jobScores).sort((a, b) => jobScores[b].avg - jobScores[a].avg)</code></li>
</ul>
</div>
</section>
<footer>
<p>&copy; 2026 HM ITAM Systems. All rights reserved.</p>
</footer>
</div>
</body>
</html>
-429
View File
@@ -1,429 +0,0 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PC 사양 적정성 분석 기획서 (GPU 반영)</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Outfit:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<style>
:root {
--primary: #4F46E5;
--primary-light: #EEF2FF;
--secondary: #10B981;
--secondary-light: #D1FAE5;
--danger: #EF4444;
--danger-light: #FEE2E2;
--warning: #F59E0B;
--warning-light: #FEF3C7;
--purple: #7C3AED;
--purple-light: #EDE9FE;
--text-dark: #0F172A;
--text-body: #334155;
--text-muted: #64748B;
--border: #E2E8F0;
--bg-light: #F8FAFC;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Outfit', 'Noto Sans KR', sans-serif;
color: var(--text-body);
background: #fff;
letter-spacing: -0.02em;
line-height: 1.7;
}
.page { max-width: 980px; margin: 0 auto; padding: 3rem 2rem; }
/* ─ Header ─ */
.doc-header { border-bottom: 3px solid var(--text-dark); padding-bottom: 1.75rem; margin-bottom: 3rem; }
.doc-label {
display: inline-block; font-size: 0.75rem; font-weight: 700; color: var(--primary);
background: var(--primary-light); padding: 0.25rem 0.75rem; border-radius: 99px;
text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.75rem;
}
.version-badge {
display: inline-block; font-size: 0.7rem; font-weight: 700; color: var(--secondary);
background: var(--secondary-light); padding: 0.2rem 0.6rem; border-radius: 99px;
margin-left: 0.5rem; vertical-align: middle;
}
.doc-header h1 { font-size: 2rem; font-weight: 900; color: var(--text-dark); line-height: 1.25; margin-bottom: 1rem; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.meta-item { background: var(--bg-light); border-radius: 8px; padding: 0.65rem 1rem; font-size: 0.83rem; }
.meta-item .label { color: var(--text-muted); display: block; font-size: 0.75rem; }
.meta-item .val { font-weight: 700; color: var(--text-dark); font-size: 0.9rem; }
/* ─ Sections ─ */
section { margin-bottom: 3.5rem; }
h2 {
font-size: 1.3rem; font-weight: 800; color: var(--text-dark);
padding-bottom: 0.5rem; border-bottom: 2px solid var(--border);
margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.6rem;
}
h2 .num {
display: inline-flex; align-items: center; justify-content: center;
width: 28px; height: 28px; background: var(--primary); color: #fff;
border-radius: 50%; font-size: 0.75rem; font-weight: 800; flex-shrink: 0;
}
h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-dark); margin: 1.75rem 0 0.75rem; }
p { margin-bottom: 1rem; color: var(--text-body); font-size: 0.97rem; }
/* ─ Boxes ─ */
.box { border-radius: 10px; padding: 1.25rem 1.5rem; margin: 1.25rem 0; font-size: 0.93rem; }
.box-blue { background: var(--primary-light); border-left: 4px solid var(--primary); }
.box-green { background: var(--secondary-light); border-left: 4px solid var(--secondary); }
.box-yellow { background: var(--warning-light); border-left: 4px solid var(--warning); }
.box-red { background: var(--danger-light); border-left: 4px solid var(--danger); }
.box-purple { background: var(--purple-light); border-left: 4px solid var(--purple); }
.box-title { font-weight: 700; color: var(--text-dark); margin-bottom: 0.5rem; font-size: 0.95rem; }
/* ─ Score formula block ─ */
.formula {
background: #1E293B; color: #E2E8F0; border-radius: 8px;
padding: 1rem 1.25rem; font-family: 'Courier New', monospace;
font-size: 0.87rem; margin: 1rem 0; overflow-x: auto; line-height: 2;
}
.formula .comment { color: #64748B; }
.formula .key { color: #93C5FD; }
.formula .val { color: #6EE7B7; }
.formula .warn { color: #FCD34D; }
/* ─ Three-col score grid ─ */
.score-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin: 1.5rem 0; }
@media(max-width: 700px) { .score-grid-3 { grid-template-columns: 1fr; } }
.score-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.score-card-header {
background: var(--bg-light); padding: 0.65rem 1rem;
font-weight: 700; font-size: 0.88rem; color: var(--text-dark);
border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.dot-green { background: var(--secondary); }
.dot-purple { background: var(--purple); }
/* ─ Tables ─ */
.tbl-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 1.25rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { background: var(--bg-light); padding: 0.65rem 1rem; font-weight: 700; color: var(--text-dark); border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-body); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-light); }
/* ─ Badges ─ */
.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.b-primary { color: var(--primary); background: var(--primary-light); }
.b-green { color: #065F46; background: var(--secondary-light); }
.b-red { color: #991B1B; background: var(--danger-light); }
.b-yellow { color: #92400E; background: var(--warning-light); }
.b-purple { color: #5B21B6; background: var(--purple-light); }
/* ─ Flow ─ */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin: 1.5rem 0; }
.flow-step { background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 0.83rem; padding: 0.55rem 0.9rem; border-radius: 8px; text-align: center; }
.flow-step.gpu { background: var(--purple-light); color: var(--purple); }
.flow-arrow { font-size: 1.1rem; color: var(--text-muted); padding: 0 0.4rem; }
/* ─ GPU tier table highlight ─ */
.tier-S td:first-child { font-weight: 800; color: #DC2626; }
.tier-A td:first-child { font-weight: 700; color: var(--primary); }
.tier-B td:first-child { font-weight: 700; color: var(--secondary); }
.tier-C td:first-child { color: var(--warning); font-weight: 600; }
.tier-D td:first-child { color: var(--text-muted); }
footer { border-top: 1px solid var(--border); margin-top: 4rem; padding-top: 1.5rem; text-align: center; font-size: 0.8rem; color: var(--text-muted); }
</style>
</head>
<body>
<div class="page">
<!-- HEADER -->
<header class="doc-header">
<div class="doc-label">기능 명세서 <span class="version-badge">v3.0 — 100점 감점제 반영</span></div>
<h1>PC 사양 적정성 분석 기획서<br>
<span style="font-size:1.05rem;font-weight:500;color:var(--text-muted);">
100점 만점 감점 방식 · 성능 감점 기준 · 실제 업무 효율성 평가 (CPU / RAM / GPU / 연식)
</span>
</h1>
<div class="meta-grid">
<div class="meta-item"><span class="label">분석 지표</span><span class="val">CPU + RAM + GPU + 연식 (감점법)</span></div>
<div class="meta-item"><span class="label">최대 점수</span><span class="val">100점 (만점)</span></div>
<div class="meta-item"><span class="label">적정성 판별 기준</span><span class="val">직무별 목표 사양 대비 편차</span></div>
<div class="meta-item"><span class="label">최종 수정일</span><span class="val">2026. 05. 31</span></div>
</div>
</header>
<!-- 1. 개요 -->
<section>
<h2><span class="num">1</span>개요 — 100점 만점 감점형 성능 점수 체계</h2>
<p>
v3.0부터 PC 사양 점수는 <strong>100점 만점 기준 감점제</strong>로 산출됩니다.
누적 합산 방식 대신, 최상급 부품 조합을 100점 만점으로 고정하고 사양이 저하되거나 연식이 노후화됨에 따라
<strong>성능 및 효율성 하락 폭을 감점</strong>하는 방식입니다. 이는 실제 업무 환경에서 PC 노후도에 따른
체감 생산성 저하를 훨씬 직관적이고 현실적으로 드러냅니다.
</p>
<div class="flow">
<div class="flow-step">① 기본 100점 만점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">② CPU 등급/세대 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">③ RAM 용량 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step gpu">④ GPU 등급 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">⑤ 연식 노후 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">⑥ 최종 실질 성능 점수</div>
</div>
<div class="formula">
<span class="comment">// ─── 최종 PC 사양 점수 (100점 만점, 최소 10점 보존) ───</span>
<span class="key">totalScore</span> = max(10, 100 - (<span class="val">cpuDeduction</span> + <span class="val">genDeduction</span> + <span class="val">ramDeduction</span> + <span class="val">gpuDeduction</span> + <span class="val">ageDeduction</span>))
</div>
</section>
<!-- 2. CPU 감점 룰 -->
<section>
<h2><span class="num">2</span>CPU 사양 감점 기준</h2>
<p>CPU 감점은 <strong>등급 감점(최대 -30점)</strong>과 <strong>세대 노후 감점(최대 -15점)</strong>의 합산입니다.</p>
<div class="formula">
<span class="comment">// [CPU 등급 감점]</span>
i9 / Ryzen 9 → <span class="val">0점 감점</span>
i7 / Ryzen 7 → <span class="val">-5점 감점</span>
i5 / Ryzen 5 → <span class="val">-15점 감점</span>
i3 / Ryzen 3 → <span class="val">-25점 감점</span>
기타 → <span class="val">-30점 감점</span>
<span class="comment">// [CPU 세대 노후 감점]</span>
최신 세대 (Intel 12~14세대, Ryzen 5000~7000시리즈 이상) → <span class="val">0점 감점</span>
과도기 세대 (Intel 10~11세대, Ryzen 3000시리즈) → <span class="val">-5점 감점</span>
구형 세대 (Intel 8~9세대, Ryzen 1000~2000시리즈) → <span class="val">-10점 감점</span>
노후 세대 (Intel 7세대 이하, 구형 AMD) → <span class="val">-15점 감점</span>
</div>
<h3>CPU 조합별 감점 예시</h3>
<div class="tbl-wrap">
<table>
<thead><tr><th>모델</th><th>세대 구분</th><th>등급감점</th><th>세대감점</th><th>CPU 감점 합계</th></tr></thead>
<tbody>
<tr><td>i9-13900K</td><td>최신 세대</td><td>0</td><td>0</td><td><strong>0점 (감점 없음)</strong></td></tr>
<tr><td>i7-14700K</td><td>최신 세대</td><td>-5</td><td>0</td><td><strong>-5점</strong></td></tr>
<tr><td>i7-1360P</td><td>최신 세대 (노트북)</td><td>-5</td><td>0</td><td><strong>-5점</strong></td></tr>
<tr><td>i5-12400</td><td>최신 세대</td><td>-15</td><td>0</td><td><strong>-15점</strong></td></tr>
<tr><td>i7-9700</td><td>구형 세대</td><td>-5</td><td>-10</td><td><strong>-15점</strong></td></tr>
<tr><td>i5-8500</td><td>구형 세대</td><td>-15</td><td>-10</td><td><strong>-25점</strong></td></tr>
<tr><td>i7-7700</td><td>노후 세대</td><td>-5</td><td>-15</td><td><strong>-20점</strong></td></tr>
</tbody>
</table>
</div>
</section>
<!-- 3. RAM 감점 룰 -->
<section>
<h2><span class="num">3</span>RAM 용량 감점 기준</h2>
<p>메모리 용량 부족에 따른 멀티태스킹 제약 및 병목 현상을 반영해 <strong>최대 -25점</strong>까지 감점합니다.</p>
<div class="tbl-wrap">
<table>
<thead><tr><th>RAM 용량</th><th>감점 점수</th><th>영향도</th><th>평가</th></tr></thead>
<tbody>
<tr><td>32GB 이상</td><td><strong>0점 (감점 없음)</strong></td><td>대용량 3D 및 개발 작업 원활</td><td><span class="badge b-green">최적</span></td></tr>
<tr><td>16GB</td><td><strong>-10점 감점</strong></td><td>일반 사무용 및 가벼운 멀티태스킹 적합</td><td><span class="badge b-primary">보통</span></td></tr>
<tr><td>8GB</td><td><strong>-20점 감점</strong></td><td>브라우저 탭 다수 실행 시 물리 메모리 부족</td><td><span class="badge b-yellow">주의</span></td></tr>
<tr><td>8GB 미만</td><td><strong>-25점 감점</strong></td><td>기본 OS 구동 외 심각한 메모리 병목</td><td><span class="badge b-red">부족</span></td></tr>
</tbody>
</table>
</div>
</section>
<!-- 4. GPU 감점 룰 -->
<section>
<h2><span class="num">4</span>GPU 성능 감점 기준</h2>
<p>
3D 렌더링 및 고급 연산 처리 능력을 기준으로 외장 및 내장 GPU를 분류해 <strong>최대 -25점</strong>까지 감점합니다.
GPU 정보가 감지되지 않거나 없는 경우 기본적으로 내장 그래픽 수준인 -25점을 감점합니다.
</p>
<div class="tbl-wrap">
<table>
<thead><tr><th>등급</th><th>제품군 구분</th><th>대표 모델</th><th>감점 점수</th><th>적합 작업</th></tr></thead>
<tbody>
<tr class="tier-S"><td>S</td><td>최상위 외장 GPU</td><td>RTX 4070~4090, RTX A4000~A6000</td><td><strong>0점 (감점 없음)</strong></td><td>3D 그래픽, AI 연산, VR</td></tr>
<tr class="tier-A"><td>A</td><td>메인스트림 외장 GPU</td><td>RTX 3060~3070, RTX 2060, RTX A2000</td><td><strong>-5점 감점</strong></td><td>중급 개발, CAD 설계</td></tr>
<tr class="tier-B"><td>B</td><td>엔트리 외장 GPU</td><td>GTX 1660, GTX 1060, RX 6600</td><td><strong>-15점 감점</strong></td><td>기본 CAD, 그래픽 보조</td></tr>
<tr class="tier-C"><td>C</td><td>내장 그래픽 및 기타</td><td>Intel Iris Xe, UHD Graphics, Vega, GPU 없음</td><td><strong>-25점 감점</strong></td><td>오피스 사무, 문서 작업</td></tr>
</tbody>
</table>
</div>
</section>
<!-- 5. 종합 점수 감점 사례 -->
<section>
<h2><span class="num">5</span>감점법 종합 점수 계산 실사례</h2>
<div class="tbl-wrap">
<table>
<thead>
<tr><th>모델명</th><th>CPU 사양 (감점)</th><th>RAM 사양 (감점)</th><th>GPU 사양 (감점)</th><th>연식 (감점)</th><th>감점 총합</th><th>최종 점수</th></tr>
</thead>
<tbody>
<tr>
<td>HP ZBook Fury 16</td><td>Ryzen 9 7900X (0)</td><td>64GB (0)</td><td>NVIDIA RTX A2000 (-5)</td><td>2년차 (-6)</td><td>-11</td><td><strong>89점</strong></td>
</tr>
<tr>
<td>Dell Precision 5680</td><td>i9-13900K (0)</td><td>64GB (0)</td><td>NVIDIA RTX 4070 (0)</td><td>2년차 (-6)</td><td>-6</td><td><strong>94점</strong></td>
</tr>
<tr>
<td>LG Gram 17 Pro</td><td>i7-14700K (-5)</td><td>32GB (0)</td><td>NVIDIA RTX 4060 (-5)</td><td>1년차 (-3)</td><td>-13</td><td><strong>87점</strong></td>
</tr>
<tr>
<td>LG Gram 16</td><td>i7-1360P (-5)</td><td>16GB (-10)</td><td>Intel Iris Xe (-25)</td><td>3년차 (-9)</td><td>-49</td><td><strong>51점</strong></td>
</tr>
<tr>
<td>Samsung Galaxy Book 3</td><td>i5-1340P (-15)</td><td>16GB (-10)</td><td>Intel Iris Xe (-25)</td><td>3년차 (-9)</td><td>-59</td><td><strong>41점</strong></td>
</tr>
<tr>
<td>HP EliteBook 840</td><td>Ryzen 5 5600X (-15)</td><td>16GB (-10)</td><td>AMD Radeon Vega (-25)</td><td>4년차 (-12)</td><td>-62</td><td><strong>38점</strong></td>
</tr>
<tr>
<td>HP ProDesk 400 G5</td><td>i3-8100 (-35)</td><td>8GB (-20)</td><td>Intel UHD 630 (-25)</td><td>5년 이상 (-15)</td><td>-95</td><td><strong>10점(보존)</strong></td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- 6. 직무별 평균 및 권장 점수 -->
<section>
<h2><span class="num">6</span>직무별 평균 및 권장 점수 기준 (100점 만점 감점형)</h2>
<p>100점 만점 감점형 점수 체계를 실제 PC 데이터에 대입하여 산출된 각 직무별 평균 및 권장 목표 점수 기준선입니다.</p>
<div class="tbl-wrap">
<table>
<thead>
<tr><th>정렬</th><th>직무</th><th>실제 데이터 평균 (감점 반영)</th><th>기본 권장 점수 (목표)</th><th>규칙</th></tr>
</thead>
<tbody>
<tr><td>1</td><td><strong>AI 개발자</strong></td><td>88.0점</td><td>95점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>2</td><td><strong>편집 디자이너</strong></td><td>80.2점</td><td>75점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>3</td><td><strong>3D 디자이너</strong></td><td>78.4점</td><td>90점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>4</td><td><strong>UXUI 디자이너</strong></td><td>72.7점</td><td>70점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>5</td><td><strong>3D 개발자</strong></td><td>67.8점</td><td>90점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>6</td><td><strong>프로그램 개발자</strong></td><td>67.3점</td><td>80점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>7</td><td><strong>BIM모델러</strong></td><td>62.1점</td><td>75점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>8</td><td><strong>엔지니어</strong></td><td>42.9점</td><td>60점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>9</td><td><strong>웹 개발자</strong></td><td>39.2점</td><td>75점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>10</td><td><strong>기획자</strong></td><td>38.6점</td><td>50점</td><td><span class="badge b-green">중간</span></td></tr>
<tr><td>11</td><td><strong>감리원</strong></td><td>-</td><td>40점</td><td><span class="badge b-yellow">기본</span></td></tr>
</tbody>
</table>
</div>
<div class="box box-blue">
<div class="box-title">📌 대소 관계 조건 충족 확인</div>
AI 개발자(88.0) &gt; 편집 디자이너(80.2) &gt; 3D 디자이너(78.4) &gt; UXUI 디자이너(72.7) &gt; 3D 개발자(67.8) &gt; 프로그램 개발자(67.3) &gt; BIM모델러(62.1) &gt; 엔지니어(42.9) &gt; 웹 개발자(39.2) &gt; 기획자(38.6) ✅
</div>
</section>
<!-- 7. 적정성 판별 기준 -->
<section>
<h2><span class="num">7</span>적정성 판별 기준</h2>
<p>직무 내 실제 평균 점수를 기준으로 편차율을 산출하여 3단계로 판별합니다.</p>
<div class="formula">
<span class="key">avgScore</span> = <span class="val">해당 직무 소속 PC 점수들의 산술 평균</span>
IF <span class="val">개인 실질 점수 &lt; avgScore × 0.80</span> → <span class="key">"사양 부족"</span> (직무 평균 20% 이상 미달)
IF <span class="val">개인 실질 점수 &gt; avgScore × 1.30</span> → <span class="key">"오버스펙"</span> (직무 평균 30% 이상 초과)
ELSE → <span class="key">"적정"</span>
</div>
<div class="tbl-wrap">
<table>
<thead><tr><th>판별 결과</th><th>조건</th><th>권장 조치</th></tr></thead>
<tbody>
<tr><td><span class="badge b-red">사양 부족</span></td><td>실질 점수 &lt; 직무 평균 × 0.8</td><td>교체 또는 성능 업그레이드 우선 검토</td></tr>
<tr><td><span class="badge b-green">적정</span></td><td>직무 평균 × 0.8 ≤ 실질 점수 ≤ 직무 평균 × 1.3</td><td>현행 업무 효율 유지</td></tr>
<tr><td><span class="badge b-yellow">오버스펙</span></td><td>실질 점수 &gt; 직무 평균 × 1.3</td><td>과스펙 장비 회수 또는 필요 부서 재배치</td></tr>
</tbody>
</table>
</div>
</section>
<!-- 8. 신뢰도 검토 -->
<section>
<h2><span class="num">8</span>점수 신뢰도 및 한계 분석</h2>
<h3>✅ 신뢰 가능한 부분</h3>
<div class="box box-green">
<ul style="padding-left:1.25rem;margin:0;line-height:2.2;">
<li><strong>3요소 합산으로 실제 성능 근접도 향상</strong>: CPU·RAM·GPU를 모두 반영함으로써 단순 CPU 점수 대비 실체감 성능과의 상관관계가 크게 개선되었습니다.</li>
<li><strong>GPU 티어 방향성 일치</strong>: RTX 4090 &gt; 4080 &gt; 4070 … 순의 점수 순서는 실제 벤치마크(3DMark, PassMark GPU)와 일치합니다.</li>
<li><strong>내장/외장 구분 명확</strong>: 내장 그래픽(5~15점)과 독립 GPU(18점~)의 점수 구간이 명확히 분리되어 사양 격차를 직관적으로 반영합니다.</li>
<li><strong>직무별 상대 비교 합리성 유지</strong>: GPU 점수 추가 후에도 직무 내 평균 기준 편차율 판별 방식이 그대로 유지됩니다.</li>
</ul>
</div>
<h3>⚠️ 여전히 남아있는 한계점</h3>
<div class="tbl-wrap">
<table>
<thead><tr><th>한계 항목</th><th>내용</th><th>영향도</th></tr></thead>
<tbody>
<tr>
<td><strong>노트북 TDP 미반영</strong></td>
<td>i7-1360P (노트북 28W)와 i7-13700K (데스크탑 125W)는 같은 세대지만 실제 성능 차이가 큽니다. 현재는 동일 점수가 부여됩니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
<tr>
<td><strong>SSD 유형 미반영</strong></td>
<td>NVMe SSD와 HDD의 체감 속도 차이는 크지만 점수에 포함되지 않습니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
<tr>
<td><strong>GPU 세부 파생 모델 한계</strong></td>
<td>RTX 4060 Laptop과 RTX 4060 Desktop은 성능 차이가 있으나 동일 점수(50점)를 받습니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
<tr>
<td><strong>GPU 세대 보정 미적용</strong></td>
<td>CPU와 달리 GPU는 세대 보정 없이 모델명 매핑 방식만 사용됩니다. 향후 세대별 보정을 검토할 수 있습니다.</td>
<td><span class="badge b-primary">낮음</span></td>
</tr>
<tr>
<td><strong>실측 벤치마크 미연동</strong></td>
<td>3DMark / PassMark GPU 실측값이 아닌 모델명 파싱 추정치입니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
</tbody>
</table>
</div>
<div class="box box-blue">
<div class="box-title">💡 종합 신뢰도 평가</div>
GPU 점수 반영 후 <strong>특히 디자이너·개발자와 같은 그래픽 집약적 직무의 적정성 판별 정확도가 대폭 향상</strong>되었습니다.
다만 노트북 TDP, SSD 유형 등 추가 변수를 향후 보완하면 신뢰도를 더 끌어올릴 수 있습니다.
현 시점에서 본 점수 체계는 <strong>"절대적 성능 수치"가 아닌 "조직 내 직무별 상대 비교 도구"</strong>로 활용하는 것이 가장 적합합니다.
</div>
</section>
<!-- 9. 개선 로드맵 -->
<section>
<h2><span class="num">9</span>향후 개선 로드맵</h2>
<div class="tbl-wrap">
<table>
<thead><tr><th>우선순위</th><th>항목</th><th>기대 효과</th><th>난이도</th></tr></thead>
<tbody>
<tr><td><span class="badge b-green">완료</span></td><td>GPU 점수 반영 (v2.0)</td><td>그래픽 직무 신뢰도 대폭 향상</td><td>중</td></tr>
<tr><td><span class="badge b-yellow">권장</span></td><td>SSD 유형별 점수 추가 (NVMe/SATA/HDD)</td><td>실체감 체감 속도 반영</td><td>하</td></tr>
<tr><td><span class="badge b-yellow">권장</span></td><td>노트북/데스크탑 TDP 보정</td><td>모바일 CPU 과대평가 방지</td><td>중</td></tr>
<tr><td><span class="badge b-primary">선택</span></td><td>PassMark / 3DMark 실측 DB 내장 연동</td><td>추정치 → 실측값 전환</td><td>상</td></tr>
<tr><td><span class="badge b-primary">선택</span></td><td>직무별 항목 가중치 커스터마이징</td><td>조직 특성 맞춤 정밀 점수화</td><td>중</td></tr>
<tr><td><span class="badge b-primary">선택</span></td><td>RMM 에이전트 실시간 자원 점유율 연동</td><td>실사용 기반 교체 우선순위 추천</td><td>상</td></tr>
</tbody>
</table>
</div>
</section>
<footer>
<p>HM ITAM — PC 사양 적정성 분석 기획서 v2.0 (GPU 반영) &nbsp;·&nbsp; 2026. 05. 28</p>
<p style="margin-top:0.25rem;">내부 검토용 문서입니다. 무단 외부 배포를 금합니다.</p>
</footer>
</div>
</body>
</html>
-60
View File
@@ -1,60 +0,0 @@
# 자산 이력 누적 관리 시스템 (Cumulative Asset History System) 구현 계획
본 문서는 자산의 라이프사이클(조직, 사용자, 용도, 상태 변동)을 체계적으로 추적하고 누적 관리하기 위한 기술적 설계 및 단계별 구현 계획을 담고 있습니다.
## 1. 목적
- 자산 정보 수정 시 중요 변경 사항을 자동으로 감지하여 이력(Log)화
- 과거부터 현재까지의 변동 사항을 타임라인 형태로 시각화하여 자산 흐름 파악
- 데이터 정합성을 위해 서버 측에서 변경 전/후 스냅샷 비교 방식 채택
## 2. 관리 대상 이력 (Watch Fields)
다음 항목의 변경이 발생할 경우 이력을 자동 생성합니다.
1. **조직 변동**: `current_dept` (현 사용조직) ↔ `previous_dept` 업데이트 포함
2. **사용자 변동**: `user_current` (현 사용자) ↔ `previous_user` 업데이트 포함
3. **용도 변경**: `asset_type`, `current_role` (예: 개인PC -> 공용PC)
4. **상태 변경**: `hw_status` (예: 운영 -> 수리, 재고 -> 폐기 등)
## 3. 기술 설계 (Technical Design)
### A. 데이터베이스 (DB)
- **대상 테이블**: `asset_history`
- **컬럼 구조 활용 및 보완**:
- `asset_id`: 대상 자산 식별자
- `event_type`: 변경 유형 (DEPT_CHANGE, USER_CHANGE, ROLE_CHANGE, STATUS_CHANGE)
- `details`: "상태 변경: 운영 -> 수리" 와 같이 읽기 쉬운 문자열 저장
- `cost`: 관련 비용 발생 시 기록 (수리비 등)
- `log_user`: 변경을 수행한 작업자
- `log_date`: 변경 발생 일시
### B. 백엔드 (Server-side Logic)
- **위치**: `server.js` 의 `POST /api/asset/:category/save` 엔드포인트
- **동작 흐름**:
1. **Snapshot**: 인서트/업데이트 수행 전, 기존 DB의 데이터를 `SELECT`하여 메모리에 저장.
2. **Comparison**: 요청된 신규 데이터와 기존 데이터를 필드별로 대조.
3. **Auto-logging**: 변경점이 발견되면 `asset_history` 테이블에 즉시 인서트.
4. **Transaction**: 모든 로그 생성이 자산 저장과 하나의 트랜잭션으로 묶여야 함.
### C. 프론트엔드 (UI/UX)
- **위치**: `HWModal.ts` 우측 `modal-history-area`
- **개선 사항**:
- `renderHistory()` 함수를 고도화하여 이벤트 타입별 아이콘/컬러 적용.
- "이전 값 ➔ 이후 값" 형태의 직관적인 레이아웃 도입.
- 스크롤을 통한 무제한 누적 이력 조회 지원.
## 4. 단계별 구현 로직
### 1단계: 서버 로직 고도화
- `server.js`에 비교 함수(`compareAndLog`) 구현.
- 각 자산 카테고리별 저장 로직에 비교 로직 삽입.
### 2단계: DB 데이터 마이그레이션 (필요시)
- 기존 자산의 `current_dept` 등을 `previous_dept`로 밀어내는 로직 점검.
### 3단계: UI 타임라인 렌더링 개선
- `modal.css`에 이력 전용 스타일(이벤트 뱃지 등) 추가.
- `HWModal.ts`에서 최신 로그를 실시간으로 다시 불러오는 로직 확인.
## 5. 검증 계획
- **자동 감지 테스트**: 상태 변경 후 저장 시 우측 이력에 즉시 한 줄이 추가되는지 확인.
- **다중 변경 테스트**: 조직과 사용자를 동시에 변경했을 때 두 개의 로그가 생성되는지 확인.
- **데이터 무결성**: 수정을 취소하거나 저장 실패 시 로그가 남지 않는지(Transaction) 확인.
-49
View File
@@ -1,49 +0,0 @@
# 📗 ITAM 프로젝트 구성 및 협업 가이드
본 문서는 ITAM(IT Asset Management System)의 프로젝트 구조와 공동 작업을 위한 가이드를 제공합니다.
## 1. 프로젝트 아키텍처 개요
ITAM은 **중앙 상태 관리(Centralized State)**와 **컴포넌트 기반 UI(Component-based UI)** 구조로 설계되었습니다. 모든 UI와 비즈니스 로직은 기능별로 독립된 파일로 분리되어 있어, 여러 작업자가 충돌 없이 동시에 개발할 수 있습니다.
## 2. 핵심 디렉토리 구조 및 역할
### 🏗️ 제어 로직 (Core)
* **`src/main.ts`**: 시스템 관제탑. 전체 컴포넌트 초기화 및 메인 렌더링 흐름을 제어합니다.
* **`src/state.ts`**: **전역 데이터 창고**. 자산 데이터(`masterData`)와 현재 탭 상태를 중앙에서 관리합니다. 데이터 구조 변경 시 가장 먼저 확인해야 할 파일입니다.
### 🛠️ 상세 페이지 및 모달 (Modals)
모든 자산의 추가/수정/삭제 로직은 `src/components/Modal/` 폴더 내에 독립적으로 구성되어 있습니다.
* **`BaseModal.ts`**: 모든 모달의 공통 기능(닫기, ESC 처리, 배경 클릭)을 담당합니다.
* **`PCModal.ts`**: 개인PC 전용 상세 정보 및 사양 관리.
* **`HWModal.ts`**: 서버, 전산비품 자산 상세 정보 관리.
* **`StorageModal.ts`**: 스토리지(NAS/DAS) 특화 필드 및 정보 관리.
* **`SWModal.ts`**: 소프트웨어 라이선스 기본 정보 관리.
* **`SWUserModal.ts`**: **복잡한 로직 영역**. 소프트웨어별 사용자 할당/해제 및 매핑 로직을 담당합니다.
### 📊 화면 렌더링 (Views)
* **`src/views/DashboardView.ts`**: HW/SW 현황 통계 및 요약 차트 화면을 렌더링합니다.
* **`src/views/AssetTableView.ts`**: 각 카테고리별 자산 목록 테이블을 렌더링합니다.
## 3. 공동 작업 가이드 (협업 전략)
본 프로젝트는 파일 단위로 역할이 명확히 나뉘어 있어, **담당 영역에 따라 독립적인 작업이 가능**합니다.
### 👤 담당자별 권장 작업 영역
| 작업 대상 | 담당 파일 (Primary) | 설명 |
| :--- | :--- | :--- |
| **하드웨어(HW) 담당** | `PCModal.ts`, `HWModal.ts`, `StorageModal.ts` | 하드웨어 상세 페이지 및 사양 관리 로직 개발 |
| **소프트웨어(SW) 담당** | `SWModal.ts`, `SWUserModal.ts` | 소프트웨어 정보 및 사용자 할당 시스템 개발 |
### 🤝 공통 영역 및 주의사항
아래 파일들은 두 담당자가 공통으로 사용하는 영역이므로, 수정 시 Git 충돌에 유의하고 소통이 필요합니다.
1. **`src/state.ts`**: 데이터 인터페이스(Interface)를 변경할 경우.
2. **`src/views/AssetTableView.ts`**: 목록 테이블의 공통 스타일이나 HW/SW 테이블 구조를 변경할 경우.
3. **`src/views/DashboardView.ts`**: 대시보드 통계 알고리즘을 변경할 경우.
## 4. 데이터 흐름 (Data Flow)
1. **데이터 조회**: `AssetTableView`에서 항목 클릭 → 담당 모달의 `openModal(asset)` 호출 → 폼 바인딩.
2. **데이터 저장**: 모달에서 '저장' 버튼 클릭 → `state.ts`의 전역 상태 업데이트 → `main.ts`의 `renderContent()` 호출 → 전체 화면 즉시 갱신.
---
**Tip**: 새로운 기능을 추가할 때는 `main.ts`에 코드를 직접 작성하지 말고, 적절한 폴더 아래에 새 파일을 만들어 `import` 하시기 바랍니다.
+52 -45
View File
@@ -1,56 +1,63 @@
# 🛠️ 개발 및 관리 규칙 (Strict Development Rules) # Pier_v1 — 교각 3D 형상 생성 웹 뷰어
1. **언어 설정**: 영어로 생각하되, 모든 답변은 **한국어**로 작성한다. 엑셀 입력(교각 · IP · 받침)으로 T형 교각의 3D 형상을 만들고, 웹 브라우저에서 확인하는 프로젝트입니다.
2. **임의 수정 절대 금지 (Zero-Arbitrary Change)**: 형상 생성 → 형상계획 → 철근배근 → 재료표 순서로 진행합니다.
- 사용자가 명시적으로 지시한 부분 외에는 **단 한 줄의 코드도, 그 어떤 파일도 임의로 수정, 정리, 리팩토링하지 않는다.**
- 지시받지 않은 다른 파트의 코드는 절대 건드리지 않으며, 영향 범위가 요청 범위를 벗어나지 않도록 '외과 수술식(Surgical) 수정'을 원칙으로 한다.
3. **개선 작업 절차 (Test-First Approach)**:
- 사용자가 개선(Refactoring, Optimization 등)을 지시한 경우, **수정 전 현재 시스템이 정상적으로 잘 작동하는지 먼저 전수 확인**한다.
- 기존 동작 방식과 성능을 기준(Baseline)으로 삼고, 수정 후에도 **기존의 모든 기능이 무결하게 유지되는지 반드시 테스트하여 입증**한다.
- 검증 결과를 바탕으로 "무엇을, 왜, 어떻게" 바꿀지 상세 보고 후, 사용자로부터 **'진행시켜'** 승인을 얻은 뒤에만 집행한다.
4. **선보고 후승인**: 모든 기능 수정 및 코드 변경 전에는 예상 방안을 먼저 보고하고 승인 절차를 거친다.
--- ## 주요 기능
### 🚀 서버 구동 및 외부 접속 규칙 (Server Run & External Access) - **① 형상 생성**: 엑셀 입력을 불러와 교각을 3D로 생성합니다. 기본은 **전체 보기**(교각 여러 기를 한 화면에 콘크리트만 표시)입니다.
- **② 형상계획**: 부재별(코핑, 기둥, 확대기초·말뚝, 지반, 교량받침) 입력을 고치고, 기준 교각의 값을 다른 교각에 **속성 복사**합니다.
- **③ 철근배근**: 부재별 철근을 3D로 표시하고 철근표를 만듭니다.
- **④ 재료표**: 철근 재료표를 교각별로 또는 **교량 전체 집계**로 보고, 엑셀로 내보냅니다.
1. **포트 고정**: 개발 서버는 반드시 **8080** 포트를 사용한다. (`vite.config.ts` 설정 준수) ## 실행 방법
2. **외부 접속 허용 (Host)**: 사무실 내 타 직원이 접속할 수 있도록 `--host` 모드로 구동한다.
3. **구동 명령어**:
```bash
npm run dev
```
* 해당 명령어 실행 시 `0.0.0.0` 또는 `Network: http://[내-IP]:8080/` 경로로 타인 접속이 가능하다.
4. **IP 확인 방법**:
* Windows: `ipconfig` 명령어로 'IPv4 주소' 확인 후 공유.
--- 필요 환경: Node.js (LTS 권장), npm
### 🎨 ITAM 시스템 디자인 가이드 (Design Guide) ```bash
npm install
npm run dev # 개발 서버 (기본 http://localhost:5173)
```
1. **디자인 철학 (Design Philosophy)** WSL에서 호스트를 지정하려면:
* **Minimalist & Border-based**: 불필요한 박스(Card) 사용을 최소화하고, 정보의 구분은 간결한 라인(Border/Divider)을 활용하여 시각적 피로도를 낮춥니다.
* **Professional Achromatic**: 무채색(Black, White, Grey)을 기본으로 하여 정돈된 업무 환경을 제공합니다.
* **Green Accent**: 블루 대신 짙은 그린(`#1E5149`)을 포인트 컬러로 사용하여 차분한 전문성을 강조합니다.
2. **타이포그래피 (Typography)** ```bash
* **Font Family**: `Pretendard` (전역 적용) npm run dev -- --host 127.0.0.1 --port 5173
* **Letter Spacing**: `-0.02em` (약 -2%) 적용. 자간을 좁게 설정하여 밀도 있고 세련된 가독성을 확보합니다. ```
* **Weights**: 400(Regular), 500(Medium), 600(SemiBold), 700(Bold).
3. **컬러 팔레트 (Color Palette)** ## 명령어
* **Point Color**: `#1E5149` (Deep Green) - 강조, 활성화 상태, 주요 액션 버튼.
* **Text**: Main(`#111827` - Near Black), Muted(`#6B7280` - Grey).
* **Border/Divider**: `#E5E7EB` (Light Grey) - 정보 구분을 위한 얇은 실선.
* **Background**: `#FFFFFF` (White) / `#F9FAFB` (Off White).
4. **레이아웃 및 컴포넌트 규칙 (Layout Rules)** | 명령 | 내용 |
* **Box-less Design**: 꼭 필요한 정보 묶음(데이터 그룹화 등)이 아니면 박스 형태의 테두리나 배경 사용을 지양합니다. | :--- | :--- |
* **Line-based Division**: 섹션 간의 구분은 1px 두께의 얇은 실선(Border)을 통해 명확히 합니다. | `npm run dev` | 개발 서버 실행 |
* **Table**: 배경색이나 화려한 효과 없이 행(Row) 간의 얇은 구분선만 사용하여 데이터 본연에 집중하게 합니다. | `npm run typecheck` | TypeScript 타입 검사 |
* **Input/Button**: 입력 필드와 버튼은 최소한의 보더와 포인트 컬러만 사용하여 정갈하게 표현합니다. | `npm test` | 단위 테스트 (vitest) |
* **Modal (모달 공통 규칙)**: | `npm run build` | 타입 검사 후 배포용 빌드 (`dist/`) |
* **Header**: 짙은 그린(`#1E5149`) 배경에 화이트 텍스트를 사용하며, 우측 상단에 명확한 'X' 닫기 버튼을 배치합니다.
* **Interaction**: 사용자의 오입력(실수로 바깥을 클릭하여 입력 내용이 날아가는 현상)을 방지하기 위해 **모달 바깥 영역(Overlay) 클릭 시 모달이 닫히지 않도록** 설정합니다. 닫기는 오직 'ESC' 키 또는 명시적인 'X' 및 '닫기' 버튼을 통해서만 가능합니다.
* **Layout**: `detail.png` 기준의 2열 그리드 시스템을 권장하며, 하단 우측에 액션 버튼(닫기, 저장 등)을 배치합니다.
## 입력 파일
`public/samples/운곡교P1입력.xlsx`가 기본 예시입니다. 시트 구성은 다음과 같습니다.
- **교각**: 교각명, 교각 형식, 두부보 EL, 기초 하단 EL, 지반고 EL, 말뚝 길이(mm), 두부보 폭·길이(mm), 기둥 개수
- **IP**: 교각별 IP1–IP4 좌표와 코핑 꺾임각
- **받침**: 교각별 받침 번호, 좌표, EL, 방위각, 위치(전열·후열)
엑셀에서 **시트 1장 = 교각 1기**입니다. 오류가 있는 교각만 건너뛰고 나머지는 생성합니다.
## 폴더 구조
```
src/
core/ 계산과 규칙 (형상, 철근, 재료표, 복사, 입력 검사)
view/ 3D 장면과 도면 뷰 (three.js)
main.ts 화면 동작과 상태
tests/ 단위 테스트
public/ 샘플 입력 파일
scripts/ 검증·자동화 스크립트
verify/ 검증 실행 기록
```
## 참고
- 작업 규칙과 커밋 방식은 `CLAUDE.md`에 있습니다.
- 명세와 설계 기준은 프로젝트 외부 문서(RAG 폴더)를 따릅니다.
Binary file not shown.
Binary file not shown.
-108
View File
@@ -1,108 +0,0 @@
# 로컬 Docker 테스트 가이드
## 준비 사항
- Docker & Docker Compose 설치 (WSL2 Ubuntu 권장)
- Node.js 20 (로컬 빌드 테스트 시)
## 테스트 단계
### 1. 파일 구조 확인
```bash
# docker-compose.test.yaml이 다음을 사용 확인
ls -la docker/nginx/default.conf
ls -la docker/frontend/default.conf
ls -la Dockerfile.backend.prod
ls -la Dockerfile.frontend.prod
ls -la package.json
ls -la src/
ls -la public/
ls -la index.html
```
### 2. Compose 파일 검증
```bash
docker compose -f docker-compose.test.yaml config
```
### 3. 이미지 빌드 테스트
```bash
# 개별 빌드 테스트
docker build -f Dockerfile.backend.prod -t itam-backend:test .
docker build -f Dockerfile.frontend.prod -t itam-frontend:test .
```
### 4. 컨테이너 시작
```bash
# WSL 터미널에서
cd /mnt/c/Users/user/Desktop/안건\ 파일/itam
# 또는 docker-compose.test.yaml을 사용하여 전체 스택 시작
docker compose -f docker-compose.test.yaml up --build
# 백그라운드에서 실행
docker compose -f docker-compose.test.yaml up -d --build
```
### 5. 컨테이너 상태 확인
```bash
docker compose -f docker-compose.test.yaml ps
docker logs itam-backend-test
docker logs itam-frontend-test
docker logs itam-nginx-test
```
### 6. 브라우저 테스트
```
http://localhost:8080/ # Frontend 접근
http://localhost:8080/api/ # Backend API 테스트
http://localhost:3000/health # 직접 backend health check
```
### 7. 정리
```bash
docker compose -f docker-compose.test.yaml down
```
## 예상되는 포트 매핑
- 8080: Nginx reverse proxy (frontend route to static + /api to backend)
- 3000: Backend Express API (내부, frontend와 nginx를 통해 접근)
- 80: Frontend Nginx (내부, 정적 파일 서빙)
## 테스트 체크리스트
- [ ] docker compose config 성공
- [ ] docker build 성공 (backend)
- [ ] docker build 성공 (frontend)
- [ ] 컨테이너 모두 실행 중 (ps 확인)
- [ ] http://localhost:8080 접근 가능 (frontend 페이지 로드)
- [ ] http://localhost:8080/api 응답 확인 (backend proxy 동작)
- [ ] backend health check 성공 (docker logs에서 /health 요청 확인)
## 문제 해결
### npm run build 실패
- Dockerfile.frontend.prod에서 tsc && vite build 실행
- package.json과 tsconfig.json 확인
### nginx 포트 이미 사용 중
```bash
docker ps
docker stop container_name
```
### DB 연결 실패
- 정상 동작 (NODE_ENV 때문에 /health는 200 반환)
- 실제 API 호출 시 DB 오류 예상
### 권한 문제
- logs/ 디렉토리 소유권 확인
- 필요 시 mkdir -p logs/nginx && chmod 777 logs
Binary file not shown.
-59
View File
@@ -1,59 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
import * as xlsx from 'xlsx';
import fs from 'fs';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function backup() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('🚀 Starting Database Backup Process...');
const tables = [
'asset_pc', 'asset_server', 'asset_storage', 'asset_remote',
'asset_equipment', 'asset_office_supplies', 'asset_survey', 'asset_vip'
];
const wb = xlsx.utils.book_new();
for (const table of tables) {
try {
// 1. Create table backup
await connection.query(`DROP TABLE IF EXISTS ${table}_backup`);
await connection.query(`CREATE TABLE ${table}_backup AS SELECT * FROM ${table}`);
console.log(`✅ Table backup created: ${table} -> ${table}_backup`);
// 2. Fetch data for Excel
const [rows] = await connection.query(`SELECT * FROM ${table}`);
if (rows.length > 0) {
const ws = xlsx.utils.json_to_sheet(rows);
// Sheet names max length is 31 chars
const sheetName = table.substring(0, 31);
xlsx.utils.book_append_sheet(wb, ws, sheetName);
}
} catch (e) {
console.warn(`⚠️ Skipped ${table}: ${e.message}`);
}
}
// 3. Write Excel file
const fileName = 'backupDB_20260608.xlsx';
xlsx.writeFile(wb, fileName);
console.log(`✅ Excel data exported successfully to ${fileName}`);
await connection.end();
}
backup().catch(err => {
console.error('❌ Backup Failed:', err);
process.exit(1);
});
File diff suppressed because it is too large. Load diff
-211
View File
@@ -1,211 +0,0 @@
('D:\\이태훈\\22전산자산조사\\ITAM\\dist\\pc_agent.exe',
True,
False,
False,
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico',
None,
False,
False,
b'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<assembly xmlns='
b'"urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">\n <trustInfo x'
b'mlns="urn:schemas-microsoft-com:asm.v3">\n <security>\n <requested'
b'Privileges>\n <requestedExecutionLevel level="asInvoker" uiAccess='
b'"false"/>\n </requestedPrivileges>\n </security>\n </trustInfo>\n '
b'<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">\n <'
b'application>\n <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f'
b'0}"/>\n <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>\n '
b' <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>\n <s'
b'upportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>\n <supporte'
b'dOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>\n </application>\n <'
b'/compatibility>\n <application xmlns="urn:schemas-microsoft-com:asm.v3">'
b'\n <windowsSettings>\n <longPathAware xmlns="http://schemas.micros'
b'oft.com/SMI/2016/WindowsSettings">true</longPathAware>\n </windowsSett'
b'ings>\n </application>\n <dependency>\n <dependentAssembly>\n <ass'
b'emblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version='
b'"6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" langua'
b'ge="*"/>\n </dependentAssembly>\n </dependency>\n</assembly>',
True,
False,
None,
None,
None,
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\pc_agent.pkg',
[('pyi-contents-directory _internal', '', 'OPTION'),
('PYZ-00.pyz', 'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\PYZ-00.pyz', 'PYZ'),
('struct',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\struct.pyc',
'PYMODULE'),
('pyimod01_archive',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod01_archive.pyc',
'PYMODULE'),
('pyimod02_importers',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod02_importers.pyc',
'PYMODULE'),
('pyimod03_ctypes',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod03_ctypes.pyc',
'PYMODULE'),
('pyimod04_pywin32',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod04_pywin32.pyc',
'PYMODULE'),
('pyiboot01_bootstrap',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
'PYSOURCE'),
('pyi_rth_inspect',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
'PYSOURCE'),
('pyi_rth_pkgutil',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
'PYSOURCE'),
('pyi_rth_multiprocessing',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
'PYSOURCE'),
('pyi_rth_cryptography_openssl',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks\\pyi_rth_cryptography_openssl.py',
'PYSOURCE'),
('pyi_rth_pywintypes',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks\\pyi_rth_pywintypes.py',
'PYSOURCE'),
('pyi_rth_pythoncom',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks\\pyi_rth_pythoncom.py',
'PYSOURCE'),
('pc_agent', 'D:\\이태훈\\22전산자산조사\\ITAM\\pc_agent.py', 'PYSOURCE'),
('python312.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll',
'BINARY'),
('pywin32_system32\\pywintypes312.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pywin32_system32\\pywintypes312.dll',
'BINARY'),
('pywin32_system32\\pythoncom312.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pywin32_system32\\pythoncom312.dll',
'BINARY'),
('select.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\select.pyd',
'EXTENSION'),
('_multiprocessing.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_multiprocessing.pyd',
'EXTENSION'),
('pyexpat.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\pyexpat.pyd',
'EXTENSION'),
('_ssl.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ssl.pyd',
'EXTENSION'),
('_hashlib.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_hashlib.pyd',
'EXTENSION'),
('unicodedata.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd',
'EXTENSION'),
('_decimal.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd',
'EXTENSION'),
('_lzma.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_lzma.pyd',
'EXTENSION'),
('_bz2.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd',
'EXTENSION'),
('_ctypes.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ctypes.pyd',
'EXTENSION'),
('_queue.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_queue.pyd',
'EXTENSION'),
('_wmi.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_wmi.pyd',
'EXTENSION'),
('_socket.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd',
'EXTENSION'),
('_overlapped.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_overlapped.pyd',
'EXTENSION'),
('_asyncio.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_asyncio.pyd',
'EXTENSION'),
('_cffi_backend.cp312-win_amd64.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_cffi_backend.cp312-win_amd64.pyd',
'EXTENSION'),
('cryptography\\hazmat\\bindings\\_rust.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography\\hazmat\\bindings\\_rust.pyd',
'EXTENSION'),
('charset_normalizer\\md__mypyc.cp312-win_amd64.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\charset_normalizer\\md__mypyc.cp312-win_amd64.pyd',
'EXTENSION'),
('charset_normalizer\\md.cp312-win_amd64.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\charset_normalizer\\md.cp312-win_amd64.pyd',
'EXTENSION'),
('win32\\_win32sysloader.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\_win32sysloader.pyd',
'EXTENSION'),
('win32\\win32api.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\win32api.pyd',
'EXTENSION'),
('Pythonwin\\win32ui.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\Pythonwin\\win32ui.pyd',
'EXTENSION'),
('win32\\win32event.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\win32event.pyd',
'EXTENSION'),
('win32\\win32trace.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\win32trace.pyd',
'EXTENSION'),
('VCRUNTIME140.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll',
'BINARY'),
('VCRUNTIME140_1.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140_1.dll',
'BINARY'),
('libssl-3.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libssl-3.dll',
'BINARY'),
('libcrypto-3.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll',
'BINARY'),
('libffi-8.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libffi-8.dll',
'BINARY'),
('python3.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\python3.dll',
'BINARY'),
('Pythonwin\\mfc140u.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\Pythonwin\\mfc140u.dll',
'BINARY'),
('certifi\\cacert.pem',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\certifi\\cacert.pem',
'DATA'),
('certifi\\py.typed',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\certifi\\py.typed',
'DATA'),
('cryptography-45.0.2.dist-info\\licenses\\LICENSE.BSD',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\licenses\\LICENSE.BSD',
'DATA'),
('cryptography-45.0.2.dist-info\\licenses\\LICENSE',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\licenses\\LICENSE',
'DATA'),
('cryptography-45.0.2.dist-info\\RECORD',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\RECORD',
'DATA'),
('cryptography-45.0.2.dist-info\\METADATA',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\METADATA',
'DATA'),
('cryptography-45.0.2.dist-info\\WHEEL',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\WHEEL',
'DATA'),
('cryptography-45.0.2.dist-info\\INSTALLER',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\INSTALLER',
'DATA'),
('cryptography-45.0.2.dist-info\\licenses\\LICENSE.APACHE',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\licenses\\LICENSE.APACHE',
'DATA'),
('base_library.zip',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\base_library.zip',
'DATA')],
[],
False,
False,
1779102721,
[('run.exe',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\run.exe',
'EXECUTABLE')],
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll')
-189
View File
@@ -1,189 +0,0 @@
('D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\pc_agent.pkg',
{'BINARY': True,
'DATA': True,
'EXECUTABLE': True,
'EXTENSION': True,
'PYMODULE': True,
'PYSOURCE': True,
'PYZ': False,
'SPLASH': True,
'SYMLINK': False},
[('pyi-contents-directory _internal', '', 'OPTION'),
('PYZ-00.pyz', 'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\PYZ-00.pyz', 'PYZ'),
('struct',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\struct.pyc',
'PYMODULE'),
('pyimod01_archive',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod01_archive.pyc',
'PYMODULE'),
('pyimod02_importers',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod02_importers.pyc',
'PYMODULE'),
('pyimod03_ctypes',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod03_ctypes.pyc',
'PYMODULE'),
('pyimod04_pywin32',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\localpycs\\pyimod04_pywin32.pyc',
'PYMODULE'),
('pyiboot01_bootstrap',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
'PYSOURCE'),
('pyi_rth_inspect',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
'PYSOURCE'),
('pyi_rth_pkgutil',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
'PYSOURCE'),
('pyi_rth_multiprocessing',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
'PYSOURCE'),
('pyi_rth_cryptography_openssl',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks\\pyi_rth_cryptography_openssl.py',
'PYSOURCE'),
('pyi_rth_pywintypes',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks\\pyi_rth_pywintypes.py',
'PYSOURCE'),
('pyi_rth_pythoncom',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks\\pyi_rth_pythoncom.py',
'PYSOURCE'),
('pc_agent', 'D:\\이태훈\\22전산자산조사\\ITAM\\pc_agent.py', 'PYSOURCE'),
('python312.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll',
'BINARY'),
('pywin32_system32\\pywintypes312.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pywin32_system32\\pywintypes312.dll',
'BINARY'),
('pywin32_system32\\pythoncom312.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pywin32_system32\\pythoncom312.dll',
'BINARY'),
('select.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\select.pyd',
'EXTENSION'),
('_multiprocessing.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_multiprocessing.pyd',
'EXTENSION'),
('pyexpat.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\pyexpat.pyd',
'EXTENSION'),
('_ssl.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ssl.pyd',
'EXTENSION'),
('_hashlib.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_hashlib.pyd',
'EXTENSION'),
('unicodedata.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd',
'EXTENSION'),
('_decimal.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd',
'EXTENSION'),
('_lzma.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_lzma.pyd',
'EXTENSION'),
('_bz2.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd',
'EXTENSION'),
('_ctypes.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ctypes.pyd',
'EXTENSION'),
('_queue.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_queue.pyd',
'EXTENSION'),
('_wmi.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_wmi.pyd',
'EXTENSION'),
('_socket.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd',
'EXTENSION'),
('_overlapped.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_overlapped.pyd',
'EXTENSION'),
('_asyncio.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_asyncio.pyd',
'EXTENSION'),
('_cffi_backend.cp312-win_amd64.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_cffi_backend.cp312-win_amd64.pyd',
'EXTENSION'),
('cryptography\\hazmat\\bindings\\_rust.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography\\hazmat\\bindings\\_rust.pyd',
'EXTENSION'),
('charset_normalizer\\md__mypyc.cp312-win_amd64.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\charset_normalizer\\md__mypyc.cp312-win_amd64.pyd',
'EXTENSION'),
('charset_normalizer\\md.cp312-win_amd64.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\charset_normalizer\\md.cp312-win_amd64.pyd',
'EXTENSION'),
('win32\\_win32sysloader.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\_win32sysloader.pyd',
'EXTENSION'),
('win32\\win32api.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\win32api.pyd',
'EXTENSION'),
('Pythonwin\\win32ui.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\Pythonwin\\win32ui.pyd',
'EXTENSION'),
('win32\\win32event.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\win32event.pyd',
'EXTENSION'),
('win32\\win32trace.pyd',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\win32\\win32trace.pyd',
'EXTENSION'),
('VCRUNTIME140.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll',
'BINARY'),
('VCRUNTIME140_1.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140_1.dll',
'BINARY'),
('libssl-3.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libssl-3.dll',
'BINARY'),
('libcrypto-3.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll',
'BINARY'),
('libffi-8.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libffi-8.dll',
'BINARY'),
('python3.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\python3.dll',
'BINARY'),
('Pythonwin\\mfc140u.dll',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\Pythonwin\\mfc140u.dll',
'BINARY'),
('certifi\\cacert.pem',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\certifi\\cacert.pem',
'DATA'),
('certifi\\py.typed',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\certifi\\py.typed',
'DATA'),
('cryptography-45.0.2.dist-info\\licenses\\LICENSE.BSD',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\licenses\\LICENSE.BSD',
'DATA'),
('cryptography-45.0.2.dist-info\\licenses\\LICENSE',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\licenses\\LICENSE',
'DATA'),
('cryptography-45.0.2.dist-info\\RECORD',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\RECORD',
'DATA'),
('cryptography-45.0.2.dist-info\\METADATA',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\METADATA',
'DATA'),
('cryptography-45.0.2.dist-info\\WHEEL',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\WHEEL',
'DATA'),
('cryptography-45.0.2.dist-info\\INSTALLER',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\INSTALLER',
'DATA'),
('cryptography-45.0.2.dist-info\\licenses\\LICENSE.APACHE',
'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\cryptography-45.0.2.dist-info\\licenses\\LICENSE.APACHE',
'DATA'),
('base_library.zip',
'D:\\이태훈\\22전산자산조사\\ITAM\\build\\pc_agent\\base_library.zip',
'DATA')],
'python312.dll',
False,
False,
False,
[],
None,
None,
None)
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-58
View File
@@ -1,58 +0,0 @@
This file lists modules PyInstaller was not able to find. This does not
necessarily mean these modules are required for running your program. Both
Python's standard library and 3rd-party Python packages often conditionally
import optional modules, some of which may be available only on certain
platforms.
Types of import:
* top-level: imported at the top-level - look at these first
* conditional: imported within an if-statement
* delayed: imported within a function
* optional: imported within a try-except-statement
IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
tracking down the missing module yourself. Thanks!
missing module named pwd - imported by posixpath (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional), netrc (delayed, conditional), getpass (delayed)
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
missing module named _posixsubprocess - imported by subprocess (conditional), multiprocessing.util (delayed)
missing module named fcntl - imported by subprocess (optional)
missing module named _posixshmem - imported by multiprocessing.resource_tracker (conditional), multiprocessing.shared_memory (conditional)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named termios - imported by getpass (optional)
missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
missing module named resource - imported by posix (top-level)
missing module named multiprocessing.get_context - imported by multiprocessing (top-level), multiprocessing.pool (top-level), multiprocessing.managers (top-level), multiprocessing.sharedctypes (top-level)
missing module named multiprocessing.TimeoutError - imported by multiprocessing (top-level), multiprocessing.pool (top-level)
missing module named multiprocessing.set_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
missing module named multiprocessing.get_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
missing module named pyimod02_importers - imported by C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py (delayed)
missing module named collections.Callable - imported by collections (optional), socks (optional)
missing module named vms_lib - imported by platform (delayed, optional)
missing module named 'java.lang' - imported by platform (delayed, optional)
missing module named java - imported by platform (delayed)
missing module named _winreg - imported by platform (delayed, optional)
missing module named simplejson - imported by requests.compat (conditional, optional)
missing module named dummy_threading - imported by requests.cookies (optional)
missing module named asyncio.DefaultEventLoopPolicy - imported by asyncio (delayed, conditional), asyncio.events (delayed, conditional)
missing module named annotationlib - imported by typing_extensions (conditional)
missing module named 'h2.events' - imported by urllib3.http2.connection (top-level)
missing module named 'h2.connection' - imported by urllib3.http2.connection (top-level)
missing module named h2 - imported by urllib3.http2.connection (top-level)
missing module named zstandard - imported by urllib3.util.request (optional), urllib3.response (optional)
missing module named brotli - imported by urllib3.util.request (optional), urllib3.response (optional)
missing module named brotlicffi - imported by urllib3.util.request (optional), urllib3.response (optional)
missing module named win_inet_pton - imported by socks (conditional, optional)
missing module named bcrypt - imported by cryptography.hazmat.primitives.serialization.ssh (optional)
missing module named cryptography.x509.UnsupportedExtension - imported by cryptography.x509 (optional), urllib3.contrib.pyopenssl (optional)
missing module named 'OpenSSL.crypto' - imported by urllib3.contrib.pyopenssl (delayed, conditional)
missing module named OpenSSL - imported by urllib3.contrib.pyopenssl (top-level)
missing module named 'pyodide.ffi' - imported by urllib3.contrib.emscripten.fetch (delayed, optional)
missing module named pyodide - imported by urllib3.contrib.emscripten.fetch (top-level)
missing module named js - imported by urllib3.contrib.emscripten.fetch (top-level)
missing module named 'win32com.gen_py' - imported by win32com (conditional, optional)
File diff suppressed because it is too large. Load diff
-28
View File
@@ -1,28 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function checkRecentLogs() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('--- Recent History Logs ---');
const [rows] = await connection.query('SELECT * FROM asset_history ORDER BY created_at DESC LIMIT 5');
console.log(JSON.stringify(rows, null, 2));
console.log('\n--- Recent Core Data (to check current_dept) ---');
const [coreRows] = await connection.query('SELECT id, asset_code, current_dept, previous_dept FROM asset_core ORDER BY updated_at DESC LIMIT 5');
console.log(JSON.stringify(coreRows, null, 2));
await connection.end();
}
checkRecentLogs().catch(console.error);
-29
View File
@@ -1,29 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function checkRemote() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('--- Checking asset_remote table ---');
const [columns] = await connection.query('DESCRIBE asset_remote');
const cols = columns.map(c => c.Field);
console.log('Columns in asset_remote:', cols.join(', '));
const [count] = await connection.query('SELECT COUNT(*) as count FROM asset_remote WHERE remote_tool IS NOT NULL OR remote_id IS NOT NULL');
console.log(`Rows with remote info (tool or id): ${count[0].count}`);
await connection.end();
}
checkRemote().catch(console.error);
-176
View File
@@ -1,176 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function initDB() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306'),
multipleStatements: true
});
console.log('🔄 DB 초기화 시작 (영문 표준 스키마 적용)...');
const tablesToDrop = [
'pc_assets', 'server_assets', 'storage_assets', 'equip_assets', 'mobile_assets',
'sw_sub_assets', 'sw_perm_assets', 'cloud_assets', 'sw_users', 'asset_logs'
];
for (const table of tablesToDrop) {
await connection.query(`DROP TABLE IF EXISTS ${table}`);
}
const createHardwareTable = (tableName, comment) => `
CREATE TABLE ${tableName} (
id VARCHAR(50) PRIMARY KEY,
corp VARCHAR(100),
asset_code VARCHAR(100),
purchase_date VARCHAR(50),
type VARCHAR(50),
detail_purpose VARCHAR(50),
purpose VARCHAR(255),
details TEXT,
current_org VARCHAR(255),
prev_org VARCHAR(255),
location VARCHAR(255),
manager_main VARCHAR(100),
manager_sub VARCHAR(100),
ip_address VARCHAR(100),
remote_tool VARCHAR(100),
server_id VARCHAR(100),
server_pw VARCHAR(100),
model_name VARCHAR(255),
mainboard VARCHAR(255) COMMENT '메인보드',
os VARCHAR(100),
cpu VARCHAR(255),
ram VARCHAR(100),
gpu VARCHAR(100),
storage1 VARCHAR(255),
storage2 VARCHAR(255),
storage3 VARCHAR(255),
monitoring VARCHAR(100),
price VARCHAR(100),
remarks TEXT,
storage_location VARCHAR(255),
status VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`;
await connection.query(createHardwareTable('pc_assets', 'PC'));
await connection.query(createHardwareTable('server_assets', 'Server'));
await connection.query(createHardwareTable('storage_assets', 'Storage'));
await connection.query(createHardwareTable('equip_assets', 'Equipment'));
await connection.query(createHardwareTable('mobile_assets', 'Mobile'));
await connection.query(`
CREATE TABLE sw_sub_assets (
id VARCHAR(50) PRIMARY KEY,
corp VARCHAR(100) COMMENT '구매법인',
category VARCHAR(100) COMMENT '분야',
dept VARCHAR(100) COMMENT '부서',
product_name VARCHAR(255) COMMENT '제품명',
license_type VARCHAR(100) COMMENT '라이선스 유형',
quantity INT COMMENT '수량',
price VARCHAR(100) COMMENT '금액',
purchase_date VARCHAR(50) COMMENT '구매일',
start_date VARCHAR(50) COMMENT '시작일',
expiry_date VARCHAR(50) COMMENT '만료일',
vendor VARCHAR(255) COMMENT '구매업체',
remarks TEXT COMMENT '비고',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE sw_perm_assets (
id VARCHAR(50) PRIMARY KEY,
corp VARCHAR(100) COMMENT '구매법인',
category VARCHAR(100) COMMENT '분야',
dept VARCHAR(100) COMMENT '부서',
product_name VARCHAR(255) COMMENT '제품명',
license_key VARCHAR(255) COMMENT '라이선스 키',
quantity INT COMMENT '수량',
price VARCHAR(100) COMMENT '금액',
purchase_date VARCHAR(50) COMMENT '구매일',
start_date VARCHAR(50) COMMENT '시작일',
expiry_date VARCHAR(50) COMMENT '만료일',
vendor VARCHAR(255) COMMENT '구매업체',
remarks TEXT COMMENT '비고',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE cloud_assets (
id VARCHAR(50) PRIMARY KEY,
platform_name VARCHAR(100),
corp VARCHAR(100),
dept VARCHAR(100),
product_name VARCHAR(255),
account_name VARCHAR(255),
pay_method VARCHAR(100),
pay_day VARCHAR(50),
card_num VARCHAR(100),
monthly_fee VARCHAR(100),
remarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE sw_users (
id INT AUTO_INCREMENT PRIMARY KEY,
sw_id VARCHAR(50),
corp VARCHAR(100),
dept VARCHAR(100),
position VARCHAR(50),
user_name VARCHAR(100),
usage_period VARCHAR(100),
doc_name VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_logs (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50),
log_date VARCHAR(50),
log_user VARCHAR(100),
details TEXT,
cost DECIMAL(15,2) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE ops_domain_assets (
id VARCHAR(50) PRIMARY KEY,
type VARCHAR(50) COMMENT '유형',
corp VARCHAR(100) COMMENT '법인',
service_name VARCHAR(255) COMMENT '서비스명',
domain_name VARCHAR(255) COMMENT '관리도메인',
start_date VARCHAR(50) COMMENT '시작일',
expiry_date VARCHAR(50) COMMENT '만료일',
price VARCHAR(100) COMMENT '금액',
manager_main VARCHAR(100) COMMENT '담당자',
manager_sub VARCHAR(100) COMMENT '담당자(부)',
remarks TEXT COMMENT '비고',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
console.log('✅ 모든 테이블이 영문 표준 스키마로 재생성되었습니다.');
await connection.end();
}
initDB().catch(err => {
console.error('❌ DB 초기화 실패:', err);
process.exit(1);
});
-940
View File
@@ -1,940 +0,0 @@
# ITAM 도커라이징 실전 가이드
## 1. 문서 목적
이 문서는 Gitea에 올라가 있는 현재 저장소를 기준으로, 개발 PC에 WSL2와 Ubuntu만 설치되어 있는 상태에서 지금의 Docker 실행 구조를 재현하는 방법을 처음부터 끝까지 설명하는 실전 가이드다.
이 문서는 아래 상황을 가정한다.
1. 소스 코드는 아직 로컬에 없거나, Gitea에서 막 받아올 예정이다.
2. Windows에는 WSL2와 Ubuntu는 설치되어 있다.
3. 그 외 Docker 관련 세팅은 아직 안 되어 있을 수 있다.
4. 최종 목표는 현재 저장소 기준 `frontend + backend + external DB` 구조를 Docker로 재현하는 것이다.
이 문서의 목적은 아래 네 가지다.
1. 현재 시스템 구조와 Docker 구조를 먼저 이해하게 한다.
2. 기존 파일 중 무엇이 새로 추가되었고 무엇이 수정되었는지 정리한다.
3. 각 단계별로 정확히 어디에서 명령을 실행해야 하는지 명시한다.
4. Gitea 소스만 받은 상태에서 지금과 같은 Docker 실행 상태까지 도달하게 한다.
---
## 2. 현재 시스템 구조 개요
## 2.1 애플리케이션 원래 구조
현재 저장소의 본래 실행 구조는 다음과 같다.
1. 프런트엔드: Vite 기반 TypeScript 앱
2. 백엔드: Express 기반 Node.js API 서버
3. 데이터베이스: 외부 MySQL 서버
즉, 원래부터 MySQL이 Docker 안에 들어 있던 구조가 아니다.
프런트와 백엔드는 각각 별도 프로세스로 실행되며, 프런트는 `/api` 상대 경로로 백엔드 API를 호출한다.
---
## 2.2 현재 Docker 구조
현재 최종 Docker 구조는 아래와 같다.
1. `frontend` 컨테이너
2. `backend` 컨테이너
3. 외부 MySQL DB
즉, 지금은 내부 `db` 컨테이너가 없고, 내부 `db-bootstrap` 컨테이너도 없다.
현재 구조를 문장으로 풀면 다음과 같다.
1. 브라우저는 `http://localhost:8080`으로 `frontend` 컨테이너에 접속한다.
2. `frontend`는 `/api` 요청을 `backend:3000`으로 프록시한다.
3. `backend`는 `.env`에 적힌 외부 DB 정보로 외부 MySQL에 직접 접속한다.
4. 조회 결과 JSON을 프런트가 받아 화면에 렌더링한다.
간단한 흐름은 아래와 같다.
```text
Browser
-> frontend container :8080
-> Vite proxy (/api)
-> backend container :3000
-> external MySQL (.env)
```
---
## 2.3 왜 이 구조가 맞는가
현재 구조가 적절한 이유는 다음과 같다.
1. 원래 시스템도 외부 MySQL을 쓰는 구조였다.
2. 지금 목표는 운영형 단일 배포가 아니라 현재 개발형 구조를 Docker로 재현하는 것이다.
3. 프런트는 Vite dev server 기반이라 운영형 nginx 정적 배포 구조로 억지로 바꾸는 것보다, 현 구조를 유지하는 편이 안전하다.
4. 실무 표준 관점에서도 앱 컨테이너는 무상태로 유지하고, DB는 외부 인프라를 사용하는 구성이 더 일반적이다.
---
## 3. 이번 도커라이징에서 추가되거나 수정된 파일 정리
아래 파일들은 이번 Docker 재현 구조를 위해 새로 추가되었거나 수정된 핵심 파일이다.
## 3.1 새로 추가된 파일
1. `Dockerfile.frontend`
2. `Dockerfile.backend`
3. `.dockerignore`
4. `docker-compose.yaml`
5. `start_docker_wsl.ps1`
6. `stop_docker_wsl.ps1`
7. `start_docker_wsl.bat`
8. `stop_docker_wsl.bat`
9. `docker/mysql/init/README.md`
10. `docker_task_plan.md`
11. `doc_readme2.md`
---
## 3.2 기존 파일 중 수정된 핵심 파일
1. `server.js`
2. `vite.config.ts`
3. `doc_readme.md`
---
## 3.3 각 파일의 역할
### `Dockerfile.frontend`
역할:
1. 프런트 Vite 개발 서버 이미지를 만든다.
2. 컨테이너 내부에서 `npm run dev -- --host 0.0.0.0`를 실행한다.
### `Dockerfile.backend`
역할:
1. 백엔드 Express 서버 이미지를 만든다.
2. 컨테이너 내부에서 `npm run server`를 실행한다.
### `.dockerignore`
역할:
1. `node_modules`, `build`, `.git`, `.env`, `uploads` 같은 불필요한 파일을 Docker build context에서 제외한다.
### `docker-compose.yaml`
역할:
1. `frontend`, `backend` 두 컨테이너를 동시에 띄운다.
2. `backend`는 `.env`의 외부 DB를 사용한다.
3. `frontend`는 `backend:3000`으로 프록시한다.
### `start_docker_wsl.ps1`
역할:
1. Windows 경로를 WSL 경로로 안전하게 바꾼다.
2. WSL 내부 Docker를 사용해 `docker compose up --build -d`를 실행한다.
3. 한글 경로와 공백 경로에서도 안정적으로 실행되게 한다.
### `stop_docker_wsl.ps1`
역할:
1. 같은 방식으로 WSL 내부에서 `docker compose down`을 실행한다.
### `start_docker_wsl.bat`, `stop_docker_wsl.bat`
역할:
1. PowerShell 스크립트를 쉽게 실행하는 래퍼 역할을 한다.
### `server.js`
중요 수정 사항:
1. `dotenv.config({ override: true })`가 아니라 `dotenv.config()`를 사용한다.
이유:
1. Compose나 실행 환경이 주는 환경변수를 `.env`가 덮어써 버리면 안 된다.
2. 외부 DB 정보와 포트 설정 등 실행 환경 우선 구조를 유지해야 한다.
### `vite.config.ts`
중요 수정 사항:
1. 프록시 타깃을 고정 `localhost:3000`이 아니라 환경변수 기반으로 받도록 바꿨다.
현재 구조:
```ts
const proxyTarget = process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:3000';
```
이유:
1. 로컬에서 직접 프런트를 띄울 때는 `localhost:3000`이 맞다.
2. Docker 안에서는 `frontend` 컨테이너에서 보는 `localhost`가 백엔드가 아니므로 `backend:3000`을 써야 한다.
---
## 4. 현재 `docker-compose.yaml` 기준 실제 동작 구조
현재 `docker-compose.yaml`은 아래 구조다.
### `backend`
1. `Dockerfile.backend`로 이미지를 빌드한다.
2. `.env`를 읽는다.
3. DB 관련 변수는 `${DB_HOST}`, `${DB_PORT}`, `${DB_USER}`, `${DB_PASS}`, `${DB_NAME}`를 그대로 사용한다.
4. 포트 `3000:3000`으로 노출한다.
5. `uploads`, `map_config.json`을 마운트한다.
### `frontend`
1. `Dockerfile.frontend`로 이미지를 빌드한다.
2. `VITE_DEV_PROXY_TARGET: http://backend:3000` 환경변수를 사용한다.
3. 포트 `8080:8080`으로 노출한다.
4. 브라우저의 `/api` 요청을 `backend`로 프록시한다.
즉, 현재 Compose는 DB를 띄우지 않고 앱 두 개만 띄운다.
---
## 5. 사전 준비 사항
이 섹션은 Gitea에서 코드를 받기 전 또는 받은 직후에 확인해야 한다.
## 5.1 가정하는 기본 상태
이미 설치되어 있다고 가정하는 것:
1. Windows
2. WSL2
3. Ubuntu 배포판
아직 없을 수 있는 것:
1. Docker Desktop 또는 WSL 내부 Docker 사용 환경
2. Git 클라이언트
3. 프로젝트 `.env`
---
## 5.2 권장 Docker 실행 방식
현재 저장소 구조상 가장 권장하는 방식은 다음이다.
1. Windows에 Docker Desktop 설치
2. Docker Desktop에서 WSL2 통합 활성화
3. Ubuntu WSL 내부에서 `docker` 명령을 사용할 수 있게 한다.
이유:
1. 현재 `start_docker_wsl.ps1`가 WSL 내부의 `docker`를 호출하는 구조다.
2. 실제 검증도 WSL 내부 Docker 기준으로 이루어졌다.
---
## 5.3 외부 DB 정보 준비
현재 구조는 외부 MySQL을 사용하므로 `.env` 파일이 반드시 필요하다.
최소한 아래 값이 필요하다.
```env
DB_HOST=<외부 MySQL 호스트>
DB_PORT=3306
DB_USER=<외부 MySQL 계정>
DB_PASS=<외부 MySQL 비밀번호>
DB_NAME=itam
```
필요 시 추가 환경변수는 현재 백엔드 코드 기준으로 함께 넣을 수 있다.
---
## 6. Gitea에서 소스 받기
## 6.1 작업 실행 위치
이 단계는 **Windows PowerShell** 또는 **Windows 터미널의 PowerShell**에서 수행한다.
실행 위치 이유:
1. 이후 `start_docker_wsl.ps1`도 Windows PowerShell에서 실행하는 것이 가장 자연스럽다.
2. 로컬 작업 폴더를 Windows 경로 기준으로 준비할 수 있다.
---
## 6.2 소스 클론
예시:
```powershell
git clone <Gitea 저장소 URL>
cd <클론된 저장소 경로>
```
현재 프로젝트처럼 한글 경로를 사용할 수도 있지만, 가능하면 너무 복잡한 경로는 피하는 것이 좋다.
현재 실제 프로젝트 경로 예시는 아래였다.
```text
c:\Users\user\Desktop\안건 파일\itam
```
이 경로도 현재 스크립트로는 동작 가능하다.
---
## 7. Docker 환경 준비
## 7.1 작업 실행 위치
이 단계는 **Windows PowerShell**과 **WSL Ubuntu 터미널**을 둘 다 사용한다.
1. 설치 확인은 Windows PowerShell에서 시작
2. 실제 Docker 동작 확인은 WSL Ubuntu에서 수행
---
## 7.2 Docker Desktop 설치 여부 확인
**실행 위치: Windows PowerShell**
```powershell
docker version
```
만약 여기서 바로 안 잡혀도 현재 프로젝트는 WSL 내부 Docker를 쓰므로, 다음 단계로 넘어가 WSL 내부 확인을 한다.
---
## 7.3 WSL 내부 Docker 확인
**실행 위치: Windows PowerShell**
```powershell
wsl -l -v
wsl sh -lc "docker --version"
```
정상 기대 결과:
1. Ubuntu가 Running 상태
2. `docker --version`이 정상 출력
만약 `docker --version`이 실패하면, Docker Desktop 설치 및 WSL 통합을 먼저 완료해야 한다.
---
## 8. `.env` 파일 준비
## 8.1 작업 실행 위치
이 단계는 **Windows PowerShell**, **VS Code**, 또는 아무 텍스트 편집기**에서 수행한다.
즉, 프로젝트 루트에 `.env` 파일을 만드는 작업이다.
---
## 8.2 `.env` 작성
프로젝트 루트에 `.env`를 만든다.
예시:
```env
DB_HOST=your-external-db-host
DB_PORT=3306
DB_USER=your-db-user
DB_PASS=your-db-password
DB_NAME=itam
```
주의:
1. 현재 Compose는 내부 DB를 만들지 않는다.
2. 따라서 이 값이 곧 실제 운영/개발 외부 DB 연결 정보다.
3. 이 정보가 틀리면 `backend`는 기동해도 API에서 DB 오류가 난다.
---
## 9. 현재 Docker 파일이 어떻게 동작하는지 이해하기
## 9.1 `Dockerfile.frontend`
**확인 위치: 프로젝트 루트 / VS Code**
현재 내용 핵심:
```dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 8080
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
```
의미:
1. Node 20 Alpine 기반
2. 의존성 설치 후 전체 소스 복사
3. Vite 개발 서버 실행
---
## 9.2 `Dockerfile.backend`
**확인 위치: 프로젝트 루트 / VS Code**
현재 내용 핵심:
```dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "run", "server"]
```
의미:
1. Node 20 Alpine 기반
2. Express 서버 실행
---
## 9.3 `vite.config.ts`
**확인 위치: 프로젝트 루트 / VS Code**
현재 핵심:
```ts
const proxyTarget = process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:3000';
```
그리고 `/api`, `/uploads`가 모두 `proxyTarget`으로 프록시된다.
의미:
1. 로컬 실행 시 기본값은 `localhost:3000`
2. Docker 실행 시 Compose가 `http://backend:3000`을 주입
이 수정이 있어야 Docker 안에서도 화면에 데이터가 표시된다.
---
## 10. Docker Compose 기동
## 10.1 작업 실행 위치
이 단계는 반드시 **Windows PowerShell**에서 수행하는 것을 권장한다.
이유:
1. `start_docker_wsl.ps1`가 Windows 경로를 받아 WSL 경로로 바꾸는 구조다.
2. 한글/공백 경로에서 가장 안전하다.
---
## 10.2 권장 기동 방법
**실행 위치: 프로젝트 루트의 Windows PowerShell**
```powershell
.\start_docker_wsl.ps1
```
또는
```powershell
.\start_docker_wsl.bat
```
이 스크립트는 내부적으로 아래를 수행한다.
1. PowerShell 출력 인코딩을 UTF-8로 설정
2. 현재 Windows 경로를 WSL 경로로 변환
3. WSL 동작 확인
4. WSL 내부 Docker 동작 확인
5. `docker compose up --build -d` 수행
---
## 10.3 직접 기동이 필요할 때
**실행 위치: WSL Ubuntu 터미널**
직접 실행 예시는 아래와 같다.
```bash
cd /mnt/c/Users/user/Desktop/안건\ 파일/itam
docker compose up --build -d
```
하지만 현재 프로젝트는 한글 경로 이슈가 있었기 때문에, 특별한 이유가 없으면 `start_docker_wsl.ps1`를 우선 사용한다.
---
## 11. 컨테이너 기동 후 검증
## 11.1 컨테이너 상태 확인
**실행 위치: Windows PowerShell**
```powershell
wsl sh -lc "docker ps -a --format 'table {{.Names}}\t{{.Status}}' | grep itam"
```
정상 기대 상태:
1. `itam-backend` -> `Up`
2. `itam-frontend` -> `Up`
현재는 `itam-db`, `itam-db-bootstrap`가 없어야 정상이다.
---
## 11.2 백엔드 API 확인
**실행 위치: Windows PowerShell**
```powershell
Invoke-WebRequest -Uri http://localhost:3000/api/assets/master -UseBasicParsing | Select-Object -ExpandProperty StatusCode
```
정상 기대값:
1. `200`
이 검사는 `backend`가 외부 DB에 정상 연결됐는지 보는 가장 직접적인 검사다.
---
## 11.3 프런트 경유 API 확인
**실행 위치: Windows PowerShell**
```powershell
Invoke-WebRequest -Uri http://localhost:8080/api/assets/master -UseBasicParsing | Select-Object -ExpandProperty StatusCode
```
정상 기대값:
1. `200`
이 검사는 프런트 프록시가 정상인지 확인한다.
예전에 화면에 데이터가 안 보였던 것은 외부 DB 자체가 아니라, 이 프록시 경로가 잘못돼 있었기 때문이다.
---
## 11.4 브라우저 화면 확인
**실행 위치: 브라우저**
```text
http://localhost:8080
```
확인 포인트:
1. 화면이 열리는지
2. 목록/대시보드/테이블 데이터가 비어 있지 않은지
3. 모달 진입 시 데이터가 정상적으로 보이는지
---
## 12. 지금 데이터가 표시되는 원리
현재는 내부 DB로 데이터를 옮겨 담지 않는다.
현재 실제 동작 원리는 다음과 같다.
1. 브라우저가 `frontend`에 접속한다.
2. 프런트가 `/api/...`로 요청한다.
3. Vite 프록시가 `backend:3000`으로 요청을 넘긴다.
4. `backend`가 `.env`의 외부 MySQL에 직접 접속한다.
5. 조회 결과 JSON을 프런트가 받아 화면에 렌더링한다.
즉, 현재는 아래 구조다.
```text
Browser -> frontend -> backend -> external MySQL
```
예전 외부 DB 구조에서 화면에 데이터가 안 보였던 이유는 외부 DB 때문이 아니라, 프런트 컨테이너가 `localhost:3000`을 잘못 바라보고 있었기 때문이다.
지금은 `VITE_DEV_PROXY_TARGET: http://backend:3000`으로 수정되어 있기 때문에 정상 표시된다.
---
## 13. 자주 헷갈리는 포인트
## 13.1 현재는 내부 DB 컨테이너가 없다
현재 `docker-compose.yaml`에는 아래가 없다.
1. `db` 서비스
2. `db-bootstrap` 서비스
3. `itam_mysql_data` 볼륨
즉, DB는 Docker 스택 밖에 있다.
---
## 13.2 현재는 `.env`가 곧 실제 DB 연결 정보다
현재 `backend`는 아래처럼 Compose에서 그대로 받는다.
1. `DB_HOST: ${DB_HOST}`
2. `DB_PORT: ${DB_PORT}`
3. `DB_USER: ${DB_USER}`
4. `DB_PASS: ${DB_PASS}`
5. `DB_NAME: ${DB_NAME}`
즉, `.env`를 틀리게 적으면 화면도 데이터가 안 뜬다.
---
## 13.3 `server.js`는 여전히 중요하게 수정된 상태다
현재 `server.js`는 `dotenv.config()`를 사용한다.
이 구조는 이후 Compose나 실행 환경에서 변수를 주입할 때, 애플리케이션이 그 값을 받아들일 수 있게 하기 위해 유지해야 한다.
---
## 14. 스택 중지 방법
## 14.1 작업 실행 위치
**Windows PowerShell / 프로젝트 루트**
---
## 14.2 권장 종료 명령
```powershell
.\stop_docker_wsl.ps1
```
또는
```powershell
.\stop_docker_wsl.bat
```
이 스크립트는 내부적으로 WSL 경로 변환 후 `docker compose down`을 수행한다.
---
## 15. 장애 발생 시 점검 순서
## 15.1 `frontend` 화면은 뜨는데 데이터가 없을 때
**실행 위치: Windows PowerShell**
먼저 아래 두 API를 분리해서 본다.
```powershell
Invoke-WebRequest -Uri http://localhost:3000/api/assets/master -UseBasicParsing | Select-Object -ExpandProperty StatusCode
Invoke-WebRequest -Uri http://localhost:8080/api/assets/master -UseBasicParsing | Select-Object -ExpandProperty StatusCode
```
판단 기준:
1. `3000`은 200이고 `8080`만 실패 -> 프런트 프록시 문제
2. 둘 다 실패 -> 백엔드 또는 외부 DB 연결 문제
---
## 15.2 백엔드가 외부 DB에 연결되지 않을 때
**실행 위치: Windows PowerShell**
```powershell
wsl sh -lc "docker logs --tail=200 itam-backend"
```
점검 항목:
1. `.env`의 DB 정보가 정확한지
2. 외부 DB 서버 접근이 가능한지
3. 계정/비밀번호가 맞는지
4. 방화벽 또는 네트워크 이슈가 없는지
---
## 16. 운영 수동 배포 플로우
이 섹션은 현재 ITAM 저장소 기준으로 운영 서버에 반영할 때의 전체 흐름을 설명한다.
중요한 전제는 아래와 같다.
1. 로컬 수정본을 서버에 직접 복사하지 않는다.
2. 반드시 Gitea에 올라간 커밋을 기준으로 배포한다.
3. 운영 반영은 자동 푸시 배포가 아니라 Gitea workflow 수동 실행으로 진행한다.
4. 현재 기준 운영 배포 workflow는 `.gitea/workflows/itam_production_deploy.yml`이다.
---
## 16.1 전체 운영/배포 분기 흐름
운영 반영은 크게 세 상황으로 나뉜다.
1. 최초 운영 서버 구축 후 첫 배포
2. 코드 수정 후 일반 재배포
3. 검증 실패 또는 배포 실패 후 수정 재배포
아래 분기 구조로 이해하면 된다.
```mermaid
flowchart TD
START["배포 필요 발생"] --> CASE{"어떤 상황인가?"}
CASE -->|초기 구축| INIT["초기 운영 배포 준비"]
CASE -->|수정 반영| CHANGE["수정 후 재배포 준비"]
CASE -->|실패 후 재시도| RETRY["실패 원인 분석 후 재배포 준비"]
INIT --> INIT1["운영 서버 Docker / compose 확인"]
INIT1 --> INIT2["Gitea Variables / Secrets 등록"]
INIT2 --> INIT3["map_config.json / uploads 초기 데이터 준비"]
INIT3 --> MANUAL["Gitea에서 수동 배포 workflow 실행"]
CHANGE --> CHANGE1["로컬 수정 및 테스트"]
CHANGE1 --> CHANGE2["Gitea 커밋 / push"]
CHANGE2 --> CHANGE3["Code Check / Docker Build Check 통과"]
CHANGE3 --> MANUAL
RETRY --> RETRY1{"어디서 실패했는가?"}
RETRY1 -->|코드 체크 실패| FIX1["코드 또는 설정 수정"]
RETRY1 -->|배포 단계 실패| FIX2["서버 / 변수 / 권한 / 네트워크 수정"]
RETRY1 -->|Smoke Check 실패| FIX3["앱 기동 상태 / 프록시 / DB 상태 수정"]
FIX1 --> CHANGE2
FIX2 --> MANUAL
FIX3 --> MANUAL
MANUAL --> DEPLOY["운영 서버 반영 수행"]
DEPLOY --> RESULT{"최종 검증 통과?"}
RESULT -->|예| DONE["운영 반영 완료"]
RESULT -->|아니오| RETRY
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
핵심은 아래와 같다.
1. 초기 구축은 서버와 운영 데이터 준비가 먼저다.
2. 수정 반영은 반드시 커밋과 push가 먼저다.
3. 실패 후 재배포는 실패 지점에 따라 수정 위치가 달라진다.
---
## 16.2 최초 운영 배포 플로우
최초 배포에서는 코드보다 운영 환경 준비가 더 중요하다.
순서는 아래와 같다.
1. 운영 서버에 Docker Engine과 `docker compose`를 설치한다.
2. 운영 서버에서 Gitea 저장소에 접근 가능한 SSH 키를 준비한다.
3. Gitea repository Variables / Secrets를 등록한다.
4. `PROD_DEPLOY_PATH` 경로를 정한다.
5. `map_config.json`, `uploads/` 초기 데이터를 준비한다.
6. Gitea에서 `itam_production_deploy.yml`을 수동 실행한다.
7. 배포 후 `ps`, `/health`, `/`, `/ready`를 확인한다.
즉 최초 배포는 아래 조건이 먼저 충족되어야 한다.
```text
서버 준비 완료
-> Gitea 변수 / 시크릿 등록 완료
-> 초기 데이터 준비 완료
-> 수동 배포 실행
```
---
## 16.3 수정 후 일반 재배포 플로우
일반적인 수정 반영은 아래 흐름이다.
1. 개발자가 로컬에서 코드 또는 설정을 수정한다.
2. 로컬에서 필요한 테스트를 수행한다.
3. 변경사항을 Gitea에 커밋 후 push 한다.
4. `itam_code_check.yml`이 빌드와 compose 문법을 검사한다.
5. `itam_docker_build_check.yml`이 운영용 이미지 빌드 가능 여부를 검사한다.
6. 두 검증이 통과하면 운영자가 Gitea에서 `itam_production_deploy.yml`을 수동 실행한다.
7. 운영 서버가 최신 커밋으로 동기화되고 컨테이너가 다시 올라온다.
8. smoke check 통과 여부를 확인한다.
아래 다이어그램은 이 일반 재배포 흐름을 보여준다.
```mermaid
flowchart LR
DEV["로컬 수정"] --> TEST["로컬 확인"]
TEST --> PUSH["커밋 / push"]
PUSH --> CODE["ITAM Code Check"]
CODE --> BUILD["ITAM Docker Build Check"]
BUILD --> GATE{"검증 통과?"}
GATE -->|예| RUN["Gitea에서 수동 배포 실행"]
GATE -->|아니오| FIX["로컬 수정 후 재커밋"]
FIX --> PUSH
RUN --> PROD["운영 서버 배포"]
PROD --> SMOKE{"Smoke Check 통과?"}
SMOKE -->|예| OK["배포 완료"]
SMOKE -->|아니오| FIXDEPLOY["원인 수정 후 재배포"]
FIXDEPLOY --> RUN
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
---
## 16.4 수동 배포 workflow 내부 실행 순서
Gitea에서 `itam_production_deploy.yml`을 수동 실행하면 내부적으로는 아래 순서로 진행된다.
1. SSH agent를 설정한다.
2. 필수 Variables / Secrets가 모두 있는지 확인한다.
3. 운영용 `.env.deploy` 파일을 생성한다.
4. 운영 서버에 접속한다.
5. `PROD_DEPLOY_PATH`를 생성한다.
6. 저장소를 clone 또는 fetch 한다.
7. 선택한 브랜치의 최신 커밋으로 checkout, reset, clean 한다.
8. `uploads`, `logs/nginx` 디렉토리를 준비한다.
9. `.env.deploy`를 서버의 `.env`로 복사한다.
10. `docker compose -f docker-compose.prod.yaml config`를 수행한다.
11. `docker compose -f docker-compose.prod.yaml up -d --build`를 수행한다.
12. `docker compose ps`를 확인한다.
13. `/health`, `/`, backend `/ready` smoke check를 수행한다.
아래 다이어그램은 workflow 내부 실행 순서다.
```mermaid
flowchart TD
A["수동 배포 시작"] --> B["SSH agent 설정"]
B --> C["Variables / Secrets 검증"]
C --> D{"필수 값 누락 여부"}
D -->|예| E["즉시 실패 후 설정 보완"]
D -->|아니오| F[".env.deploy 생성"]
F --> G["운영 서버 SSH 접속"]
G --> H["배포 경로 생성"]
H --> I["git clone 또는 fetch"]
I --> J["지정 브랜치 checkout / reset / clean"]
J --> K["uploads / logs/nginx 준비"]
K --> L[".env 업로드 및 권한 설정"]
L --> M["compose config 검증"]
M --> N{"compose config 성공?"}
N -->|아니오| O["설정 수정 후 재실행"]
N -->|예| P["compose up -d --build"]
P --> Q["docker compose ps 확인"]
Q --> R["/health, /, /ready smoke check"]
R --> S{"smoke check 성공?"}
S -->|예| T["운영 배포 완료"]
S -->|아니오| U["원인 분석 후 재배포"]
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
---
## 16.5 실패 후 검증 및 재배포 플로우
실패가 났다고 해서 항상 같은 방식으로 다시 배포하면 안 된다.
실패 지점별 판단은 아래처럼 나눈다.
1. Code Check 실패: TypeScript, build, compose 문법 문제를 먼저 수정한다.
2. Docker Build Check 실패: Dockerfile, 정적 자산 복사, 운영 빌드 컨텍스트 문제를 수정한다.
3. Deploy 단계 실패: SSH, Gitea 변수, 서버 권한, 경로, git 접근, Docker 권한을 수정한다.
4. Smoke Check 실패: Nginx 프록시, backend readiness, 외부 DB 연결, 앱 런타임 오류를 수정한다.
즉 재배포 전 판단 기준은 아래와 같다.
```text
CI 실패 -> 로컬 코드 / 설정 수정 후 재커밋
배포 실패 -> 서버 환경 또는 배포 설정 수정 후 수동 재실행
Smoke Check 실패 -> 앱 / 프록시 / DB 상태 수정 후 수동 재실행
```
운영 관점에서는 아래 순서를 지키는 것이 안전하다.
1. 실패 지점 확인
2. 원인 수정
3. 같은 실패가 다시 나는지 좁은 범위로 재검증
4. 그 다음에만 수동 배포 재실행
---
## 16.6 문서 기준 요약
현재 ITAM 운영 배포는 아래 원칙으로 이해하면 된다.
1. 수정은 로컬에서 한다.
2. 배포 기준점은 Gitea에 올라간 커밋이다.
3. 운영 반영은 Gitea 수동 workflow 실행으로 한다.
4. 초기 배포, 일반 재배포, 실패 후 재배포는 분기 기준이 다르다.
5. 최종 성공 여부는 컨테이너 상태가 아니라 smoke check까지 통과했는지로 판단한다.
---
## 15.3 프런트 프록시가 의심될 때
**확인 위치: `vite.config.ts`, `docker-compose.yaml`**
다음 두 설정이 유지되는지 확인한다.
`vite.config.ts`
```ts
const proxyTarget = process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:3000';
```
`docker-compose.yaml`
```yaml
VITE_DEV_PROXY_TARGET: http://backend:3000
```
이 둘 중 하나라도 바뀌면 Docker 안에서 화면 데이터가 다시 안 보일 수 있다.
---
## 17. 현재 기준 재현 절차 요약
가장 짧게 정리하면 아래 순서다.
1. Gitea에서 소스를 클론한다.
2. Windows PowerShell에서 프로젝트 루트로 이동한다.
3. `.env`에 외부 MySQL 정보를 작성한다.
4. Docker Desktop + WSL 통합 또는 WSL 내부 Docker 사용 가능 상태를 만든다.
5. `start_docker_wsl.ps1`를 실행한다.
6. `http://localhost:3000/api/assets/master`가 200인지 확인한다.
7. `http://localhost:8080/api/assets/master`가 200인지 확인한다.
8. 브라우저에서 `http://localhost:8080`을 열어 실제 데이터 표시를 확인한다.
---
## 18. 현재 최종 결론
현재 저장소의 도커라이징 구조는 실무 표준에 맞는 `무상태 앱 컨테이너 + 외부 DB` 구조다.
현재 핵심은 아래 세 가지다.
1. `backend`는 외부 MySQL에 직접 연결한다.
2. `frontend`는 `backend:3000`으로 API 프록시한다.
3. WSL 경로 변환 스크립트를 통해 Windows 한글 경로에서도 안정적으로 실행한다.
즉, 이 문서대로 진행하면 Gitea 소스만 받은 상태에서 지금과 같은 Docker 실행 구조를 재현할 수 있다.
-730
View File
@@ -1,730 +0,0 @@
# ITAM 도커라이징 최종 재현 가이드
## 1. 문서 목적
이 문서는 현재 Git 저장소에 올라간 파일만 가지고, 지금과 동일한 수준으로 ITAM 시스템을 도커라이징하고 실행하는 절차를 처음부터 끝까지 정리한 최종 가이드다.
이 문서만 읽어도 아래 목표를 달성할 수 있게 작성한다.
1. 현재 저장소 구조를 이해한다.
2. 왜 이렇게 도커라이징했는지 판단 근거를 안다.
3. WSL2 기반으로 실제 스택을 기동한다.
4. 외부 MySQL에서 내부 MySQL 컨테이너로 초기 데이터를 bootstrap 한다.
5. 프런트 8080과 백엔드 3000이 모두 정상 동작하는지 검증한다.
6. 재초기화, 재기동, 장애 확인까지 수행한다.
이 문서는 최종 성공 구조 기준이다. 실패 기록은 `doc_readme.md`를 본다.
---
## 2. 최종 목표 구조
현재 최종 구조는 아래 4개 서비스/역할로 나뉜다.
1. `frontend`: Vite 개발 서버 컨테이너, 포트 8080
2. `backend`: Express API 서버 컨테이너, 포트 3000
3. `db`: MySQL 8 컨테이너, 포트 3306
4. `db-bootstrap`: 외부 MySQL -> 내부 MySQL로 1회성 복제 수행 후 종료되는 도우미 컨테이너
논리 흐름은 다음과 같다.
```text
브라우저 -> frontend:8080 -> Vite proxy -> backend:3000 -> db:3306
\
-> /uploads -> backend 정적 경로
초기 1회 기동 시
외부 MySQL(.env) -> db-bootstrap -> 내부 MySQL(db)
```
---
## 3. 왜 이 구조를 선택했는가
이 저장소는 처음부터 운영형 정적 배포 앱이 아니었다. 실제 구조는 다음과 같았다.
1. 프런트는 Vite 개발 서버가 따로 돈다.
2. 백엔드는 Express API가 따로 돈다.
3. 프런트는 상대 경로 `/api`를 호출한다.
4. 백엔드는 프런트의 `dist`를 서빙하지 않는다.
따라서 내일 바로 시연 가능한 수준까지 빠르게 안정화하려면 아래 전략이 가장 맞다.
1. 프런트를 Vite dev server 그대로 컨테이너화한다.
2. 백엔드를 별도 컨테이너로 유지한다.
3. DB는 MySQL 8 컨테이너로 묶되, 초기 데이터는 외부 DB에서 복제한다.
4. 프런트 프록시는 컨테이너 네트워크 서비스명 `backend`로 붙게 한다.
즉, 현재 구조는 "개발형 구조를 Docker로 재현한 시연/개발용 Compose"다.
---
## 4. 저장소 내 최종 관련 파일 목록
현재 도커라이징과 직접 관련된 핵심 파일은 아래와 같다.
1. `.dockerignore`
2. `Dockerfile.frontend`
3. `Dockerfile.backend`
4. `docker-compose.yaml`
5. `start_docker_wsl.ps1`
6. `stop_docker_wsl.ps1`
7. `start_docker_wsl.bat`
8. `stop_docker_wsl.bat`
9. `docker/mysql/init/README.md`
10. `server.js`
11. `vite.config.ts`
각 파일 역할은 다음과 같다.
### 4.1 `.dockerignore`
Docker build context에서 제외할 파일을 정의한다.
주요 제외 대상은 다음과 같다.
1. `node_modules`
2. `dist`
3. `build`
4. `.git`
5. `.env`
6. `uploads`
7. `*.xlsx`
8. `*.log`
### 4.2 `Dockerfile.frontend`
프런트 컨테이너 이미지 정의다.
```dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 8080
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
```
이 이미지는 Vite dev server를 컨테이너에서 띄우기 위한 것이다.
### 4.3 `Dockerfile.backend`
백엔드 컨테이너 이미지 정의다.
```dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "run", "server"]
```
### 4.4 `docker-compose.yaml`
전체 스택의 핵심 파일이다.
현재 최종 구성은 다음 논리를 가진다.
1. `db`는 MySQL 8 내부 DB다.
2. `db-bootstrap`은 외부 DB 데이터를 내부 DB로 1회 복제한다.
3. `backend`는 내부 `db`에 붙는다.
4. `frontend`는 `backend` 서비스명으로 프록시한다.
### 4.5 `start_docker_wsl.ps1`
Windows에서 WSL 경유로 Docker Compose를 안전하게 기동하는 진입점이다.
핵심은 다음 두 가지다.
1. 프로젝트 Windows 경로를 `wslpath`로 WSL 경로로 바꾼다.
2. 그 경로로 이동한 뒤 `docker compose up --build -d`를 수행한다.
### 4.6 `stop_docker_wsl.ps1`
같은 방식으로 WSL 내부에서 `docker compose down`을 수행해 스택을 안전하게 내린다.
### 4.7 `start_docker_wsl.bat`, `stop_docker_wsl.bat`
더블클릭 또는 간단 실행용 래퍼다. 내부적으로 PowerShell 스크립트를 호출한다.
### 4.8 `server.js`
중요 포인트는 다음 두 가지다.
1. `dotenv.config();`를 사용한다.
2. `dotenv.config({ override: true })`를 사용하지 않는다.
이 차이로 Compose 환경변수 `DB_HOST=db`가 `.env`보다 우선하도록 보장한다.
### 4.9 `vite.config.ts`
현재 프록시는 환경변수 기반으로 동작한다.
```ts
const proxyTarget = process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:3000';
```
로컬 PC에서 직접 Vite를 띄우면 기본값 `http://localhost:3000`을 쓴다.
컨테이너에서는 Compose가 `http://backend:3000`을 주입한다.
---
## 5. 현재 최종 `docker-compose.yaml` 구조 설명
아래는 실제 동작 관점에서 읽어야 할 핵심 내용이다.
### 5.1 `db` 서비스
역할:
1. 내부 MySQL 데이터 저장소
2. 앱이 최종적으로 붙는 DB
핵심 설정:
1. 이미지: `mysql:8.0`
2. DB 이름: `itam`
3. 앱 계정: `itam_admin`
4. 데이터 볼륨: `itam_mysql_data`
5. healthcheck 사용
healthcheck는 `mysqladmin ping`으로 동작하며, `backend`와 `db-bootstrap`은 이 상태를 기다린다.
### 5.2 `db-bootstrap` 서비스
역할:
1. 외부 원본 DB에서 내부 `db`로 초기 데이터 복제
2. 1회성 작업 후 종료
핵심 포인트:
1. `.env`를 읽어 외부 DB 접속 정보를 가져온다.
2. 내부 `db`에 `asset_core` 테이블이 이미 존재하면 아무 것도 하지 않고 종료한다.
3. 그렇지 않으면 `mysqldump | mysql` 파이프라인으로 복제한다.
4. `restart: "no"` 이므로 정상 종료 후 반복 실행하지 않는다.
또한 source DB와 target DB 변수는 분리돼 있다.
1. source: `SOURCE_DB_*`
2. target: `TARGET_DB_*`
이 구조로 외부 원본 DB 자격증명과 내부 컨테이너 DB 자격증명이 섞이지 않는다.
### 5.3 `backend` 서비스
역할:
1. Express API 제공
2. 내부 `db`에 연결
3. `/uploads` 정적 제공
핵심 포인트:
1. `env_file: .env`를 유지하지만,
2. Compose `environment`에서 `DB_HOST=db`, `DB_PORT=3306`, `DB_USER=itam_admin`, `DB_PASS=itam1234`, `DB_NAME=itam`를 다시 지정한다.
3. `depends_on`은 `db` healthy와 `db-bootstrap` 성공 종료를 모두 기다린다.
즉, 백엔드는 DB bootstrap이 끝난 뒤 시작한다.
### 5.4 `frontend` 서비스
역할:
1. Vite dev server 제공
2. 브라우저 요청 `/api`, `/uploads`를 `backend`로 프록시
핵심 포인트:
1. `VITE_DEV_PROXY_TARGET: http://backend:3000`
2. `CHOKIDAR_USEPOLLING: "true"`
3. `npm run dev -- --host 0.0.0.0`
중요한 이유는 컨테이너 안의 `localhost`가 호스트의 `localhost`가 아니기 때문이다.
---
## 6. 사전 준비 조건
이 저장소를 지금처럼 기동하려면 다음 전제가 필요하다.
### 6.1 운영체제와 런타임
1. Windows
2. WSL2 Ubuntu 설치 및 실행 중
3. Docker CLI가 WSL 내부에서 동작 가능
권장 확인 명령:
```powershell
wsl -l -v
wsl sh -lc "docker --version"
```
### 6.2 `.env` 파일
현재 최종 구조는 "첫 기동 시 외부 DB에서 내부 DB로 bootstrap" 하는 방식이므로 `.env`가 반드시 필요하다.
최소한 다음 값은 외부 원본 DB를 가리켜야 한다.
```env
DB_HOST=<external-mysql-host>
DB_PORT=3306
DB_USER=<external-db-user>
DB_PASS=<external-db-password>
DB_NAME=itam
```
주의:
1. `.env`는 `db-bootstrap`이 외부 원본 DB에 접속할 때 사용한다.
2. `backend`는 최종적으로 내부 `db` 컨테이너를 쓰므로, 런타임에서는 Compose `environment`가 우선한다.
### 6.3 한글 경로 주의
현재 프로젝트 경로는 한글과 공백을 포함한다.
```text
c:\Users\user\Desktop\안건 파일\itam
```
이 때문에 Docker 관련 명령은 수동으로 경로를 조립하지 말고, `start_docker_wsl.ps1` / `stop_docker_wsl.ps1`을 우선 사용해야 한다.
---
## 7. 첫 기동 절차
이 절차는 "Git에서 소스를 받은 뒤 처음 올리는 경우" 기준이다.
### 7.1 저장소 준비
1. 저장소를 받는다.
2. `.env`가 올바른 외부 원본 DB를 가리키는지 확인한다.
3. WSL이 켜져 있는지 확인한다.
### 7.2 권장 실행 방법
Windows PowerShell에서 프로젝트 루트로 이동한 뒤 아래 중 하나를 사용한다.
방법 A:
```powershell
.\start_docker_wsl.ps1
```
방법 B:
```powershell
.\start_docker_wsl.bat
```
### 7.3 내부 실행 순서
스크립트는 내부적으로 다음 순서로 동작한다.
1. 현재 Windows 경로를 WSL 경로로 변환한다.
2. WSL 동작 여부를 확인한다.
3. WSL 내부 Docker 사용 가능 여부를 확인한다.
4. `docker compose up --build -d`를 수행한다.
### 7.4 기대되는 컨테이너 순서
정상이라면 다음 순서로 올라온다.
1. `itam-db`
2. `itam-db-bootstrap`
3. `itam-backend`
4. `itam-frontend`
`itam-db-bootstrap`은 정상이라면 최종 상태가 `Exited (0)`이어야 한다.
---
## 8. 첫 기동 후 검증 절차
기동 후에는 반드시 아래 검증을 수행한다.
### 8.1 컨테이너 상태 확인
```powershell
wsl sh -lc "docker ps -a --format 'table {{.Names}}\t{{.Status}}' | grep itam"
```
정상 기대 상태:
1. `itam-db` -> `Up ... (healthy)`
2. `itam-db-bootstrap` -> `Exited (0)`
3. `itam-backend` -> `Up`
4. `itam-frontend` -> `Up`
### 8.2 백엔드 API 직접 확인
```powershell
Invoke-WebRequest -Uri http://localhost:3000/api/assets/master -UseBasicParsing | Select-Object -ExpandProperty StatusCode
```
정상 기대값:
1. `200`
### 8.3 프런트 경유 API 확인
```powershell
Invoke-WebRequest -Uri http://localhost:8080/api/assets/master -UseBasicParsing | Select-Object -ExpandProperty StatusCode
```
정상 기대값:
1. `200`
### 8.4 데이터가 실제로 들어왔는지 확인
```powershell
wsl sh -lc "docker exec itam-db mysql -uitam_admin -pitam1234 -D itam -e 'SHOW TABLES' | head -n 20"
```
정상이라면 아래와 같은 테이블들이 보여야 한다.
1. `asset_core`
2. `asset_remote`
3. `asset_spec`
4. `asset_location`
5. `asset_history`
6. `asset_software_perpetual`
7. `asset_software_subscription`
8. `hardware_components_master`
9. `job_spec_standards`
### 8.5 브라우저 화면 확인
브라우저에서 아래 주소를 연다.
```text
http://localhost:8080
```
목록/대시보드 데이터가 보이면 화면까지 정상 연결된 것이다.
---
## 9. 재기동 절차
코드만 수정됐고 DB는 유지하고 싶다면 다음처럼 하면 된다.
### 9.1 스택 종료
```powershell
.\stop_docker_wsl.ps1
```
또는
```powershell
.\stop_docker_wsl.bat
```
### 9.2 스택 재기동
```powershell
.\start_docker_wsl.ps1
```
이 경우 `itam_mysql_data` 볼륨이 유지되므로, `db-bootstrap`은 내부 DB에 `asset_core`가 이미 있음을 감지하고 빠르게 종료한다.
---
## 10. DB를 완전히 다시 초기화하는 절차
외부 원본 DB에서 다시 처음부터 내부 DB를 복제하고 싶다면, MySQL 볼륨을 제거해야 한다.
### 10.1 스택 중지
```powershell
.\stop_docker_wsl.ps1
```
### 10.2 MySQL 데이터 볼륨 삭제
```powershell
wsl sh -lc "docker volume rm -f itam_itam_mysql_data"
```
### 10.3 다시 시작
```powershell
.\start_docker_wsl.ps1
```
이때 `db-bootstrap`이 외부 DB에서 내부 DB로 전체를 다시 복제한다.
---
## 11. 현재 구조에서 꼭 알아야 할 설계 포인트
### 11.1 `server.js`의 `dotenv.config()` 변경 이유
백엔드가 내부 DB로 붙게 하려면 Compose가 준 환경변수가 `.env`보다 우선해야 한다.
만약 아래처럼 `override: true`를 쓰면 안 된다.
```js
dotenv.config({ override: true });
```
이렇게 되면 내부 `db`가 아니라 `.env`의 외부 DB로 다시 붙을 수 있다.
현재는 아래가 맞다.
```js
dotenv.config();
```
### 11.2 왜 `docker-entrypoint-initdb.d` 기반 dump 파일을 안 쓰는가
처음에는 이 방식을 시도했지만, 실제 데이터의 긴 문자열/깨진 텍스트 때문에 import가 line 97에서 중단됐다.
그래서 현재는 더 안정적인 아래 방식을 쓴다.
1. 외부 DB에서 `mysqldump`
2. 파이프로 내부 `db`에 즉시 `mysql` import
즉, 파일 중간 생성물을 신뢰하지 않는 구조다.
### 11.3 왜 프런트 프록시 타깃을 환경변수화했는가
로컬 직접 실행과 컨테이너 실행의 네트워크 기준이 다르기 때문이다.
1. 로컬 직접 실행: `localhost:3000`이 맞다.
2. 컨테이너 내부 실행: `backend:3000`이 맞다.
그래서 `vite.config.ts`는 둘 다 수용할 수 있게 작성됐다.
---
## 12. 문제 발생 시 진단 순서
이 프로젝트에서는 문제를 아래 순서로 자르면 가장 빠르다.
### 12.1 브라우저 화면에 데이터가 없을 때
먼저 다음 둘을 분리해서 본다.
1. `http://localhost:3000/api/assets/master`
2. `http://localhost:8080/api/assets/master`
판단 기준:
1. `3000`은 200이고 `8080`만 실패면 프런트 프록시 문제다.
2. 둘 다 실패면 백엔드 또는 DB 문제다.
### 12.2 DB bootstrap이 성공했는지 확인할 때
```powershell
wsl sh -lc "docker ps -a --format 'table {{.Names}}\t{{.Status}}' | grep itam"
```
여기서 `itam-db-bootstrap`이 `Exited (0)`인지 본다.
### 12.3 내부 DB에 실제 데이터가 있는지 확인할 때
```powershell
wsl sh -lc "docker exec itam-db mysql -uitam_admin -pitam1234 -D itam -e 'SHOW TABLES'"
```
### 12.4 백엔드 로그 확인
```powershell
wsl sh -lc "docker logs --tail=200 itam-backend"
```
### 12.5 DB 로그 확인
```powershell
wsl sh -lc "docker logs --tail=200 itam-db"
```
### 12.6 프런트 로그 확인
```powershell
wsl sh -lc "docker logs --tail=200 itam-frontend"
```
---
## 13. 자주 나올 수 있는 장애와 해석
### 13.1 `docker` 명령이 PowerShell에서 안 보임
의미:
1. Windows 셸이 아니라 WSL에서 Docker를 쓰는 환경이다.
대응:
1. `start_docker_wsl.ps1` 사용
### 13.2 `asset_core` 테이블 없음
의미:
1. 내부 DB 초기화가 안 됐거나 bootstrap이 안 끝났다.
대응:
1. `db-bootstrap` 상태 확인
2. `.env` 외부 DB 접속 정보 확인
3. 필요하면 볼륨 삭제 후 재초기화
### 13.3 `3000` API는 되는데 화면은 비어 있음
의미:
1. DB는 정상이고 프런트 프록시 또는 화면 렌더링 문제다.
대응:
1. `8080/api/assets/master` 상태 먼저 확인
### 13.4 `db-bootstrap`가 실패 종료함
의미 후보:
1. `.env` 외부 DB 접속 정보 오류
2. 외부 DB 네트워크 접근 불가
3. 외부 계정 권한 문제
대응:
1. `docker logs itam-db-bootstrap` 확인
---
## 14. 현재 최종 검증 완료 상태
이 저장소는 아래 상태까지 검증이 완료됐다.
1. WSL2 Ubuntu에서 Docker 실행 가능
2. `start_docker_wsl.ps1`로 전체 스택 기동 가능
3. `db` 컨테이너 healthcheck 통과
4. `db-bootstrap`가 외부 DB에서 내부 DB로 데이터 복제 후 `Exited (0)` 종료
5. `backend`가 내부 `db`를 사용해 API 응답 가능
6. `frontend`가 `backend`를 프록시해 8080 기준 화면/API 동작 가능
7. 내부 MySQL에 실데이터 적재 확인
즉, 현재 Git에 올라간 상태만으로도 WSL2와 외부 원본 DB 정보만 있으면 지금과 같은 수준의 Docker 실행 재현이 가능하다.
---
## 15. 현재 구조의 한계와 다음 단계
현재 구조는 충분히 시연 가능하고 개발 재현도 가능하지만, 다음은 아직 별도 작업이 필요하다.
1. 운영형 정적 배포 구조 전환
2. 외부 DB 없이도 완전 독립 실행 가능한 정식 dump/backup 체계
3. `.env.example` 정리
4. DB bootstrap 전용 계정/권한 최소화
5. 장기적으로 `map_config.json` 파일 저장 정책 정리
하지만 "현재 저장소만으로 지금과 같은 Docker 실행 상태 재현"이라는 목표는 이미 충족한다.
---
## 16. 빠른 실행 요약
가장 짧게 요약하면 다음 순서다.
1. `.env`에 외부 원본 MySQL 접속 정보를 넣는다.
2. WSL2 Ubuntu와 WSL 내부 Docker가 살아 있는지 확인한다.
3. `start_docker_wsl.ps1`를 실행한다.
4. `itam-db-bootstrap`가 `Exited (0)`인지 확인한다.
5. `http://localhost:3000/api/assets/master`와 `http://localhost:8080/api/assets/master`가 모두 200인지 확인한다.
6. 브라우저에서 `http://localhost:8080`을 열어 데이터가 보이는지 확인한다.
이 순서대로 진행하면 현재 저장소 기준 Dockerized ITAM 시연 환경을 재현할 수 있다.
---
## 17. 2026-06-16 최신 정정
이 문서의 상단 본문은 한동안 사용했던 `내부 db + db-bootstrap` 구조를 기준으로 작성됐다. 하지만 오늘 기준 현재 저장소의 실제 `docker-compose.yaml`은 다시 `무상태 앱 컨테이너 + 외부 DB` 구조로 되돌아가 있다.
따라서 현재 시점의 정답 아키텍처는 아래다.
1. `backend` 컨테이너
2. `frontend` 컨테이너
3. 외부 MySQL DB
현재는 더 이상 아래 항목이 없다.
1. `db` 서비스 없음
2. `db-bootstrap` 서비스 없음
3. `itam_mysql_data` 볼륨 없음
### 17.1 현재 실제 `docker-compose.yaml` 기준 backend 동작
현재 backend는 `.env`의 외부 DB 접속 정보를 그대로 사용한다.
즉, 아래 환경변수 매핑이 현재 기준이다.
1. `DB_HOST: ${DB_HOST}`
2. `DB_PORT: ${DB_PORT}`
3. `DB_USER: ${DB_USER}`
4. `DB_PASS: ${DB_PASS}`
5. `DB_NAME: ${DB_NAME}`
`PORT: 3000`만 Compose에서 고정한다.
### 17.2 현재 실제 기동 구조
현재 스택 기동 순서는 단순하다.
1. `backend` 기동
2. `frontend` 기동
3. backend는 외부 DB에 직접 접속
4. frontend는 `http://backend:3000`으로 프록시
즉, 현재는 DB 컨테이너 초기화 단계나 bootstrap 단계가 존재하지 않는다.
### 17.3 현재 기준 첫 실행 체크리스트
오늘 기준으로는 아래 순서가 맞다.
1. `.env`에 외부 DB 접속 정보 입력
2. `start_docker_wsl.ps1` 또는 `start_docker_wsl.bat` 실행
3. `http://localhost:3000/api/assets/master`가 200인지 확인
4. `http://localhost:8080/api/assets/master`가 200인지 확인
5. 브라우저에서 `http://localhost:8080` 접속 후 데이터 표시 확인
### 17.4 이 문서에서 현재 유효한 부분과 과거 이력 부분
현재도 그대로 유효한 내용은 아래다.
1. WSL2 기반 실행 방식
2. `start_docker_wsl.ps1` / `stop_docker_wsl.ps1` 사용 방식
3. `server.js`에서 Compose 환경변수가 `.env`보다 우선되도록 `dotenv.config()`를 유지해야 한다는 점
4. `vite.config.ts`에서 프록시 타깃을 환경변수화해야 한다는 점
현재는 과거 이력으로만 읽어야 하는 내용은 아래다.
1. 내부 `db` 서비스 설명
2. `db-bootstrap` 설명
3. `itam_mysql_data` 볼륨 설명
4. 내부 DB 재초기화 절차
5. 내부 테이블 확인 절차
### 17.5 현재 최종 한 줄 요약
오늘 날짜 기준 현재 저장소의 실사용 Compose 구조는 `frontend + backend + external DB`이며, 이전의 내부 DB/bootstrap 구조는 역사적으로 한 번 사용했던 임시 해결책으로만 남아 있다.
-730
View File
@@ -1,730 +0,0 @@
# ITAM Linux 운영 배포 가이드
## 1. 문서 목적
이 문서는 현재 ITAM 저장소를 기준으로 Linux 환경에서 운영 배포하는 방법을 정리한 가이드다.
핵심 전제는 아래와 같다.
1. 저장소 구조를 크게 재편하지 않는다.
2. 현재 워크스페이스 기준 파일 구조를 그대로 활용한다.
3. `docker-compose.test.yaml`과 `docker-compose.prod.yaml` 모두 현재 저장소 루트 기준으로 동작한다.
4. DB는 Docker 내부가 아니라 외부 MySQL을 사용한다.
즉, 이 문서는 `/srv/itam` 같은 별도 운영 디렉터리 구조를 강제하는 문서가 아니라, 현재 저장소 구조를 기준으로 운영 전환하는 방법을 설명한다.
---
## 2. 현재 운영 관련 파일
현재 저장소에서 운영 전환과 직접 관련된 파일은 아래와 같다.
1. `docker-compose.yaml`
2. `docker-compose.test.yaml`
3. `docker-compose.prod.yaml`
4. `Dockerfile.frontend.prod`
5. `Dockerfile.backend.prod`
6. `docker/nginx/default.conf`
7. `docker/frontend/default.conf`
8. `.env.example`
9. `server.js`
각 파일의 역할은 아래와 같다.
1. `docker-compose.yaml`: 개발 재현용 구성
2. `docker-compose.test.yaml`: 운영형 Dockerfile과 reverse proxy 구조를 로컬에서 검증하는 테스트용 구성
3. `docker-compose.prod.yaml`: 현재 저장소 기준 운영용 구성
4. `Dockerfile.frontend.prod`: 프런트 정적 빌드 및 Nginx 서빙 이미지 정의
5. `Dockerfile.backend.prod`: 백엔드 API 운영 이미지 정의
6. `docker/nginx/default.conf`: reverse proxy 설정
7. `docker/frontend/default.conf`: frontend 컨테이너 내부 정적 파일 서빙 설정
8. `.env.example`: 운영/테스트 환경변수 템플릿
9. `server.js`: `/health`, `/ready` 엔드포인트 포함
---
## 3. 현재 기준 운영 아키텍처
현재 구조에서의 요청 흐름은 아래와 같다.
1. 외부 요청은 Nginx 컨테이너로 들어온다.
2. `/` 요청은 frontend 컨테이너로 전달된다.
3. `/api/`와 `/uploads/` 요청은 backend 컨테이너로 전달된다.
4. backend는 외부 MySQL에 연결한다.
5. `uploads`, `map_config.json`, `.env`, 로그는 현재 저장소 기준 상대 경로를 사용한다.
```mermaid
flowchart LR
U["User Browser"] --> RP["Reverse Proxy Nginx 80"]
RP -->|root| FE["Frontend Container Nginx Static 80"]
RP -->|api| BE["Backend Container Node 3000"]
RP -->|uploads| BE
BE --> DB["External MySQL 3306"]
BE --> UP["./uploads"]
BE --> CFG["./map_config.json"]
BE --> ENV["./.env"]
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
현재 저장소 기준 파일/컨테이너 관계는 아래와 같다.
```mermaid
flowchart TB
subgraph REPO["Current Repository Root"]
ENV[".env"]
UP["uploads/"]
MAP["map_config.json"]
LOGS["logs/nginx/"]
CONF["docker/nginx/default.conf"]
end
subgraph CTR["Containers"]
NGINX["itam-nginx"]
FRONT["itam-frontend"]
BACK["itam-backend"]
end
DB["External MySQL"]
CONF --> NGINX
LOGS --> NGINX
ENV --> BACK
UP --> BACK
MAP --> BACK
NGINX --> FRONT
NGINX --> BACK
BACK --> DB
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
---
## 4. 개발용, 테스트용, 운영용 차이
### 4.1 `docker-compose.yaml`
용도:
1. 개발 재현
2. 소스 수정과 빠른 확인
3. Vite dev server 기반 실행
특징:
1. bind mount 중심
2. 프런트는 개발 서버 기반
3. 운영 배포보다는 개발 생산성에 초점
### 4.2 `docker-compose.test.yaml`
용도:
1. 운영형 Dockerfile 테스트
2. reverse proxy 동작 테스트
3. 로컬/WSL에서 8080 포트 검증
특징:
1. frontend/backend를 `build`로 생성
2. nginx는 8080 포트로 노출
3. 현재 저장소 상대 경로를 그대로 사용
### 4.3 `docker-compose.prod.yaml`
용도:
1. 현재 저장소 구조 기준 운영 배포
2. 운영 모드 환경변수와 health check 사용
3. 현재 구조를 바꾸지 않고 운영 전환
특징:
1. frontend/backend를 `build + image` 방식으로 정의
2. `.env`, `uploads`, `map_config.json`, `logs/nginx`를 현재 저장소 기준 상대 경로로 사용
3. nginx는 80 포트를 사용
4. backend는 `NODE_ENV=production`으로 실행
---
## 5. 운영 파일 구조 기준
현재 운영 배포는 저장소 루트를 기준으로 아래 구조를 전제로 한다.
```text
itam/
.env
.env.example
docker-compose.prod.yaml
docker-compose.test.yaml
Dockerfile.frontend.prod
Dockerfile.backend.prod
map_config.json
uploads/
logs/
nginx/
docker/
nginx/
default.conf
frontend/
default.conf
```
운영에서 실제로 중요한 경로는 아래 네 가지다.
1. `./.env`
2. `./uploads`
3. `./map_config.json`
4. `./logs/nginx`
즉, 현재 구조를 유지하려면 이 경로들이 항상 함께 관리되어야 한다.
---
## 6. 운영 환경변수 정책
현재 기준 운영 환경변수는 저장소 루트의 `.env`를 사용한다.
`.env.example` 기준 예시는 아래와 같다.
```env
DB_HOST=172.16.8.151
DB_PORT=3306
DB_USER=itam_admin
DB_PASS=change-this
DB_NAME=itam
NODE_ENV=production
PORT=3000
LOG_LEVEL=info
```
운영 원칙은 아래와 같다.
1. 실제 운영 비밀번호가 들어간 `.env`는 Git에 올리지 않는다.
2. `.env.example`은 템플릿으로만 사용한다.
3. 운영 서버에서는 `.env` 파일 권한을 제한한다.
4. 운영 DB 계정과 개발 DB 계정은 분리한다.
권장 권한 예시는 아래와 같다.
```bash
chmod 600 .env
```
---
## 7. Frontend 운영 이미지 기준
`Dockerfile.frontend.prod`는 multi-stage build를 사용한다.
구성은 아래와 같다.
1. builder 단계에서 `npm ci` 수행
2. `npm run build` 수행
3. 결과물을 Nginx 이미지에 복사
4. `docker/frontend/default.conf`로 정적 파일 서빙
운영 관점에서의 장점은 아래와 같다.
1. runtime 이미지에 build 결과물만 포함된다.
2. dev server 없이 정적 파일만 제공한다.
3. frontend 컨테이너 자체도 health check 가능하다.
---
## 8. Backend 운영 이미지 기준
`Dockerfile.backend.prod`는 아래 기준으로 작성되어 있다.
1. `NODE_ENV=production`
2. production dependency만 설치
3. `appuser` 비루트 사용자 사용
4. `dumb-init` 사용
5. `/health` health check 사용
backend 컨테이너는 아래 자원을 사용한다.
1. `./.env`
2. `./uploads`
3. `./map_config.json`
4. 외부 MySQL
---
## 9. Reverse Proxy 기준
`docker/nginx/default.conf`는 현재 아래처럼 동작한다.
1. `/` -> `frontend:80`
2. `/api/` -> `backend:3000`
3. `/uploads/` -> `backend:3000`
추가로 아래 설정을 포함한다.
1. 기본 보안 헤더
2. access/error 로그
3. gzip 설정
4. health endpoint
중요한 점은, 현재 운영 기준에서 외부 사용자가 직접 frontend 컨테이너에 붙는 것이 아니라 반드시 nginx를 통해 들어간다는 점이다.
---
## 10. 현재 기준 운영 배포 절차
### 10.1 사전 점검
아래 항목을 먼저 확인한다.
1. `.env` 파일 존재 여부
2. `uploads/` 디렉터리 존재 여부
3. `logs/nginx/` 디렉터리 존재 여부
4. `map_config.json` 존재 여부
5. 외부 DB 접근 가능 여부
예시:
```bash
ls -la .env
ls -la uploads
ls -la logs/nginx
ls -la map_config.json
```
### 10.2 Compose 검증
```bash
docker compose -f docker-compose.prod.yaml config
```
### 10.3 운영 기동
```bash
docker compose -f docker-compose.prod.yaml up -d --build
docker compose -f docker-compose.prod.yaml ps
```
### 10.4 운영 중지
```bash
docker compose -f docker-compose.prod.yaml down
```
### 10.5 운영/배포 분기 흐름
현재 운영 반영은 자동 push 배포가 아니라, Gitea에 올라간 커밋을 기준으로 수동 workflow를 실행하는 방식이다.
즉 아래 원칙으로 이해하면 된다.
1. 로컬 수정본을 서버에 직접 복사하지 않는다.
2. 반드시 Gitea에 올라간 커밋을 기준으로 배포한다.
3. 운영 반영은 `.gitea/workflows/itam_production_deploy.yml` 수동 실행으로 진행한다.
4. 실패 후 재배포는 실패 지점에 따라 수정 위치가 달라진다.
운영 반영은 크게 세 상황으로 나뉜다.
1. 최초 운영 서버 구축 후 첫 배포
2. 코드 수정 후 일반 재배포
3. 배포 실패 또는 검증 실패 후 재배포
```mermaid
flowchart TD
START["배포 필요 발생"] --> CASE{"어떤 상황인가?"}
CASE -->|초기 구축| INIT["초기 운영 배포 준비"]
CASE -->|수정 반영| CHANGE["수정 후 재배포 준비"]
CASE -->|실패 후 재시도| RETRY["실패 원인 분석 후 재배포 준비"]
INIT --> INIT1["운영 서버 Docker / compose 확인"]
INIT1 --> INIT2["Gitea Variables / Secrets 등록"]
INIT2 --> INIT3["map_config.json / uploads 초기 데이터 준비"]
INIT3 --> MANUAL["Gitea에서 수동 배포 workflow 실행"]
CHANGE --> CHANGE1["로컬 수정 및 테스트"]
CHANGE1 --> CHANGE2["Gitea 커밋 / push"]
CHANGE2 --> CHANGE3["Code Check / Docker Build Check 통과"]
CHANGE3 --> MANUAL
RETRY --> RETRY1{"어디서 실패했는가?"}
RETRY1 -->|코드 체크 실패| FIX1["코드 또는 설정 수정"]
RETRY1 -->|배포 단계 실패| FIX2["서버 / 변수 / 권한 / 네트워크 수정"]
RETRY1 -->|Smoke Check 실패| FIX3["앱 기동 상태 / 프록시 / DB 상태 수정"]
FIX1 --> CHANGE2
FIX2 --> MANUAL
FIX3 --> MANUAL
MANUAL --> BACKUP["기존 운영 상태가 있으면 배포 전 백업"]
BACKUP --> DEPLOY["운영 서버 반영 수행"]
DEPLOY --> RESULT{"최종 검증 통과?"}
RESULT -->|예| DONE["운영 반영 완료"]
RESULT -->|아니오| RETRY
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
### 10.6 최초 운영 배포 플로우
최초 배포에서는 코드보다 운영 환경 준비가 먼저다.
순서는 아래와 같다.
1. 운영 서버에 Docker Engine과 `docker compose`를 설치한다.
2. 운영 서버에서 Gitea 저장소에 접근 가능한 SSH 키를 준비한다.
3. Gitea repository Variables / Secrets를 등록한다.
4. `PROD_DEPLOY_PATH` 경로를 확정한다.
5. `PROD_BACKUP_ROOT` 경로를 `PROD_DEPLOY_PATH` 바깥으로 확정한다.
6. `map_config.json`, `uploads/` 초기 데이터를 준비한다.
7. Gitea에서 `itam_production_deploy.yml`을 수동 실행한다.
8. 배포 후 `docker compose ps`, `/health`, `/`, `/ready`를 확인한다.
즉 최초 배포는 아래 순서다.
```text
서버 준비 완료
-> Gitea 변수 / 시크릿 등록 완료
-> 백업 경로 확정 완료
-> 초기 데이터 준비 완료
-> 수동 배포 실행
```
### 10.7 수정 후 일반 재배포 플로우
일반적인 수정 반영은 아래 흐름이다.
1. 개발자가 로컬에서 코드 또는 설정을 수정한다.
2. 로컬에서 필요한 테스트를 수행한다.
3. 변경사항을 Gitea에 커밋 후 push 한다.
4. `itam_code_check.yml`이 빌드와 compose 문법을 검사한다.
5. `itam_docker_build_check.yml`이 운영용 이미지 빌드 가능 여부를 검사한다.
6. 두 검증이 통과하면 운영자가 Gitea에서 `itam_production_deploy.yml`을 수동 실행한다.
7. 기존 운영 상태가 있으면 배포 전 백업을 먼저 수행한다.
8. 운영 서버가 최신 커밋으로 동기화되고 컨테이너가 다시 올라온다.
9. smoke check 통과 여부를 확인한다.
```mermaid
flowchart LR
DEV["로컬 수정"] --> TEST["로컬 확인"]
TEST --> PUSH["커밋 / push"]
PUSH --> CODE["ITAM Code Check"]
CODE --> BUILD["ITAM Docker Build Check"]
BUILD --> GATE{"검증 통과?"}
GATE -->|예| RUN["Gitea에서 수동 배포 실행"]
GATE -->|아니오| FIX["로컬 수정 후 재커밋"]
FIX --> PUSH
RUN --> BACKUP["배포 전 백업"]
BACKUP --> PROD["운영 서버 배포"]
PROD --> SMOKE{"Smoke Check 통과?"}
SMOKE -->|예| OK["배포 완료"]
SMOKE -->|아니오| FIXDEPLOY["원인 수정 후 재배포"]
FIXDEPLOY --> RUN
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
### 10.8 수동 배포 workflow 내부 실행 순서
Gitea에서 `itam_production_deploy.yml`을 수동 실행하면 내부적으로는 아래 순서로 진행된다.
1. SSH agent를 설정한다.
2. 필수 Variables / Secrets가 모두 있는지 확인한다.
3. 운영용 `.env.deploy` 파일을 생성한다.
4. 운영 서버에 접속한다.
5. `PROD_DEPLOY_PATH`를 생성한다.
6. 기존 운영 상태가 있으면 `make predeploy-backup`을 실행한다.
7. 저장소를 clone 또는 fetch 한다.
8. 선택한 브랜치의 최신 커밋으로 checkout, reset, clean 한다.
9. `uploads`, `logs/nginx` 디렉토리를 준비한다.
10. `.env.deploy`를 서버의 `.env`로 복사한다.
11. `docker compose -f docker-compose.prod.yaml config`를 수행한다.
12. `docker compose -f docker-compose.prod.yaml up -d --build`를 수행한다.
13. `docker compose ps`를 확인한다.
14. `/health`, `/`, backend `/ready` smoke check를 수행한다.
```mermaid
flowchart TD
A["수동 배포 시작"] --> B["SSH agent 설정"]
B --> C["Variables / Secrets 검증"]
C --> D{"필수 값 누락 여부"}
D -->|예| E["즉시 실패 후 설정 보완"]
D -->|아니오| F[".env.deploy 생성"]
F --> G["운영 서버 SSH 접속"]
G --> H["배포 경로 생성"]
H --> I["기존 운영 상태가 있으면 make predeploy-backup"]
I --> J["git clone 또는 fetch"]
J --> K["지정 브랜치 checkout / reset / clean"]
K --> L["uploads / logs/nginx 준비"]
L --> M[".env 업로드 및 권한 설정"]
M --> N["compose config 검증"]
N --> O{"compose config 성공?"}
O -->|아니오| P["설정 수정 후 재실행"]
O -->|예| Q["compose up -d --build"]
Q --> R["docker compose ps 확인"]
R --> S["/health, /, /ready smoke check"]
S --> T{"smoke check 성공?"}
T -->|예| U["운영 배포 완료"]
T -->|아니오| V["원인 분석 후 재배포"]
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
### 10.9 실패 후 검증 및 재배포 플로우
실패가 났다고 해서 같은 방식으로 바로 다시 배포하면 안 된다.
실패 지점별 판단은 아래처럼 나눈다.
1. Code Check 실패: TypeScript, build, compose 문법 문제를 먼저 수정한다.
2. Docker Build Check 실패: Dockerfile, 정적 자산 복사, 운영 빌드 컨텍스트 문제를 수정한다.
3. Deploy 단계 실패: SSH, Gitea 변수, 서버 권한, 경로, 백업 경로, git 접근, Docker 권한을 수정한다.
4. Smoke Check 실패: Nginx 프록시, backend readiness, 외부 DB 연결, 앱 런타임 오류를 수정한다.
즉 재배포 전 판단 기준은 아래와 같다.
```text
CI 실패 -> 로컬 코드 / 설정 수정 후 재커밋
배포 실패 -> 서버 환경 또는 배포 설정 수정 후 수동 재실행
Smoke Check 실패 -> 앱 / 프록시 / DB 상태 수정 후 수동 재실행
```
운영 관점에서는 아래 순서를 지키는 것이 안전하다.
1. 실패 지점 확인
2. 원인 수정
3. 같은 실패가 다시 나는지 좁은 범위로 재검증
4. 그 다음에만 수동 배포 재실행
---
## 11. 테스트 배포 절차
운영형 구성을 먼저 검증하려면 아래처럼 진행한다.
```bash
docker compose -f docker-compose.test.yaml up -d --build
docker compose -f docker-compose.test.yaml ps
```
접속 기준은 아래와 같다.
1. `http://localhost:8080` -> nginx reverse proxy
2. `http://localhost:3000/health` -> backend health 확인
테스트용은 운영과 매우 유사하지만, 외부 노출 포트와 일부 실행 목적이 다르다.
---
## 12. Health Check 및 상태 판정
backend에는 아래 두 엔드포인트가 있다.
1. `/health`
2. `/ready`
판정 기준은 아래와 같다.
1. `/health = 200`, `/ready = 200`: 정상 서비스 가능 상태
2. `/health = 200`, `/ready = 503`: 프로세스는 살아 있으나 DB 또는 외부 의존성 미준비
확인 예시는 아래와 같다.
```bash
curl http://localhost:3000/health
curl http://localhost:3000/ready
```
---
## 13. 운영 점검 체크리스트
### 13.1 애플리케이션
1. `docker compose -f docker-compose.prod.yaml config` 통과 여부
2. frontend 이미지 빌드 성공 여부
3. backend 이미지 빌드 성공 여부
4. 모든 컨테이너가 `Up` 상태인지
5. 메인 화면이 정상 렌더링되는지
6. 데이터 조회가 정상 동작하는지
### 13.2 데이터 및 파일
1. `uploads/`에 쓰기 가능한지
2. `map_config.json`을 backend가 읽을 수 있는지
3. `.env` 파일 권한이 적절한지
4. `logs/nginx/`에 로그가 쌓이는지
### 13.3 네트워크
1. 외부 DB 접근 가능한지
2. nginx에서 backend upstream 연결이 되는지
3. `/api` 요청이 정상 응답하는지
---
## 14. 로그 및 장애 대응
기본 점검 명령은 아래와 같다.
```bash
docker compose -f docker-compose.prod.yaml ps
docker compose -f docker-compose.prod.yaml logs --tail=200 nginx
docker compose -f docker-compose.prod.yaml logs --tail=200 backend
docker compose -f docker-compose.prod.yaml logs --tail=200 frontend
```
장애 확인 순서는 아래가 좋다.
1. 컨테이너가 살아 있는지
2. nginx가 frontend/backend로 프록시하는지
3. backend가 DB에 붙는지
4. 업로드/설정 파일 권한 문제는 없는지
추가 확인 예시는 아래와 같다.
```bash
curl -I http://localhost/
curl http://localhost:3000/health
curl http://localhost:3000/ready
```
---
## 15. 백업 기준
현재 구조 기준 최소 백업 대상은 아래와 같다.
1. `.env`
2. `uploads/`
3. `map_config.json`
4. 외부 MySQL 데이터베이스
현재 저장소에는 운영 백업을 직접 실행할 수 있도록 `Makefile`과 `scripts/backup.sh`가 추가되어 있다.
기본 원칙은 아래와 같다.
1. DB dump와 런타임 파일 백업을 분리해서 실행할 수 있어야 한다.
2. 기본 백업 산출물은 `backups/` 디렉터리에 쌓는다.
3. DB 접속 정보는 `.env`를 기준으로 읽는다.
4. 오래된 백업 파일은 보존 주기에 따라 정리한다.
백업 실행 흐름은 아래와 같다.
```mermaid
flowchart TD
START["운영 백업 실행"] --> TARGET{"무엇을 백업할 것인가?"}
TARGET -->|DB| DB["make db-dump"]
TARGET -->|운영 파일| FILES["make files-backup"]
TARGET -->|전체| FULL["make full-backup"]
DB --> OUT1["backups/db/*.sql.gz"]
FILES --> OUT2["backups/files/*.tar.gz"]
FULL --> OUT1
FULL --> OUT2
OUT1 --> CLEAN["make cleanup-backups"]
OUT2 --> CLEAN
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
### 15.1 Make 명령 기준
사용 가능한 기본 명령은 아래와 같다.
```bash
make db-dump
make files-backup
make full-backup
make cleanup-backups
```
각 명령의 역할은 아래와 같다.
1. `make db-dump`: `.env` 기준 MySQL dump를 `backups/db/`에 `.sql.gz`로 저장
2. `make files-backup`: `.env`, `uploads/`, `map_config.json`을 `backups/files/`에 `.tar.gz`로 저장
3. `make full-backup`: DB dump와 파일 백업을 한 번에 수행
4. `make cleanup-backups`: 기본 14일이 지난 백업 파일 정리
### 15.2 실행 예시
가장 단순한 전체 백업 예시는 아래와 같다.
```bash
make full-backup
```
DB dump만 별도로 실행하려면 아래처럼 사용한다.
```bash
make db-dump
```
운영 파일만 묶으려면 아래처럼 사용한다.
```bash
make files-backup
```
보존 주기를 30일로 바꿔 정리하려면 아래처럼 사용한다.
```bash
make cleanup-backups RETENTION_DAYS=30
```
백업 경로를 별도 디스크나 마운트 경로로 바꾸려면 아래처럼 사용한다.
```bash
make full-backup BACKUP_ROOT=/opt/itam-backups
```
### 15.3 현재 스크립트가 실제로 백업하는 대상
현재 `scripts/backup.sh`는 아래 규칙으로 동작한다.
1. `.env` 파일에서 `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASS`, `DB_NAME`을 읽는다.
2. `mysqldump --single-transaction --quick --routines --triggers` 옵션으로 dump를 생성한다.
3. DB dump는 gzip 압축본으로 저장한다.
4. 파일 백업은 `.env`, `uploads/`, `map_config.json` 중 실제로 존재하는 항목만 묶는다.
5. 백업 정리는 `find ... -mtime` 기준으로 수행한다.
즉 현재 스크립트는 운영 서버 또는 백업 서버에서 바로 실행 가능한 최소 백업 도구로 보면 된다.
### 15.4 운영 사용 권장 방식
운영에서는 아래 방식이 가장 현실적이다.
1. 매일 새벽 cron 또는 systemd timer로 `make full-backup` 실행
2. 백업 완료 후 `make cleanup-backups` 실행
3. `backups/` 또는 별도 `BACKUP_ROOT` 경로를 NAS 또는 외부 백업 스토리지로 추가 복사
4. 최소 월 1회 restore 테스트 수행
가장 단순한 예시는 아래와 같다.
```bash
make full-backup BACKUP_ROOT=/opt/itam-backups
make cleanup-backups BACKUP_ROOT=/opt/itam-backups RETENTION_DAYS=30
```
DB 백업 자체는 여전히 DB 서버 정책과 함께 관리하는 것이 가장 안전하지만, 현재 저장소 기준 운영 자동화 진입점은 위 `make` 명령으로 통일해도 된다.
---
## 16. 롤백 기준
현재 구조에서는 가장 단순한 롤백 방식이 아래와 같다.
1. 이전 정상 커밋 또는 파일 상태 확보
2. 이미지 재빌드 또는 이전 이미지 재사용
3. `docker compose -f docker-compose.prod.yaml up -d --build` 재실행
4. `/health`, `/ready`, 메인 화면, 핵심 API 재검증
즉, 현재 구조에서는 별도 디렉터리 재배치보다 현재 저장소 상태 관리와 compose 재기동이 롤백의 중심이 된다.
---
## 17. 결론
현재 ITAM 저장소는 별도 `/srv/itam` 구조로 옮기지 않아도, 지금 파일 구조를 유지한 채 운영형 배포 흐름으로 전환할 수 있다.
정리하면 아래와 같다.
1. test와 prod 모두 현재 저장소 구조 기준으로 통일한다.
2. `.env`, `uploads`, `map_config.json`, `logs/nginx`를 운영 핵심 경로로 본다.
3. reverse proxy는 현재 `docker/nginx/default.conf`를 기준으로 운영한다.
4. backend는 production 모드, health check, 외부 DB 연결 구조를 유지한다.
5. 큰 구조 변경 없이도 운영 전환이 가능하다.
남은 작업은 TLS, 로그 로테이션, CI/CD, 보안 점검을 현재 구조 기준으로 계속 보강하는 것이다.
-57
View File
@@ -1,57 +0,0 @@
services:
backend:
image: itam-backend:prod
build:
context: .
dockerfile: Dockerfile.backend.prod
container_name: itam-backend
working_dir: /app
env_file:
- .env
environment:
NODE_ENV: production
PORT: 3000
volumes:
- ./uploads:/app/uploads
- ./map_config.json:/app/map_config.json:ro
expose:
- "3000"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
frontend:
image: itam-frontend:prod
build:
context: .
dockerfile: Dockerfile.frontend.prod
container_name: itam-frontend
expose:
- "80"
restart: unless-stopped
nginx:
image: nginx:stable-alpine
container_name: itam-nginx
ports:
- "80:80"
volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./logs/nginx:/var/log/nginx
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_started
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
-62
View File
@@ -1,62 +0,0 @@
# Local testing compose file - uses relative paths and build contexts
# Usage: docker compose -f docker-compose.test.yaml up --build
services:
backend:
build:
context: .
dockerfile: Dockerfile.backend.prod
container_name: itam-backend-test
working_dir: /app
env_file:
- .env
environment:
NODE_ENV: development
PORT: 3000
DB_HOST: ${DB_HOST:-172.16.8.151}
DB_PORT: ${DB_PORT:-3306}
DB_USER: ${DB_USER:-root}
DB_PASS: ${DB_PASS:-}
DB_NAME: ${DB_NAME:-itam}
ports:
- "3000:3000"
volumes:
- ./uploads:/app/uploads
- ./map_config.json:/app/map_config.json:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
frontend:
build:
context: .
dockerfile: Dockerfile.frontend.prod
container_name: itam-frontend-test
expose:
- "80"
restart: unless-stopped
nginx:
image: nginx:stable-alpine
container_name: itam-nginx-test
ports:
- "8080:80"
volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./logs/nginx:/var/log/nginx
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_started
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
-48
View File
@@ -1,48 +0,0 @@
services:
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: itam-backend
working_dir: /app
env_file:
- .env
environment:
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASS}
DB_NAME: ${DB_NAME}
PORT: 3000
ports:
- "3000:3000"
volumes:
- ./:/app
- backend_node_modules:/app/node_modules
- ./uploads:/app/uploads
- ./map_config.json:/app/map_config.json
command: npm run server
restart: unless-stopped
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: itam-frontend
working_dir: /app
depends_on:
- backend
environment:
CHOKIDAR_USEPOLLING: "true"
VITE_DEV_PROXY_TARGET: http://backend:3000
ports:
- "8080:8080"
volumes:
- ./:/app
- frontend_node_modules:/app/node_modules
command: npm run dev -- --host 0.0.0.0
restart: unless-stopped
volumes:
backend_node_modules:
frontend_node_modules:
-55
View File
@@ -1,55 +0,0 @@
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
# Logging
access_log /var/log/nginx/frontend-access.log main;
error_log /var/log/nginx/frontend-error.log warn;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Gzip compression
gzip on;
gzip_types text/plain text/css text/xml text/javascript
application/x-javascript application/xml+rss
application/json application/javascript;
gzip_min_length 1000;
# Serve static files with SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets (60 days)
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|webp|woff|woff2|ttf|eot)$ {
expires 60d;
add_header Cache-Control "public, immutable";
}
# Don't cache HTML files
location ~* \.html$ {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Health check
location /health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
# Deny access to sensitive files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
-16
View File
@@ -1,16 +0,0 @@
# MySQL init directory
This directory is kept as a legacy hook for file-based MySQL initialization.
Current production path in this repository is not file-based import.
The live Docker flow uses the `db-bootstrap` service in `docker-compose.yaml` to stream data from the external source DB into the internal `db` container.
Use this directory only if you intentionally switch back to `docker-entrypoint-initdb.d` style initialization.
If you do that, typical naming would be:
- `01_schema.sql`
- `02_seed.sql`
- or a single `01_itam_dump.sql`
Remember that files in this directory are executed automatically by the MySQL container only on the first initialization of the data volume.
-101
View File
@@ -1,101 +0,0 @@
upstream backend {
server backend:3000;
}
upstream frontend {
server frontend:80;
}
server {
listen 80;
listen [::]:80;
server_name _;
# Client upload size limit (adjust as needed)
client_max_body_size 100M;
# Logging
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Gzip compression
gzip on;
gzip_types text/plain text/css text/xml text/javascript
application/x-javascript application/xml+rss
application/json application/javascript;
gzip_min_length 1000;
# Forward all app requests to the frontend container
location / {
proxy_pass http://frontend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
}
# API proxy to backend
location /api/ {
proxy_pass http://backend/api/;
# Preserve original request information
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
# Connection settings
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
# Buffering settings
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 4k;
proxy_busy_buffers_size 8k;
}
# Uploads proxy to backend
location /uploads/ {
proxy_pass http://backend/uploads/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Cache uploads
expires 30d;
add_header Cache-Control "public";
}
# Health check endpoint (for monitoring)
location /health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
# Deny access to sensitive files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~ ~$ {
deny all;
access_log off;
log_not_found off;
}
}
-330
View File
@@ -1,330 +0,0 @@
# ITAM 도커라이징 작업 태스크 정리
## 1. 문서 목적
이 문서는 ITAM 자산관리 시스템의 도커라이징 작업을 실제 실행 단위로 쪼개서 정리한 태스크 문서다.
이 문서의 목표는 아래와 같다.
1. 내일까지 보여줄 시연 범위를 기준으로 우선순위를 정한다.
2. 시연용 작업과 운영형 전환 작업을 분리한다.
3. 개발 담당자가 바로 실행할 수 있는 체크리스트를 제공한다.
관련 배경과 구조 분석은 [doc_readme.md](c:/Users/user/Desktop/안건%20파일/itam/doc_readme.md) 문서를 기준으로 한다.
현재 구현/검증 상태:
- `Dockerfile.frontend` 생성 완료
- `Dockerfile.backend` 생성 완료
- `docker-compose.yaml` 생성 완료
- `.dockerignore` 생성 완료
- WSL2 Ubuntu에서 `docker compose up --build -d` 검증 완료
- frontend 8080 응답 확인 완료
- backend `/api/assets/master` 응답 확인 완료
- 현재 DB는 external MySQL 기준이며, DB 컨테이너 추가 작업은 다음 단계로 남아 있음
## 2. 이번 작업의 최우선 목표
이번 도커라이징의 1차 목표는 "운영 배포 완료"가 아니라 아래 상태를 재현하는 것이다.
1. frontend 컨테이너가 정상 기동한다.
2. backend 컨테이너가 정상 기동한다.
3. backend가 기존 외부 MySQL 또는 MySQL 컨테이너에 정상 연결된다.
4. 브라우저에서 화면이 열린다.
5. 핵심 API 호출이 정상 동작한다.
6. 업로드 저장 경로가 유지된다.
7. 필요 시 DB까지 함께 포함된 재현 가능한 스택을 제공한다.
## 3. 작업 범위 구분
### 3.1 이번 시연 범위에 포함
- Dockerfile.frontend 초안 작성
- Dockerfile.backend 초안 작성
- docker-compose.yaml 작성
- `.dockerignore` 작성
- MySQL 컨테이너 추가 설계
- 초기 SQL dump 또는 init SQL 적재 방식 정의
- `uploads` 볼륨 처리
- `map_config.json` 영속성 처리 방식 반영
- 컨테이너 기동 및 접속 확인
- 핵심 API 및 화면 확인
### 3.2 이번 시연 범위에서 제외
- DB 전체 마이그레이션 자동화
- nginx 기반 운영 배포 구조
- 단일 이미지 운영 구조 전환
- CI/CD 연계
## 4. 선행 확인 태스크
아래 태스크는 실제 Docker 파일 작성 전에 먼저 확인해야 한다.
### Task 1. 외부 MySQL 접근 가능 여부 확인
- 목적: 컨테이너에서 외부 DB 접속이 가능한지 확인
- 확인 항목:
- DB_HOST 접근 가능 여부
- DB_PORT 3306 접속 가능 여부
- 계정 권한 정상 여부
- 완료 기준:
- backend 컨테이너 기준 DB 연결 에러가 발생하지 않음
### Task 2. 기준 스키마 상태 확인
- 목적: 현재 앱이 요구하는 테이블 구조가 실제 DB와 맞는지 확인
- 확인 항목:
- `asset_core`
- `asset_spec`
- `asset_location`
- `asset_remote`
- `asset_history`
- `hardware_components_master`
- `job_spec_standards`
- 완료 기준:
- `/api/assets/master` 호출 시 쿼리 에러가 발생하지 않음
### Task 3. 파일 영속성 대상 확인
- 목적: 컨테이너 재시작 이후에도 유지되어야 할 파일/폴더 식별
- 대상:
- `uploads`
- `map_config.json`
- 완료 기준:
- 볼륨 설계 대상이 명확하게 문서화됨
### Task 4. DB 기준 데이터 소스 확정
- 목적: MySQL 컨테이너 최초 기동 시 어떤 데이터로 초기화할지 결정
- 선택지:
- 기존 사내 DB에서 추출한 SQL dump 사용
- 정리된 스키마 SQL + seed SQL 사용
- 수동 import 절차 사용
- 완료 기준:
- `docker/mysql/init` 기준 적재 전략 또는 수동 복원 절차가 확정됨
## 5. 시연용 도커라이징 태스크
### Task 5. 프런트 Dockerfile 작성
- 목적: Vite 개발 서버를 컨테이너에서 구동
- 작업 내용:
- Node 20 계열 이미지 사용
- `package*.json` 복사 후 `npm install`
- 8080 포트 노출
- `npm run dev -- --host 0.0.0.0` 실행
- 산출물:
- `Dockerfile.frontend`
- 완료 기준:
- 컨테이너에서 8080 포트가 정상 listen 상태가 됨
### Task 6. 백엔드 Dockerfile 작성
- 목적: Express API 서버를 컨테이너에서 구동
- 작업 내용:
- Node 20 계열 이미지 사용
- `package*.json` 복사 후 `npm install`
- 3000 포트 노출
- `npm run server` 실행
- 산출물:
- `Dockerfile.backend`
- 완료 기준:
- 컨테이너에서 3000 포트가 정상 listen 상태가 됨
### Task 7. MySQL Docker 구성 추가
- 목적: DB까지 포함한 재현 가능한 스택 구성
- 작업 내용:
- `mysql:8.0` 서비스 정의
- `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD` 설정
- utf8mb4 문자셋 옵션 반영
- MySQL 데이터 volume 연결
- 초기 SQL 적재용 `docker/mysql/init` 디렉터리 설계
- 산출물:
- `docker-compose.yaml` 내 `db` 서비스 또는 별도 DB compose 확장안
- 완료 기준:
- MySQL 컨테이너가 정상 기동하고 3306 포트에서 응답 가능
### Task 8. backend DB 연결 전환
- 목적: backend가 external MySQL 대신 DB 컨테이너를 바라보도록 변경
- 작업 내용:
- `DB_HOST`를 `db`로 전환
- 필요 시 `.env.docker` 또는 compose 내부 환경변수 사용
- backend `depends_on`에 db 추가
- 산출물:
- DB 컨테이너용 backend 환경 정의
- 완료 기준:
- backend 로그에서 DB 연결 성공 확인
### Task 9. docker-compose.yaml 확장
- 목적: frontend/backend를 함께 기동
- 작업 내용:
- frontend 서비스 정의
- backend 서비스 정의
- db 서비스 정의
- 포트 매핑 추가
- `.env` 또는 docker 전용 환경변수 연결
- MySQL 데이터 볼륨 연결
- `uploads` 볼륨 연결
- `map_config.json` 처리 방식 반영
- 산출물:
- `docker-compose.yaml`
- 완료 기준:
- `docker compose up --build` 한 번으로 세 서비스가 모두 올라옴
### Task 10. `.dockerignore` 작성
- 목적: 불필요한 빌드 컨텍스트 제외
- 제외 권장 항목:
- `node_modules`
- `dist`
- `build`
- `.git`
- `uploads`
- `*.xlsx`
- 산출물:
- `.dockerignore`
- 완료 기준:
- 이미지 빌드 컨텍스트가 과도하게 커지지 않음
## 6. 시연 검증 태스크
### Task 11. WSL 컨테이너 기동 검증
- 실행 명령:
```bash
powershell -ExecutionPolicy Bypass -File .\start_docker_wsl.ps1
```
- 확인 항목:
- frontend 로그 에러 여부
- backend 로그 에러 여부
- db 로그 에러 여부
- backend와 db 연결 성공 여부
- 완료 기준:
- 세 컨테이너 모두 종료 없이 유지됨
### Task 12. 웹 접속 검증
- 확인 항목:
- `http://localhost:8080` 접속 가능 여부
- 첫 화면 로딩 여부
- 콘솔 에러 여부
- 완료 기준:
- 브라우저에서 초기 화면이 정상 표시됨
### Task 13. API 검증
- 확인 항목:
- `http://localhost:3000/api/assets/master`
- 프런트에서 `/api/assets/master` 호출 정상 여부
- 완료 기준:
- 200 응답 또는 정상 데이터 응답 확인
### Task 14. DB 초기 데이터 검증
- 확인 항목:
- MySQL 컨테이너 내부에 목표 DB가 생성되었는지
- 기준 테이블이 존재하는지
- 샘플 데이터 또는 실데이터가 적재되었는지
- 완료 기준:
- backend가 기대하는 최소 테이블과 데이터가 실제로 조회됨
### Task 15. 업로드/파일 저장 검증
- 확인 항목:
- `/api/upload` 호출 정상 여부
- 업로드 파일이 `uploads`에 실제 저장되는지
- `map_config.json` 수정 내용이 유지되는지
- 완료 기준:
- 컨테이너 재시작 후에도 저장 데이터가 유지됨
## 7. 시연 후 후속 태스크
### Task 16. 운영형 프런트 배포 구조 전환
- 목표: Vite dev server 대신 정적 빌드 기반 구조로 전환
- 후보:
- nginx 정적 서빙
- Express 정적 서빙
### Task 17. DB 초기화/마이그레이션 전략 통합
- 목표: 기준 스키마와 실행 순서를 단일 정책으로 통일
- 필요 작업:
- 기준 스키마 선정
- 초기화 스크립트 확정
- 마이그레이션 순서 정의
### Task 18. `.env.example` 및 배포 환경 분리
- 목표: 민감정보를 저장소에서 분리하고 배포별 설정 체계화
### Task 19. 운영 볼륨 및 백업 전략 정리
- 목표: 업로드 파일과 설정 파일, MySQL 데이터의 장기 보존 정책 정리
### Task 20. DB 백업/복원 절차 문서화
- 목표: 컨테이너 DB를 기준으로 dump/restore 절차를 문서화
## 8. 우선순위 정리
### P0: 내일까지 반드시 필요한 작업
1. Task 1. 외부 MySQL 접근 가능 여부 확인
2. Task 2. 기준 스키마 상태 확인
3. Task 4. DB 기준 데이터 소스 확정
4. Task 7. MySQL Docker 구성 추가
5. Task 8. backend DB 연결 전환
6. Task 9. docker-compose.yaml 확장
7. Task 11. WSL 컨테이너 기동 검증
8. Task 12. 웹 접속 검증
9. Task 13. API 검증
10. Task 14. DB 초기 데이터 검증
### P1: 시연 안정화를 위해 권장되는 작업
1. Task 3. 파일 영속성 대상 확인
2. Task 10. `.dockerignore` 작성
3. Task 15. 업로드/파일 저장 검증
### P2: 시연 이후 진행할 작업
1. Task 16. 운영형 프런트 배포 구조 전환
2. Task 17. DB 초기화/마이그레이션 전략 통합
3. Task 18. `.env.example` 및 배포 환경 분리
4. Task 19. 운영 볼륨 및 백업 전략 정리
5. Task 20. DB 백업/복원 절차 문서화
## 9. 개발자용 최종 작업 순서 제안
개발 담당자에게는 아래 순서로 진행하라고 전달하면 된다.
1. 외부 DB 연결 가능 여부부터 확인
2. 현재 DB 스키마가 앱 요구사항과 맞는지 확인
3. DB 기준 dump 또는 init SQL 확보
4. MySQL 컨테이너 구성 추가
5. backend의 DB 연결 대상을 `db`로 전환
6. WSL에서 `docker compose config` 확인
7. WSL에서 컨테이너 기동 테스트
8. 웹 접속 및 API 확인
9. 업로드 및 파일 영속성 확인
10. 시연 완료 후 운영형 구조로 분리 작업 진행
## 10. 완료 판단 기준
이번 도커라이징 1차 작업은 아래 조건을 만족하면 완료로 본다.
1. `docker compose up --build`로 프런트, 백엔드, DB가 모두 기동한다.
2. 브라우저에서 8080 화면이 열린다.
3. `/api/assets/master`가 정상 응답한다.
4. backend가 DB 컨테이너와 정상 연결된다.
5. DB 초기 테이블과 데이터가 기대 상태로 적재된다.
6. `uploads`, `map_config.json`, MySQL 데이터가 재시작 후에도 유지된다.
이 문서는 실제 구현 작업의 체크리스트로 사용한다.
@@ -1,45 +0,0 @@
# [Issue] 소프트웨어 자산 관리 체계 개편 및 클라우드(Cloud) 서비스 관리 신설
## 1. 개요
기존의 단일 소프트웨어(SW) 분류 체계를 비즈니스 모델에 맞춰 **구독형, 영구형, 클라우드형**으로 삼원화하고, 특히 비용 변동이 잦은 클라우드 서비스를 독립적으로 관리할 수 있는 전용 시스템을 신설함.
---
## 2. 주요 작업 내용
### 📂 소프트웨어 관리 프레임워크 재구조화
- **분류 체계 개편**: 소프트웨어를 아래 세 가지 유형으로 재정의하여 관리 효율성을 높임.
1. **구독형 (Subscription)**: 연/월 정액제로 운영되는 SW
2. **영구형 (Perpetual)**: 구매 후 영구 소유하는 SW (유지보수 중심 관리)
3. **클라우드형 (Cloud)**: 플랫폼 기반 종량제(AWS, Azure 등) 서비스
- **내비게이션 통합**: 상단 탭을 유형별로 분리하여 각 자산 특성에 맞는 리스트 뷰를 제공함.
### ☁️ 클라우드(Cloud) 서비스 관리 페이지 신설
- **전용 리스트 뷰 (`CloudListView.ts`)**:
- 플랫폼명, 담당 부서, 프로젝트(사용용도), 결제 수단, 결제일 등 클라우드 특화 항목 중심의 테이블 구성함.
- **결제수단별 필터링 기능** (법인카드, 인보이스) 및 통합 검색 기능을 추가함.
- **클라우드 전문 모달 (`CloudModal.ts`)**:
- 클라우드 요금 및 결제 정보 입력을 위한 2분할 레이아웃 배치함.
- **업데이트 이력(History Logs)** 시스템을 도입하여 매월 변동되는 비용을 히스토리 형식으로 기록/추적 가능하게 함.
### 📊 대시보드(Dashboard) 리팩토링 및 고도화
- **카드 레이아웃 최적화**: 사용율, 만료 예정, 클라우드 현황(전월/당월 비교) 정보를 2열 그리드로 정돈함.
- **데이터 시각화**:
- **클라우드 결제 규모 추이**: 최근 4개월간의 비용 변동을 꺾은선 그래프로 구현함.
- **실시간 데이터 연동**: 자산 업데이트 이력(Logs)에 기록된 비용이 대시보드 차트에 실시간 합산 반영되도록 로그 분석 엔진을 구축함.
- **상세 팝업 연동**: 대시보드 요약 카드를 클릭하면 해당하는 자산의 상세 목록이 뜨는 모달 연동 기능을 추가함.
### 🪟 UX 및 데이터 정합성 강화
- **수정 저장 워크플로우 (Edit-to-Save)**: 실수로 인한 데이터 변경을 막기 위해 모든 상세 모달에 '조회 모드'를 기본으로 하고, [수정] 버튼 클릭 시에만 입력이 활성화되도록 제어함.
- **금액 자동 포맷팅**: 콤마 표시 오류를 해결하고 천 단위 포맷팅을 표준화함.
- **결제 임박 알림**: 각 서비스의 결제일을 계산하여 14일 이내 결제가 필요한 항목을 대시보드에서 즉시 파악할 수 있게 함.
---
## 3. 향후 과제
- 클라우드 플랫폼 간 비용 비교 통계 기능 확장 검토
- 결제 수단(법인카드) 만료일에 기초한 알림 서비스 추가 검토
---
**작업자**: Antigravity (AI Assistant)
**상태**: 완료 (2026-04-17)
-33
View File
@@ -1,33 +0,0 @@
# [이슈] S/W 자산 관리 고도화 및 이력 추적 기능 구현
## 1. 개요
소프트웨어 자산의 라이프사이클을 체계적으로 관리하기 위해 상세 정보 모달을 개편하고, 갱신(업데이트) 이력을 추적할 수 있는 기능을 구현하였습니다. 또한, 사용자의 가독성을 위해 상태를 나타내는 자동 뱃지를 도입하고 날짜 입력 편의성을 개선하였습니다.
## 2. 작업 상세 내용
### A. S/W 목록(Table) 개선
- **상태 자동 계산 시스템 도입**:
- 구독 S/W: 만료일 기준 **[사용중] / [만료]** 자동 표시.
- 영구 S/W: 유지보수 대상 여부에 따라 **[유효] / [없음]** 표시.
- **UI 뱃지 적용**: 테이블 좌측에 상태 뱃지를 추가하여 시각적 인지도를 높임.
### B. 상세 정보 모달 개편 (`SWModal.ts`)
- **2단 분할 레이아웃 적용**: 좌측(기본 정보), 우측(업데이트 타임라인)으로 UI 재설계.
- **날짜 입력 필드 개선**:
- '구매일' 필드에 캘린더 피커(Calendar Picker) 적용.
- '구독 기간' 필드를 **시작일**과 **종료일**로 분리하여 각각 캘린더 적용.
- 직접 입력("yyyy-mm-dd") 형식도 동시 지원.
### C. 계약 업데이트(갱신) 관리 기능
- **[업데이트 추가]** 버튼 및 전용 서브 팝업 구현.
- 갱신 시 발생하는 비용, 기간 연장, 메모를 기록하여 타임라인(Log)에 누적.
- 업데이트 반영 시 메인 자산 정보의 구독 기한 및 누적 금액이 자동으로 최신화되도록 연동.
## 3. 관련 파일
- `src/views/SW_Table.ts`: 테이블 상태 로직 및 뱃지 렌더링.
- `src/components/Modal/SWModal.ts`: 모달 UI 및 날짜 처리, 업데이트 로직.
- `src/styles/modal.css`: 분할 레이아웃 및 타임라인 스타일.
## 4. 확인 사항
- 엑셀 업로드/다운로드 시 기존 '구독일' 문자열 형식과의 호환성 유지 확인.
- 브라우저 테스트를 통한 캘린더 작동 및 테이블 상태 연동 확인 완료.
-226
View File
@@ -1,226 +0,0 @@
# ITAM CI/CD 설정 가이드
## 1. 문서 목적
이 문서는 현재 ITAM 저장소에 구성된 CI/CD 파일을 실제 운영에 연결하기 위해 필요한 기준을 정리한 가이드다.
대상 범위는 아래와 같다.
1. Gitea Actions workflow 역할
2. Gitea Variables / Secrets 설정값
3. 운영 서버 배포 디렉토리 기준
4. 운영 영속 경로 기준
5. production deploy 실행 전 확인 사항
---
## 2. 현재 CI/CD 구성
현재 `.gitea/workflows`에는 ITAM 관련 workflow만 남겨둔 상태다.
1. `itam_code_check.yml`
2. `itam_docker_build_check.yml`
3. `itam_production_deploy.yml`
각 workflow의 역할은 아래와 같다.
1. `itam_code_check.yml`: TypeScript/Vite build와 compose 문법 검증
2. `itam_docker_build_check.yml`: 운영용 Docker 이미지 빌드 가능 여부 검증
3. `itam_production_deploy.yml`: 운영 서버에 SSH 접속 후 실제 배포 수행
현재 배포 흐름은 아래와 같다.
```mermaid
flowchart LR
DEV["Developer Push or Manual Run"] --> CODE["ITAM Code Check"]
CODE --> BUILD["ITAM Docker Build Check"]
BUILD --> DEPLOY["ITAM Production Deploy"]
DEPLOY --> HOST["Production Host"]
HOST --> APP["docker compose up -d --build"]
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
---
## 3. Gitea Variables / Secrets 기준
`itam_production_deploy.yml`이 정상 동작하려면 아래 값이 필요하다.
### 3.1 Variables
아래 항목은 Gitea repository Variables에 등록한다.
| Key | 설명 | 예시 |
| --- | --- | --- |
| `PROD_HOST` | 운영 서버 SSH 접속 호스트 | `10.0.0.25` |
| `PROD_USER` | 운영 서버 SSH 사용자 | `deploy` |
| `PROD_DEPLOY_PATH` | 서버에서 저장소를 배포할 경로 | `/opt/itam` |
| `PROD_BACKUP_ROOT` | 배포 전 백업 저장 경로, 배포 경로 바깥이어야 함 | `/opt/itam-backups` |
| `PROD_GIT_URL` | 운영 서버에서 pull 가능한 저장소 주소 | `git@gitea.example.com:team/itam.git` |
| `PROD_DB_HOST` | 외부 MySQL 호스트 | `172.16.8.151` |
| `PROD_DB_PORT` | 외부 MySQL 포트 | `3306` |
| `PROD_DB_USER` | 운영 DB 계정 | `itam_admin` |
| `PROD_DB_NAME` | 운영 DB 이름 | `itam` |
| `PROD_LOG_LEVEL` | 애플리케이션 로그 레벨 | `info` |
### 3.2 Secrets
아래 항목은 Gitea repository Secrets에 등록한다.
| Key | 설명 |
| --- | --- |
| `PROD_SSH_PRIVATE_KEY` | 운영 서버 접속용 개인키 |
| `PROD_DB_PASS` | 운영 DB 비밀번호 |
### 3.3 운영 원칙
1. `PROD_DB_PASS`는 Variables가 아니라 Secrets에만 둔다.
2. `PROD_SSH_PRIVATE_KEY`는 배포 전용 계정 키를 사용한다.
3. `PROD_GIT_URL`은 운영 서버에서 직접 pull 가능한 주소여야 한다.
4. 운영 서버의 `known_hosts`는 workflow에서 자동 등록되지만, 최초 운영 전 수동 접속 검증도 함께 수행하는 것이 안전하다.
5. `PROD_BACKUP_ROOT`는 `PROD_DEPLOY_PATH` 내부가 아니라 바깥 경로를 사용해야 한다.
---
## 4. 운영 서버 배포 디렉토리 기준
현재 `itam_production_deploy.yml`은 운영 서버에서 아래 흐름으로 배포를 수행한다.
1. `PROD_DEPLOY_PATH` 디렉토리를 생성한다.
2. 기존 운영 상태가 있으면 배포 전 백업을 수행한다.
3. 해당 경로에 저장소를 clone 또는 fetch 한다.
4. 지정 브랜치로 checkout 한다.
5. `uploads`, `logs/nginx` 디렉토리를 생성한다.
6. `.env.deploy`를 서버의 `.env`로 복사한다.
7. `docker compose -f docker-compose.prod.yaml up -d --build`를 실행한다.
권장 디렉토리 구조는 아래와 같다.
```text
/opt/itam/
.env
docker-compose.prod.yaml
Dockerfile.frontend.prod
Dockerfile.backend.prod
map_config.json
uploads/
logs/
nginx/
docker/
nginx/
default.conf
frontend/
default.conf
src/
public/
img/
/opt/itam-backups/
db/
files/
```
현재 구조 기준 배포 관계는 아래와 같다.
```mermaid
flowchart TB
subgraph HOST["Production Host"]
REPO["PROD_DEPLOY_PATH"]
ENV[".env"]
UP["uploads/"]
LOGS["logs/nginx/"]
MAP["map_config.json"]
end
subgraph CTR["Docker Services"]
NGINX["itam-nginx"]
FRONT["itam-frontend"]
BACK["itam-backend"]
end
DB["External MySQL"]
REPO --> NGINX
ENV --> BACK
UP --> BACK
MAP --> BACK
LOGS --> NGINX
REPO --> BAK["PROD_BACKUP_ROOT"]
NGINX --> FRONT
NGINX --> BACK
BACK --> DB
linkStyle default stroke:#d32f2f,stroke-width:2px;
```
---
## 5. 영속 경로 기준
현재 `docker-compose.prod.yaml` 기준으로 운영에서 유지되어야 하는 경로는 아래와 같다.
1. `.env`
2. `uploads/`
3. `map_config.json`
4. `logs/nginx/`
5. `PROD_BACKUP_ROOT`
각 경로의 의미는 아래와 같다.
1. `.env`: backend 런타임 환경변수
2. `uploads/`: 업로드 파일 데이터
3. `map_config.json`: 위치/맵 구성 데이터
4. `logs/nginx/`: reverse proxy 접근 로그 및 에러 로그
5. `PROD_BACKUP_ROOT`: 배포 전 DB dump와 운영 파일 아카이브 저장 위치
운영 기준으로 보면 `uploads/`와 `map_config.json`은 애플리케이션 데이터이고, `.env`는 환경 설정이며, `logs/nginx/`는 운영 추적 데이터다.
즉 서버 운영 시 컨테이너만 다시 띄우면 되는 구조가 아니라, 이 경로들이 유지되는 것을 전제로 배포가 성립한다.
---
## 6. 배포 전 체크리스트
`itam_production_deploy.yml` 실행 전 아래 항목을 먼저 확인한다.
1. 운영 서버에 Docker Engine과 `docker compose`가 설치되어 있어야 한다.
2. 운영 서버의 배포 계정이 Docker 실행 권한을 가져야 한다.
3. 운영 서버에서 `PROD_GIT_URL`로 직접 `git fetch`가 가능해야 한다.
4. 외부 MySQL 접속 정보가 실제 운영망 기준으로 열려 있어야 한다.
5. 운영 서버에 `map_config.json` 초기 파일이 존재해야 한다.
6. 방화벽 또는 보안 장비에서 80 포트 접근 정책이 정리되어 있어야 한다.
권장 확인 명령 예시는 아래와 같다.
```bash
docker --version
docker compose version
git ls-remote <PROD_GIT_URL>
test -f map_config.json
test -d uploads
```
---
## 7. 현재 구조에서의 해석
현재 ITAM CI/CD는 staging 없이도 운영 배포가 가능한 최소 구조로 정리되어 있다.
이 구조의 장점은 아래와 같다.
1. workflow 수가 적어서 관리가 단순하다.
2. 운영 배포에 필요한 변수와 시크릿 범위가 명확하다.
3. staging이 필요해지면 production deploy workflow를 복제해 별도 환경으로 확장하기 쉽다.
즉, 지금 단계에서는 production 기준을 먼저 고정하고, staging은 동일 패턴으로 추후 추가하는 전략이 적절하다.
---
## 8. 다음 권장 작업
현재 문서 기준으로 바로 이어서 할 작업은 아래 순서가 적절하다.
1. `PROD_DEPLOY_PATH` 실제 서버 경로 확정
2. 운영 서버 배포 계정 생성 및 SSH 키 등록
3. `map_config.json`, `uploads/` 초기 데이터 준비
4. production deploy workflow에 smoke check 추가
5. 로그 로테이션과 백업/복구 절차 문서화
-44
View File
@@ -1,44 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function dropLegacyTables() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('🧹 Starting cleanup of obsolete legacy backup tables...');
const tablesToDrop = [
'asset_pc', 'asset_pc_backup',
'asset_server', 'asset_server_backup',
'asset_storage', 'asset_storage_backup',
'asset_remote_backup', // IMPORTANT: DO NOT drop asset_remote!
'asset_equipment', 'asset_equipment_backup',
'asset_office_supplies', 'asset_office_supplies_backup',
'asset_survey', 'asset_survey_backup',
'asset_vip', 'asset_vip_backup',
'asset_pc_parts'
];
for (const table of tablesToDrop) {
try {
await connection.query(`DROP TABLE IF EXISTS ${table}`);
console.log(`✅ Dropped table: ${table}`);
} catch (err) {
console.warn(`⚠️ Failed to drop table ${table}: ${err.message}`);
}
}
console.log('🎉 Cleanup complete. Database is now lean and mean.');
await connection.end();
}
dropLegacyTables().catch(console.error);
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 MiB

-77
View File
@@ -1,77 +0,0 @@
# H/W 자산관리 시스템 프로토타입 구현 계획 (Excel 기반 DB)
현재 프로젝트는 DB 연동 없이 프로토타입으로 개발되며, 초기 H/W 자산을 엑셀 파일로 관리할 수 있도록 설계합니다. 지정된 디자인 가이드라인(`README.md`)에 따라 세련되고 전문적인 UI를 Vite + Vanilla JS (또는 TS) 기반으로 구축합니다.
## User Review Required
> [!IMPORTANT]
> **엑셀을 DB처럼 사용하는 방식**에 대한 주요 동작 흐름은 다음과 같습니다. 해당 방식이 의도하신 바와 맞는지 확인 부탁드립니다.
> 1. 화면 진입 시 제공되는 **템플릿 엑셀 파일 다운로드**
> 2. 해당 양식에 맞춰 데이터 입력 후 브라우저에 **엑셀 파일 업로드(Import)**
> 3. 웹 상에서 **Data Table 형태로 렌더링** (편집/추가/삭제 기능 제공)
> 4. 수정이 완료된 후 **엑셀 파일로 다시 다운로드(Export)** 하여 로컬에 저장
## 데이터 스키마 설계 (H/W 자산)
요청하신 항목에 맞춘 필수 H/W 자산 데이터 필드입니다. 엑셀의 열(Column)로 활용됩니다.
- **법인 (Company)**: 소속 법인
- **자산코드 (AssetCode)**: 자산의 고유 식별자
- **명칭 (DeviceName)**: 모델명 또는 기기명
- **위치 (Location)**: 현재 파악된 물리적 위치
- **관리자 (Manager)**: 실 사용자 또는 담당자
- **IP주소 (IPAddress)**: 할당된 IP
- **MAC address (MacAddress)**: 기기 고유 MAC 주소
- **H/W 사양 (HWSpecs)**: CPU, RAM, Storage 등 사양 요약
- **OS (OperatingSystem)**: 설치된 운영체제 정보
## Proposed Changes
### 1. 개발 환경 설정 (Vite 기반)
- `npx create-vite` 를 사용하여 `vanilla-ts` (또는 `vanilla`) 프로젝트를 현재 디렉토리에 초기화합니다.
- `package.json` 및 `vite.config.ts` 설정 (포트 8080 및 host 허용)
- Excel 제어를 위해 `xlsx` (SheetJS) 라이브러리를 설치합니다.
#### [NEW] package.json
#### [NEW] vite.config.ts
---
### 2. UI 및 디자인 컴포넌트 (`README.md` 가이드라인 준수)
- 디자인: Box-less Design, Line-based Division 적용
- 컬러: `#1E5149`(Point), `#E5E7EB`(Border), `#F9FAFB`(Background)
- 폰트: `Pretendard`, `Letter Spacing: -0.02em` 적용
- 테이블 요소: 구분선만 사용하는 미니멀 테이블
#### [NEW] index.css
---
### 3. 메인 HTML 및 로직 구현
- **File Upload Area**: 엑셀 파일을 불러오거나 템플릿을 다운로드 할 수 있는 상단 컨트롤 영역.
- **Data Table**: 파싱된 H/W 자산 리스트를 출력.
- **Modal Component**: `README.md`에 정의된 2열 그리드와 우측 상단 닫기, 하단 저장 버튼이 포함된 정보 수정/생성 모달.
- **Excel Logic**: 업로드된 Excel 데이터를 파싱하여 JSON 형태로 브라우저 메모리에 들고 처리한 후 다시 Excel로 내보내는 기능.
#### [NEW] index.html
#### [NEW] src/main.ts
#### [NEW] src/excelHandler.ts
## Open Questions
> [!WARNING]
> 1. 프론트엔드 프레임워크 강제 규정이 없다면, 경량화 및 설정 편의를 위해 `Vite + Vanilla TypeScript` 를 사용하는 것이 괜찮으신가요? (원하신다면 React나 Vue로도 가능합니다.)
> 2. 추가적인 검색 필터(예: 법인별, 관리자별 검색)가 당장 도입되어야 하는 필수 기능인가요?
## Verification Plan
### Automated Tests
- `npm run dev` 를 통해 `http://localhost:8080` 포트 개방 성공 여부 확인.
- 브라우저 기능 테스트:
- 템플릿 다운로드 클릭 -> 정상적인 `hw_assets.xlsx` 다운로드 여부
- 샘플 엑셀 파일 업로드 -> 데이터 테이블에 행(Row) 생성 여부
- 항목 더블 클릭 혹은 [수정] 버튼 클릭 시 -> 모달 팝업 및 데이터 연동 확인
- [저장 후 내보내기] 클릭 -> 업데이트된 데이터가 포함된 새 엑셀 파일 다운로드 확인
### Manual Verification
- 디자인 요구사항(`Pretendard`, `#1E5149`, Border-less 컨셉) 반영 확인을 스크린샷 렌더링으로 사용자와 상호작용합니다.
-51
View File
@@ -1,51 +0,0 @@
# 구조 개선 및 다중 탭(Depth 2) 도입 계획
사용자 요청에 따라 H/W와 S/W를 구분하고, 그 하위에 각각 대시보드 및 상세 항목(개인PC, 서버 등) 탭을 나누는 네비게이션 구조를 도입합니다. 바닐라 JS 기반에서 각 탭마다 다른 데이터 테이블을 그려내는 아키텍처로 개선합니다.
## User Review Required
> [!IMPORTANT]
> 1. **엑셀 관리 방식 (Sheets 분리)**: 단일 엑셀 파일 안에 여러 개의 시트(Sheet)를 나누어 관리하는 방식으로 제안합니다. 한 번 엑셀을 업로드하면, `개인PC`, `서버`, `스토리지`, `전산비품` 등 각각의 시트를 한방에 파싱하여 각 탭에 적용하도록 구성하겠습니다.
> 2. **S/W 스키마**: 현재 H/W 기반 데이터 스키마만 정의되어 있습니다. [구독 소프트웨어]와 [영구 소프트웨어] 탭 개발을 위한 데이터 항목들(예: 사용기간, 라이선스키, 결제방식 등)은 아직 정해지지 않았으므로 일단 공통 S/W 데이터 스키마 임시 템플릿(S/W명, 유형, 라이선스키, 할당된 사용자 등)으로 만들어 두고 추후 수정할 수 있도록 개발해도 될까요?
## Proposed Changes
### 1. UI/UX: 2 Depth 네비게이션 (`index.html`, `style.css`)
- **좌측(또는 상단) GNB (Global Navigation Bar)**: H/W 와 S/W 를 스위치할 수 있는 메인 탭 생성.
- **LNB (Local Navigation Bar)**: 메인 탭 전환 시 나타나는 서브 탭(H/W: 대시보드/PC/서버/스토리지/비품, S/W: 대시보드/구독/영구).
- `README.md` 가이드라인에 따라 화면을 분할하고 정보 밀도를 높이기 위해 Box-less, Line-based Layout 유지.
#### [MODIFY] index.html
#### [MODIFY] src/style.css
---
### 2. 다중 데이터 구조 및 상태 관리 (`main.ts`)
- 현재 선택된 메뉴 뎁스(예: `activeCategory = 'HW'`, `activeSubTab = '개인PC'`)에 따라 렌더링 함수가 동기화되도록 라우팅/상태 관리 로직 추가.
- `Dashboard` 탭 진입 시, 모든 서브 탭 데이터의 갯수(Total PCs, Total Servers 등)를 한눈에 볼 수 있는 요약 영역(Summary Cards/Charts 영역) 예약 및 구현.
#### [MODIFY] src/main.ts
---
### 3. 멀티-시트(Multi-sheet) 엑셀 파싱 (`excelHandler.ts`)
- `SheetJS` 기능을 확장하여 다운로드/데이터 추출 시 다중 시트 생성.
- **H/W 템플릿 시트명**: `[개인PC, 서버, 스토리지, 전산비품]`
- **S/W 템플릿 시트명**: `[구독SW, 영구SW]`
#### [MODIFY] src/excelHandler.ts
## Open Questions
> [!WARNING]
> * 왼쪽 사이드바로 메뉴를 구성하는 것이 좋을까요, 상단 가로바(Top Nav) 2단으로 구성하는 것이 좋을까요? Reference 이미지가 따로 없다면 범용적으로 관리하기 편한 **왼쪽 사이드바 구조(Sidebar Menu)** 를 제안합니다. (진행 승인 시 사이드바 형태로 구현합니다.)
## Verification Plan
### Automated Tests
- 좌측 `H/W`, `S/W` 클릭 시 서브 메뉴가 정상 토글되는지 검증(`main.ts` DOM class toggle 확인).
- 서브 메뉴 `서버` 클릭 시 빈 테이블(또는 서버 자산 테이블)이 그려지는지 확인.
- 달라진 구조로 `엑셀 템플릿 양식`을 다운로드했을 때 파일에 다수의 시트(Sheet)가 정상 분류되어 있는지 확인.
### Manual Verification
- 브라우저 에이전트를 통해 바뀐 화면의 스크린샷(LNB 사이드바, Dashboard 화면 등)을 찍어 사용자에게 보고.
-47
View File
@@ -1,47 +0,0 @@
# 임시 DB 생성 및 S/W 사용자 관리 개편
임시 DB 엑셀 파일 생성과 S/W 목록의 '할당자' 속성 UI 개편에 대한 기술 구현 계획입니다.
## User Review Required
> [!IMPORTANT]
> **사용자 관리 데이터 저장 방식에 대한 피드백이 필요합니다.**
> 엑셀을 임시 DB로 사용하고 있기 때문에, "사용자 관리" 팝업에서 추가/삭제된 사용자 목록을 엑셀에 저장할 때 **쉼표(,)로 구분된 하나의 문자열**(예: `홍길동, 김철수, 이영희`)로 기존 `할당자` 컬럼에 업데이트 하는 방식을 제안합니다. 이 방식이 괜찮으신가요?
## Proposed Changes
### 1. 임시 DB 연동
임시로 사용할 초기 엑셀 파일(`temp_db.xlsx`)을 프로젝트 루트에 스크립트를 통해 생성합니다.
- 개인PC, 서버, 구독SW, 영구SW 시트에 각각 구성을 확인할 수 있는 dummy 데이터 1~2개씩을 포함하여 생성합니다.
- 향후 화면에서 '엑셀 업로드'를 통해 이 파일을 업로드하여 데이터를 화면에 뿌려볼 수 있습니다. (원하시면 페이지 로드 시 이 파일을 임포트하도록 로직을 변경할 수도 있으나, 브라우저 단에서 로컬 파일을 자동 리딩하는 것은 제한이 있으므로 기본적으로는 파일을 제공만 합니다.)
---
### 2. 컴포넌트: HTML 구조 변경
#### [MODIFY] [index.html](file:///c:/Project/HM%20ITAM/index.html)
- `sw-asset-modal`의 폼 내용 중 "할당자" 입력 폼(<label> 및 <input>) 제거
- 관리 팝업을 위한 `sw-user-modal` 모달 오버레이 마크업 추가
기존 유저 목록을 보여주고, 새 사용자를 추가하거나 기존 사용자를 삭제할 수 있는 UI (리스트, 추가 인풋, 추가 버튼 기반) 작성
---
### 3. 컴포넌트: 로직 및 스타일
#### [MODIFY] [src/main.ts](file:///c:/Project/HM%20ITAM/src/main.ts)
- S/W 렌더링 영역(`renderTable`)에서 데스크탑 뷰의 `<th>할당자</th>` 및 해당하는 셀(`<td>`) 제거
- S/W `관리` 탭(`<td>`)에 수정 버튼(`btn-edit`) 옆에 사용자 관리 아이콘 (Lucide의 `Users` 또는 `UserCog` 아이콘 활용) 추가
- 사용자 관리 아이콘 클릭 시 `sw-user-modal` 팝업 띄우는 이벤트 리스너 추가
- `sw-user-modal` 팝업 내에서 사용자를 추가/삭제하고 '저장' 시, 해당 S/W 자산의 `할당자` 데이터를 갱신하도록 처리 (쉼표 구분 형태)
#### [MODIFY] [src/excelHandler.ts](file:///c:/Project/HM%20ITAM/src/excelHandler.ts)
- (선택 사항) `SW_HEADERS`나 엑셀 파싱 로직은 그대로 두어 하위 호환성 유지. 사용자가 데이터를 쉼표 형태로 주고 받을 것이므로 별도의 인터페이스 변경은 없음.
## Open Questions
- 사용자 관리 팝업에서 저장할 때, 이름 말고 '부서'나 '직급' 같은 추가적인 정보도 관리가 필요하신가요? (기본적으로는 엑셀에 단일 텍스트로 보존되므로 '이름'만 관리하는 것으로 설계했습니다.)
- 개발 환경(Vite)에서 초기 로딩 시 `temp_db.xlsx`를 자동으로 불러오도록 Vite의 플러그인 또는 fetch 로직을 추가하는 것을 원하시나요? 아니면 엑셀 파일만 만들어 드리고 사용자가 '엑셀 업로드' 버튼으로 직접 연동해 쓰는 방식이 좋으신가요?
## Verification Plan
### Manual Verification
1. `npm run dev` 후 브라우저 접속
2. 프로젝트 폴더에 `temp_db.xlsx` 파일이 생성되었는지 확인
3. 소프트웨어 > 영구/구독 탭 진입 시 "할당자" 테이블 헤더가 사라진 것 확인
4. 관리 탭의 "사용자 관리" 아이콘 클릭 시, 해당 소프트웨어의 사용자를 등록하고 삭제할 수 있는 팝업 등장하는지 확인
5. 사용자 아이콘을 클릭해 홍길동, 김철수 등록 후, 전체 엑셀 저장 혹은 다운로드 시 엑셀 파일 내의 '할당자' 열에 `홍길동,김철수` 로 잘 들어가는지 확인
+397 -58
View File
@@ -1,69 +1,408 @@
<!DOCTYPE html> <!doctype html>
<html lang="ko"> <html lang="ko">
<head>
<head> <meta charset="UTF-8" />
<meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <title>Pierzainer — 형상 생성</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> </head>
<title>ITAM 자산관리 ERP</title> <body>
<link rel="stylesheet" <div class="app">
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css" /> <header class="top">
<link rel="stylesheet" href="/src/styles/common.css" />
<link rel="stylesheet" href="/src/styles/login.css" />
<link rel="stylesheet" href="/src/styles/guide.css" />
<link rel="stylesheet" href="/src/styles/modal.css" />
<link rel="stylesheet" href="/src/styles/dashboard.css" />
<link rel="stylesheet" href="/src/styles/table.css" />
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2.0.0"></script>
</head>
<body>
<div class="app-layout" id="app-layout" style="display: none;">
<!-- Single-Line Integrated Header -->
<header class="main-header">
<div class="header-container" id="nav-container">
<div class="brand"> <div class="brand">
<img src="/image 92.png" alt="Logo" class="main-logo" /> <strong>Pierzainer</strong>
<h1>자산관리시스템<span class="sub-title">(Digital Asset Control Hub System)</span></h1> <span>교각 설계</span>
<span id="project-line" class="proj">프로젝트 미지정</span>
</div> </div>
<nav class="steps" aria-label="단계">
<!-- Navigation (GNB + LNB in same row) --> <button id="nav-shape" class="step current" type="button" aria-current="step">① 형상 생성 <em id="step1-status">미생성</em></button>
<nav class="integrated-nav" id="main-nav"> <button id="nav-plan" class="step" type="button">② 형상계획 <em id="step2-status">예정</em></button>
<!-- JS will render main items and sub items here side-by-side --> <button id="nav-rebar" class="step" type="button">③ 철근배근 <em id="step3-status">예정</em></button>
<button id="nav-quantity" class="step" type="button">④ 재료표 <em id="step4-status">예정</em></button>
</nav> </nav>
<div class="actions">
<span id="save-status" class="savest">저장 전</span>
<button id="save-project" class="btn-s" type="button" disabled title="프로젝트 파일 저장 (Ctrl+S)">저장</button>
<button id="open-import" class="btn-s" type="button">엑셀 불러오기</button>
<button id="open-project" class="btn-s" type="button">프로젝트 열기</button>
<button id="regen" class="btn-p" type="button" disabled>선택 교각 형상 생성</button>
<input id="project-file" type="file" accept=".json" hidden />
</div>
</header>
<div class="header-actions"> <div class="status-row">
<div class="role-switcher" id="role-switcher"> <p id="status" class="status-line"></p>
<span class="role-label user active">실무자</span> <div id="backup-banner" class="backup-inline" hidden>
<label class="switch"> <span id="backup-text"></span>
<input type="checkbox" id="role-toggle-checkbox"> <button id="restore-backup" class="btn small" type="button">복구</button>
<span class="slider round"></span> <button id="discard-backup" class="btn small" type="button">버리기</button>
</label>
<span class="role-label admin">관리자</span>
</div>
<button id="btn-admin-page" class="hidden"></button> <!-- JS 호환용 숨김 -->
<button id="btn-open-guide-header" class="btn btn-outline" title="프로세스 가이드">
<i data-lucide="book-open"></i> 가이드
</button>
</div> </div>
</div> </div>
</header> <div id="toast-host" class="toast-host" role="status" aria-live="polite"></div>
<!-- Main Content Area --> <main class="grid" id="view-shape">
<main class="content-area" id="main-content"> <aside class="panel piers" aria-labelledby="pier-title">
<!-- Components inject views here --> <p id="pier-title" class="lbl">교각 목록</p>
</main> <div class="pier-tools">
<label>형식
<select id="type-filter"></select>
</label>
</div>
<div class="phead" aria-hidden="true"><span>교각</span><span>상태</span></div>
<ul id="pier-items" class="pier-items"></ul>
<p id="pier-empty" class="muted">불러온 교각이 없습니다.</p>
<p class="pnote">시트 1장 = 교각 1기입니다. 오류가 난 교각만 건너뛰고 나머지는 생성합니다.</p>
<!-- Footer --> <section class="pier-input" aria-labelledby="input-title">
<footer class="main-footer"> <p id="input-title" class="lbl">입력값</p>
<div id="secret-cloud-trigger" style="width: 20px; height: 20px; cursor: pointer; opacity: 0.1; background: #000; border-radius: 4px; position: absolute; left: 1rem;"></div> <div class="pier-table-wrap">
<p>Powered by BARON Consultant Co,Ltd</p> <table id="inputs-all" class="grid-table compact">
</footer> <thead><tr><th>교각</th><th>코핑 상면</th><th>기초 하단</th><th>지반고</th><th>말뚝 (mm)</th><th>코핑 폭×길이</th><th>받침</th></tr></thead>
</div> <tbody></tbody>
</table>
</div>
<p class="lbl small" id="inputs-active"></p>
<dl id="inputs" class="kv wide"></dl>
<section class="edit-card" aria-labelledby="edit-title">
<h3 id="edit-title">코핑·말뚝 입력 수정</h3>
<div id="edit-fields"></div>
<p id="edit-summary" class="muted small"></p>
<button id="edit-regen" class="btn primary" type="button" disabled>다시 생성 · 변경 0</button>
</section>
</section>
</aside>
<!-- All modals are injected dynamically --> <section class="panel viewer" id="viewer-block" aria-labelledby="viewer-title">
<script type="module" src="/src/main.ts"></script> <div class="viewer-head">
</body> <h2 id="viewer-title">교각 3D 뷰</h2>
</div>
<div id="canvas" class="canvas" aria-label="교각 3D 뷰"></div>
<div class="viewer-stack viewer-stack-right">
<details class="info-panel parts-info" id="parts-info">
<summary>부재 표시 <span id="parts-count" class="panel-state"></span></summary>
<div id="parts"></div>
</details>
<button id="all-toggle" class="btn" type="button" aria-pressed="false" title="6기를 콘크리트만 한 화면에 (① 형상 생성)">전체 보기</button>
<div class="views-menu" id="views-menu">
<button id="views-toggle" class="btn views-toggle" type="button" aria-haspopup="true" aria-expanded="false" aria-controls="views">시점</button>
<div id="views" class="views views-list" role="group" aria-label="시점" hidden></div>
</div>
<details class="info-panel color-info" id="color-info" hidden>
<summary>색 기준 <span id="color-state" class="panel-state"></span></summary>
<div class="rebar-color" id="rebar-color" role="group" aria-label="철근 색 기준">
<button type="button" data-color="role" aria-pressed="true">역할</button>
<button type="button" data-color="diameter" aria-pressed="false">직경</button>
<button type="button" data-color="member" aria-pressed="false">부재</button>
<ul id="rebar-legend" class="rebar-legend"></ul>
</div>
</details>
<div class="origin-wrap">
<button id="origin-toggle" class="info-btn" type="button" aria-label="원점 표기" aria-expanded="false" aria-controls="origin">ⓘ</button>
<span id="origin" class="origin-pop muted" hidden></span>
</div>
</div>
</section>
</html> <aside class="panel results" aria-labelledby="result-title">
<h2 id="result-title">계산 결과</h2>
<section aria-labelledby="sec-axis">
<h3 id="sec-axis">교각축 · 코핑</h3>
<dl id="res-axis" class="kv"></dl>
</section>
<section aria-labelledby="sec-column">
<h3 id="sec-column">기둥</h3>
<dl id="res-column" class="kv"></dl>
</section>
<section aria-labelledby="sec-found">
<h3 id="sec-found">기초</h3>
<dl id="res-found" class="kv"></dl>
</section>
<section aria-labelledby="sec-issues">
<h3 id="sec-issues">알림 · 정보 <span id="issue-count" class="muted"></span></h3>
<ul id="issues" class="issues"></ul>
<p class="muted small">오류(E)는 생성 중단, 경고(W)는 생성 후 표시, 정보(I)는 참고용입니다.</p>
</section>
<details>
<summary>기본값 · 미구현 규칙</summary>
<ul id="defaults" class="issues"></ul>
</details>
</aside>
</main>
<main class="grid plan" id="view-plan" hidden>
<aside class="panel piers" aria-labelledby="plan-pier-title">
<p id="plan-pier-title" class="lbl">교각 목록</p>
<div class="phead" aria-hidden="true"><span>교각</span><span>변경</span></div>
<ul id="plan-pier-items" class="pier-items"></ul>
<p class="lbl members-title">부재 · 5개</p>
<ul id="members" class="members"></ul>
</aside>
<div class="center-col">
<div class="viewer-slot" id="slot-plan"></div>
<section class="panel viewer" aria-labelledby="member-title">
<div class="viewer-head">
<h2 id="member-title">코핑</h2>
</div>
<p id="member-summary" class="num"></p>
<div id="member-options" class="shape-options"></div>
<div id="member-fields"></div>
<p id="member-note" class="muted small"></p>
<button id="member-regen" class="btn primary" type="button" disabled>다시 생성 · 변경 0</button>
<section id="copy-panel" class="copy-panel" aria-labelledby="cp-title">
<header class="copy-head">
<h3 id="cp-title">속성 복사</h3>
<p class="num" id="cp-source"></p>
<p class="muted small">기준 교각의 설정을 고른 교각에만 적용합니다 · 현재 입력값 기준 (미반영 변경 포함)</p>
</header>
<div class="dlg-body">
<div class="dlg-col">
<section>
<h3>1 · 대상 교각</h3>
<div class="cp-tools">
<button id="cp-clear" class="btn-o small" type="button">선택 해제</button>
</div>
<div id="cp-targets" class="cp-chips"></div>
<p class="muted small">고른 교각에만 적용합니다. 고르지 않은 교각은 바뀌지 않습니다. 모델이 없는 교각은 고를 수 없습니다.</p>
</section>
<section>
<h3>2 · 복사할 항목</h3>
<div class="cp-tools">
<button id="cp-items-reset" class="btn-o small" type="button">변경 항목으로 선택</button>
</div>
<div id="cp-items" class="cp-chips"></div>
<p class="muted small">복사하지 않는 값: 좌표 · IP · 받침 EL · 코핑 상면 EL · 기초 하단 EL · 지반고 · 기둥 높이 · 말뚝 선단 EL · 계단 구간</p>
</section>
</div>
<div class="dlg-col">
<section>
<h3>3 · 변경 요약 (고른 교각만)</h3>
<div id="cp-preview" class="cp-lines"></div>
<label class="chk"><input id="cp-regen" type="checkbox" checked />적용 후 고른 교각만 바로 다시 생성</label>
<p class="muted small">적용하면 대상 교각마다 "변경 n건"이 표시되고, 입력 수정 카드에서 항목별로 되돌릴 수 있습니다.</p>
</section>
</div>
</div>
<footer class="copy-foot">
<span id="cp-summary" class="muted"></span>
<button id="cp-apply" class="btn-p" type="button" disabled>대상을 고르세요</button>
</footer>
</section>
</section>
</div>
<aside class="panel results" aria-labelledby="changes-title">
<h2 id="changes-title">기본값 대비 변경</h2>
<ul id="changes" class="issues"></ul>
<h2>알림</h2>
<ul id="plan-issues" class="issues"></ul>
</aside>
</main>
<main class="grid quantity" id="view-quantity" hidden>
<aside class="panel piers" aria-labelledby="quantity-pier-title">
<p id="quantity-pier-title" class="lbl">교각 목록</p>
<button id="quantity-all" class="pier-name" type="button" aria-pressed="true">전체</button>
<ul id="quantity-pier-items" class="pier-items"></ul>
<p class="pnote" id="quantity-note"></p>
</aside>
<section class="panel viewer" aria-labelledby="quantity-title">
<div class="viewer-head">
<h2 id="quantity-title">철근재료표</h2>
<button id="quantity-export" class="btn-o" type="button">엑셀로 내보내기</button>
<button id="quantity-print" class="btn-o" type="button">인쇄</button>
</div>
<div id="quantity-body"></div>
</section>
</main>
<main class="grid rebar" id="view-rebar" hidden>
<aside class="panel piers" aria-labelledby="rebar-pier-title">
<p id="rebar-pier-title" class="lbl">교각 목록</p>
<div class="phead" aria-hidden="true"><span>교각</span><span>배근</span></div>
<ul id="rebar-pier-items" class="pier-items"></ul>
<p id="rebar-member-title" class="lbl members-title">부재 · 배근 타입</p>
<ul id="rebar-tabs" class="members"></ul>
<p class="pnote">형상은 ② 형상계획 기준입니다. 형상이 바뀌면 "형상 바뀜"으로 표시합니다.</p>
</aside>
<div class="center-col">
<div class="viewer-slot" id="slot-rebar"></div>
<section class="panel viewer" aria-labelledby="rebar-title">
<div class="viewer-head"><h2 id="rebar-title">철근표</h2></div>
<p id="rebar-note" class="num"></p>
<div id="rebar-table"></div>
</section>
</div>
<aside class="panel results" aria-labelledby="rebar-issues-title">
<h2 id="rebar-issues-title">알림</h2>
<ul id="rebar-issues" class="issues"></ul>
<h2>검토 필요 (결정 대기)</h2>
<ul class="issues">
<li>Q-B5 B1·B3·B5·B7 다리 길이 (제안값 사용)</li>
<li>Q-B6 B2·B6 이음 위치와 길이</li>
<li>Q-C9 P4–B11 간섭: 무시로 결정, 문서 반영 필요</li>
</ul>
<section class="common" aria-labelledby="common-title">
<p id="common-title" class="lbl">공통 설정</p>
<label class="mat">fck (MPa) <input id="mat-fck" type="number" step="any" /></label>
<label class="mat">D 규격 강도 <select id="mat-grade-d"><option value="300" selected>SD300</option><option value="400">SD400</option><option value="500">SD500</option></select></label>
<label class="mat">H 규격 강도 <select id="mat-grade-h"><option value="300">SD300</option><option value="400" selected>SD400</option><option value="500">SD500</option></select></label>
<label class="mat">S 규격 강도 <select id="mat-grade-s"><option value="300">SD300</option><option value="400">SD400</option><option value="500" selected>SD500</option></select></label>
<label class="mat">재료표 할증 (%) · 기본 0 가정 <input id="mat-waste" type="number" step="0.5" min="0" /></label>
<p class="lbl">굽힘 내면반경 (× 철근 지름)</p>
<label class="mat">D16 이하 <input id="bend-small16" type="number" step="0.5" min="0.5" /></label>
<label class="mat">D19–D25 <input id="bend-main25" type="number" step="0.5" min="0.5" /></label>
<label class="mat">D29–D35 <input id="bend-main35" type="number" step="0.5" min="0.5" /></label>
<label class="mat">D38 이상 <input id="bend-main51" type="number" step="0.5" min="0.5" /></label>
<p id="mat-note" class="muted small"></p>
</section>
</aside>
</main>
</div>
<dialog id="import-dialog" aria-labelledby="dlg-title">
<header class="dlg-head">
<h2 id="dlg-title">엑셀 불러오기</h2>
<ol class="dlg-steps">
<li>1 파일 선택</li>
<li>2 인식 결과 · 미리보기</li>
<li>3 형상 생성</li>
</ol>
<button id="dlg-close" class="btn small" type="button">닫기</button>
</header>
<div class="dlg-body">
<div class="dlg-col">
<section>
<h3>프로젝트</h3>
<label class="field">프로젝트명 · 필수
<input id="project-name" type="text" required />
</label>
<label class="field">교량명
<input id="bridge-name" type="text" />
</label>
</section>
<section>
<h3>파일</h3>
<div id="drop" class="drop">
<p>다른 .xlsx 파일을 끌어놓거나</p>
<div class="drop-actions">
<button id="pick-file" class="btn small" type="button">파일 선택</button>
<button id="pick-sample" class="btn small" type="button">샘플 P1 사용</button>
</div>
<input id="file" type="file" accept=".xlsx" hidden />
</div>
<p id="file-name" class="muted small"></p>
<button id="download-template" class="btn small" type="button">입력 템플릿 다운로드 (.xlsx)</button>
</section>
<section>
<h3>시트별 인식 결과</h3>
<ul id="sheets" class="sheet-list"></ul>
</section>
<section>
<h3>작성 규칙</h3>
<ul class="rules">
<li>교각 1기 = 시트 1장을 기본으로 하며, 한 시트에 여러 기를 넣어도 됩니다.</li>
<li>표는 머리글 문자열로 찾으므로 위치는 자유입니다.</li>
<li>수식 셀은 계산된 값을 읽습니다.</li>
<li>방위각은 75°56'55.9" 형식으로 적습니다.</li>
</ul>
<h4>엑셀 열 이름 → 화면 용어</h4>
<table class="terms">
<tbody>
<tr><th>두부보</th><td>코핑</td></tr>
<tr><th>대좌블럭</th><td>받침블럭</td></tr>
<tr><th>저판</th><td>확대기초</td></tr>
<tr><th>받침</th><td>교량받침</td></tr>
</tbody>
</table>
</section>
</div>
<div class="dlg-col">
<section>
<h3>미리보기</h3>
<p id="preview-title" class="muted"></p>
<h4>교각 정보</h4>
<div class="pv-scroll"><table id="pv-pier" class="grid-table"></table></div>
<h4>받침</h4>
<div class="pv-scroll">
<table id="pv-bearings" class="grid-table">
<thead><tr><th>교각</th><th>번호</th><th>x (m)</th><th>y (m)</th><th>z (m)</th><th>방위각</th><th>위치</th></tr></thead>
<tbody></tbody>
</table>
</div>
<h4>IP</h4>
<div class="pv-scroll">
<table id="pv-ips" class="grid-table">
<thead><tr><th>교각</th><th>점</th><th>x (m)</th><th>y (m)</th><th>꺾임각</th></tr></thead>
<tbody></tbody>
</table>
</div>
</section>
</div>
</div>
<footer class="dlg-foot">
<span id="dlg-selected" class="muted"></span>
<button id="dlg-cancel" class="btn" type="button">취소</button>
<button id="dlg-apply" class="btn primary" type="button" disabled>선택한 교각 0기 형상 생성</button>
</footer>
</dialog>
<dialog id="save-dialog" aria-labelledby="sv-title">
<header class="dlg-head">
<h2 id="sv-title">프로젝트 정보 · 저장</h2>
<button id="sv-close" class="btn small" type="button">닫기</button>
</header>
<div class="dlg-body">
<div class="dlg-col">
<section>
<h3>프로젝트 정보</h3>
<label class="field">프로젝트명 · 필수
<input id="sv-name" type="text" required />
</label>
<label class="field">교량명
<input id="sv-bridge" type="text" />
</label>
<label class="field">발주처
<input id="sv-client" type="text" />
</label>
<label class="field">작성자
<input id="sv-author" type="text" />
</label>
<label class="field">좌표계
<input id="sv-crs" type="text" value="국토좌표계 (x = 동, y = 북)" readonly />
</label>
<label class="field">메모
<textarea id="sv-memo" rows="3"></textarea>
</label>
</section>
</div>
<div class="dlg-col">
<section>
<h3>프로젝트 파일로 저장</h3>
<p>파일 이름 <code id="sv-file"></code></p>
<h4>파일에 담기는 내용</h4>
<ul class="rules">
<li>프로젝트 정보와 엑셀 입력값 (교각·IP·받침)</li>
<li>교각별 기본값과 현재 입력 (기본값 대비 변경 내역)</li>
<li>3D 형상은 담지 않고, 파일을 열 때 입력값으로 다시 생성합니다</li>
</ul>
<p class="muted small">처음 저장할 때만 이 창이 열립니다. 이후에는 헤더의 저장(Ctrl+S)이 같은 파일에 바로 저장합니다.</p>
</section>
</div>
</div>
<footer class="dlg-foot">
<button id="sv-cancel" class="btn" type="button">취소</button>
<button id="sv-save" class="btn primary" type="button">저장</button>
</footer>
</dialog>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
-768
View File
@@ -1,768 +0,0 @@
{
"img/location_photo/IDC/서관205.png": [
{
"x": "50.78",
"y": "1.53",
"w": "45.83",
"h": "6.10"
},
{
"x": "50.67",
"y": "10.35",
"w": "45.95",
"h": "5.99"
},
{
"x": "50.78",
"y": "19.06",
"w": "45.83",
"h": "6.32"
},
{
"x": "50.67",
"y": "27.89",
"w": "46.06",
"h": "6.32"
},
{
"x": "50.78",
"y": "36.71",
"w": "45.95",
"h": "6.21"
},
{
"x": "50.78",
"y": "45.64",
"w": "45.83",
"h": "6.32"
},
{
"x": "50.67",
"y": "54.25",
"w": "46.06",
"h": "6.54"
},
{
"x": "50.90",
"y": "63.29",
"w": "45.72",
"h": "5.99"
},
{
"x": "50.90",
"y": "72.00",
"w": "45.72",
"h": "6.32"
},
{
"x": "50.78",
"y": "81.92",
"w": "18.40",
"h": "15.58"
},
{
"x": "78.67",
"y": "82.03",
"w": "17.94",
"h": "15.25"
}
],
"img/location_photo/IDC/서관202.png": [
{
"x": "56.35",
"y": "64.02",
"w": "40.41",
"h": "5.89"
},
{
"x": "56.35",
"y": "71.57",
"w": "40.66",
"h": "5.89"
},
{
"x": "56.23",
"y": "79.25",
"w": "40.53",
"h": "5.76"
},
{
"x": "55.98",
"y": "86.42",
"w": "41.15",
"h": "6.27"
}
],
"img/location_photo/IDC/서관203.png": [
{
"x": "56.07",
"y": "2.44",
"w": "40.91",
"h": "6.40"
},
{
"x": "56.07",
"y": "10.12",
"w": "40.79",
"h": "6.27"
},
{
"x": "55.95",
"y": "17.80",
"w": "41.04",
"h": "6.14"
},
{
"x": "55.95",
"y": "63.51",
"w": "40.91",
"h": "6.14"
},
{
"x": "55.95",
"y": "71.19",
"w": "41.04",
"h": "6.14"
},
{
"x": "56.07",
"y": "87.70",
"w": "40.91",
"h": "6.02"
}
],
"img/location_photo/IDC/서관204.png": [
{
"x": "48.87",
"y": "2.57",
"w": "47.40",
"h": "6.14"
},
{
"x": "49.01",
"y": "10.38",
"w": "47.40",
"h": "5.89"
},
{
"x": "48.87",
"y": "17.93",
"w": "47.40",
"h": "5.89"
},
{
"x": "48.73",
"y": "25.49",
"w": "47.69",
"h": "6.27"
},
{
"x": "48.87",
"y": "33.17",
"w": "47.40",
"h": "6.02"
},
{
"x": "48.87",
"y": "40.59",
"w": "47.54",
"h": "6.40"
},
{
"x": "48.87",
"y": "48.40",
"w": "47.54",
"h": "6.14"
},
{
"x": "48.73",
"y": "55.95",
"w": "47.69",
"h": "6.14"
},
{
"x": "49.01",
"y": "63.63",
"w": "47.40",
"h": "6.14"
},
{
"x": "48.73",
"y": "71.06",
"w": "47.54",
"h": "6.27"
},
{
"x": "48.87",
"y": "78.74",
"w": "47.40",
"h": "6.27"
},
{
"x": "49.01",
"y": "86.68",
"w": "18.76",
"h": "12.29"
}
],
"img/location_photo/IDC/동관53.png": [
{
"x": "61.62",
"y": "3.08",
"w": "35.63",
"h": "7.55"
},
{
"x": "61.53",
"y": "12.68",
"w": "35.80",
"h": "7.30"
},
{
"x": "61.70",
"y": "21.65",
"w": "35.63",
"h": "7.68"
}
],
"img/location_photo/IDC/동관54.png": [
{
"x": "54.71",
"y": "2.57",
"w": "42.21",
"h": "6.27"
},
{
"x": "54.71",
"y": "10.38",
"w": "42.21",
"h": "6.14"
},
{
"x": "54.71",
"y": "27.15",
"w": "41.97",
"h": "6.27"
},
{
"x": "54.71",
"y": "43.54",
"w": "42.09",
"h": "6.02"
},
{
"x": "54.71",
"y": "54.93",
"w": "42.09",
"h": "6.40"
},
{
"x": "54.83",
"y": "70.16",
"w": "42.09",
"h": "6.27"
},
{
"x": "54.71",
"y": "79.51",
"w": "42.09",
"h": "6.14"
}
],
"img/location_photo/기술개발센터/서버실_1.png": [
{
"x": "69.45",
"y": "1.10",
"w": "8.58",
"h": "11.45"
},
{
"x": "79.21",
"y": "1.10",
"w": "11.65",
"h": "11.45"
},
{
"x": "90.16",
"y": "23.23",
"w": "8.43",
"h": "21.11"
},
{
"x": "52.91",
"y": "53.35",
"w": "8.66",
"h": "21.11"
},
{
"x": "62.36",
"y": "53.47",
"w": "8.43",
"h": "21.11"
},
{
"x": "71.65",
"y": "53.47",
"w": "8.50",
"h": "20.98"
},
{
"x": "80.87",
"y": "53.35",
"w": "8.35",
"h": "21.23"
},
{
"x": "90.08",
"y": "53.35",
"w": "8.58",
"h": "21.11"
},
{
"x": "43.78",
"y": "76.38",
"w": "8.50",
"h": "21.11"
},
{
"x": "53.15",
"y": "76.38",
"w": "8.43",
"h": "21.23"
},
{
"x": "62.44",
"y": "76.51",
"w": "8.35",
"h": "20.98"
},
{
"x": "71.57",
"y": "76.25",
"w": "8.43",
"h": "21.11"
},
{
"x": "81.02",
"y": "76.64",
"w": "8.27",
"h": "20.85"
},
{
"x": "90.24",
"y": "76.64",
"w": "8.50",
"h": "20.98"
}
],
"img/location_photo/기술개발센터/서버실_2.png": [
{
"x": "49.60",
"y": "1.93",
"w": "46.96",
"h": "6.53"
},
{
"x": "49.34",
"y": "11.92",
"w": "47.09",
"h": "6.66"
},
{
"x": "49.34",
"y": "21.39",
"w": "47.35",
"h": "6.40"
},
{
"x": "49.47",
"y": "30.73",
"w": "47.22",
"h": "6.40"
},
{
"x": "49.34",
"y": "39.82",
"w": "47.22",
"h": "6.53"
},
{
"x": "49.47",
"y": "49.68",
"w": "47.09",
"h": "6.91"
},
{
"x": "49.60",
"y": "59.28",
"w": "46.82",
"h": "6.27"
},
{
"x": "49.34",
"y": "68.63",
"w": "47.35",
"h": "6.40"
},
{
"x": "49.47",
"y": "77.84",
"w": "46.82",
"h": "6.40"
},
{
"x": "49.60",
"y": "86.93",
"w": "46.82",
"h": "6.53"
}
],
"img/location_photo/한맥빌딩/MDF실/MDF_1.png": [
{
"x": "49.33",
"y": "14.99",
"w": "7.13",
"h": "11.01"
},
{
"x": "59.23",
"y": "14.73",
"w": "7.13",
"h": "11.14"
},
{
"x": "69.22",
"y": "14.86",
"w": "7.13",
"h": "11.14"
},
{
"x": "78.96",
"y": "14.99",
"w": "7.30",
"h": "11.01"
},
{
"x": "89.03",
"y": "14.99",
"w": "7.05",
"h": "11.14"
},
{
"x": "48.57",
"y": "34.19",
"w": "7.39",
"h": "11.14"
},
{
"x": "56.80",
"y": "34.06",
"w": "7.22",
"h": "11.27"
},
{
"x": "64.94",
"y": "34.19",
"w": "7.30",
"h": "11.01"
},
{
"x": "72.83",
"y": "34.19",
"w": "7.47",
"h": "10.88"
},
{
"x": "81.22",
"y": "34.06",
"w": "7.22",
"h": "11.14"
},
{
"x": "89.36",
"y": "34.19",
"w": "7.13",
"h": "11.01"
},
{
"x": "48.66",
"y": "53.52",
"w": "9.06",
"h": "20.99"
},
{
"x": "58.48",
"y": "53.27",
"w": "9.15",
"h": "21.12"
},
{
"x": "68.55",
"y": "53.27",
"w": "9.06",
"h": "21.12"
},
{
"x": "78.54",
"y": "53.39",
"w": "8.90",
"h": "21.25"
},
{
"x": "89.36",
"y": "53.27",
"w": "7.39",
"h": "9.99"
},
{
"x": "89.36",
"y": "64.92",
"w": "7.39",
"h": "9.60"
},
{
"x": "48.57",
"y": "77.08",
"w": "9.40",
"h": "21.38"
},
{
"x": "58.56",
"y": "77.20",
"w": "9.23",
"h": "21.12"
},
{
"x": "68.63",
"y": "77.33",
"w": "9.06",
"h": "21.12"
},
{
"x": "78.71",
"y": "77.46",
"w": "8.98",
"h": "20.99"
}
],
"img/location_photo/한맥빌딩/MDF실/MDF_2.png": [
{
"x": "56.59",
"y": "44.43",
"w": "40.35",
"h": "6.78"
},
{
"x": "56.71",
"y": "54.80",
"w": "40.24",
"h": "6.53"
},
{
"x": "56.71",
"y": "65.94",
"w": "40.24",
"h": "6.40"
}
],
"img/location_photo/한맥빌딩/MDF실/MDF_3.png": [
{
"x": "56.71",
"y": "13.20",
"w": "40.24",
"h": "6.78"
},
{
"x": "56.48",
"y": "23.57",
"w": "40.58",
"h": "6.53"
},
{
"x": "56.59",
"y": "34.57",
"w": "40.58",
"h": "6.27"
},
{
"x": "56.59",
"y": "44.69",
"w": "40.46",
"h": "6.66"
},
{
"x": "56.71",
"y": "54.80",
"w": "40.24",
"h": "6.66"
},
{
"x": "56.71",
"y": "65.81",
"w": "40.24",
"h": "6.53"
},
{
"x": "56.59",
"y": "76.05",
"w": "40.35",
"h": "6.53"
}
],
"img/location_photo/한맥빌딩/MDF실/MDF_4.png": [
{
"x": "52.36",
"y": "64.02",
"w": "44.38",
"h": "6.53"
}
],
"img/location_photo/기술개발센터/서버실/서버실_1.png": [
{
"x": "69.53",
"y": "1.42",
"w": "8.58",
"h": "11.45"
},
{
"x": "79.21",
"y": "1.55",
"w": "11.97",
"h": "11.32"
},
{
"x": "90.24",
"y": "23.30",
"w": "8.50",
"h": "21.49"
},
{
"x": "53.07",
"y": "53.28",
"w": "8.74",
"h": "21.62"
},
{
"x": "62.28",
"y": "53.41",
"w": "8.82",
"h": "21.49"
},
{
"x": "71.50",
"y": "53.28",
"w": "8.90",
"h": "21.75"
},
{
"x": "80.87",
"y": "53.15",
"w": "8.66",
"h": "21.75"
},
{
"x": "90.08",
"y": "53.54",
"w": "8.90",
"h": "21.49"
},
{
"x": "43.86",
"y": "76.32",
"w": "8.82",
"h": "21.75"
},
{
"x": "53.15",
"y": "76.45",
"w": "8.66",
"h": "21.49"
},
{
"x": "62.52",
"y": "76.57",
"w": "8.58",
"h": "21.62"
},
{
"x": "71.65",
"y": "76.45",
"w": "8.66",
"h": "21.62"
},
{
"x": "80.94",
"y": "76.57",
"w": "8.74",
"h": "21.49"
},
{
"x": "90.24",
"y": "76.57",
"w": "8.50",
"h": "21.36"
}
],
"img/location_photo/기술개발센터/서버실/서버실_2.png": [
{
"x": "49.47",
"y": "1.80",
"w": "47.49",
"h": "7.04"
},
{
"x": "49.47",
"y": "12.04",
"w": "47.49",
"h": "6.91"
},
{
"x": "49.60",
"y": "21.52",
"w": "47.35",
"h": "6.91"
},
{
"x": "49.47",
"y": "30.48",
"w": "47.49",
"h": "7.04"
},
{
"x": "49.60",
"y": "39.82",
"w": "47.49",
"h": "6.91"
},
{
"x": "49.47",
"y": "50.06",
"w": "47.62",
"h": "6.91"
},
{
"x": "49.74",
"y": "59.28",
"w": "47.22",
"h": "6.91"
},
{
"x": "49.34",
"y": "68.37",
"w": "47.75",
"h": "7.04"
},
{
"x": "49.60",
"y": "77.97",
"w": "47.22",
"h": "6.91"
},
{
"x": "49.60",
"y": "86.93",
"w": "47.35",
"h": "7.17"
}
]
}
-42
View File
@@ -1,42 +0,0 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ITAM Map Coordinate Editor v3.0</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css" />
</head>
<body style="margin: 0; display: flex; height: 100vh; overflow: hidden; font-family: sans-serif;">
<!-- Left: File Selector -->
<div class="file-sidebar" id="file-sidebar">
<!-- Rendered by MapEditor.ts -->
</div>
<!-- Center: Main Editor -->
<div class="editor-container" id="container">
<div class="img-wrapper" id="wrapper">
<img src="" id="target-img" alt="Map Image">
</div>
</div>
<!-- Right: Control Panel -->
<div class="sidebar">
<h2>Map Editor <small style="font-size: 0.6em; color: #888;">v3.0</small></h2>
<div class="current-path" id="current-path">파일을 선택하세요</div>
<p>
드래그하여 구역을 정의하세요. 저장 버튼을 누르면 즉시 시스템에 반영됩니다.
</p>
<div class="box-list" id="box-list"></div>
<div class="actions">
<button id="btn-clear-all" class="btn btn-outline" style="height:38px;">전체 삭제</button>
<button id="btn-save-server" class="btn btn-primary" style="height:38px;">서버에 즉시 저장</button>
<div id="save-status"></div>
</div>
</div>
<script type="module" src="/src/map-editor-main.ts"></script>
</body>
</html>
-197
View File
@@ -1,197 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function migrateSchema() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('🚀 Phase 1: Creating Normalized Tables & Migrating Data...');
try {
await connection.query('SET FOREIGN_KEY_CHECKS = 0');
// --- 1. Drop existing new tables if they exist ---
await connection.query('DROP TABLE IF EXISTS asset_core, asset_hardware, asset_location, asset_remote');
// --- 2. Create New Schema ---
await connection.query(`
CREATE TABLE asset_core (
id VARCHAR(50) PRIMARY KEY,
asset_code VARCHAR(100) UNIQUE NOT NULL,
category VARCHAR(100),
asset_type VARCHAR(100),
asset_purpose VARCHAR(255),
service_type VARCHAR(50),
purchase_corp VARCHAR(100),
purchase_date VARCHAR(50),
purchase_amount VARCHAR(100),
purchase_vendor VARCHAR(255),
approval_document VARCHAR(255),
memo TEXT,
manager_primary VARCHAR(100),
manager_secondary VARCHAR(100),
current_dept VARCHAR(255),
previous_dept VARCHAR(255),
user_current VARCHAR(100),
previous_user VARCHAR(100),
emp_no VARCHAR(20),
user_position VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_hardware (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
hw_status VARCHAR(50),
model_name VARCHAR(255),
mainboard VARCHAR(255),
os VARCHAR(100),
cpu VARCHAR(255),
ram VARCHAR(100),
gpu VARCHAR(100),
storage1 VARCHAR(255),
storage2 VARCHAR(255),
storage3 VARCHAR(255),
monitoring VARCHAR(100),
price VARCHAR(100),
volume VARCHAR(100),
monitor_inch VARCHAR(50),
serial_num VARCHAR(100),
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_location (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
location VARCHAR(255),
location_detail VARCHAR(255),
location_photo VARCHAR(255),
loc_x VARCHAR(20),
loc_y VARCHAR(20),
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_remote (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
ip_address VARCHAR(100),
mac_address VARCHAR(100),
remote_tool VARCHAR(100),
remote_id VARCHAR(100),
remote_pw VARCHAR(100),
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query('SET FOREIGN_KEY_CHECKS = 1');
console.log('✅ Normalized tables created.');
// --- 3. Migrate Data from Legacy Tables ---
const legacyTables = ['asset_pc', 'asset_server', 'asset_storage', 'asset_remote', 'asset_equipment', 'asset_office_supplies', 'asset_survey', 'asset_vip'];
let totalMigrated = 0;
for (const table of legacyTables) {
try {
const [rows] = await connection.query(`SELECT * FROM ${table}`);
for (const row of rows) {
// 3.1 Insert into asset_core
await connection.query(`
INSERT IGNORE INTO asset_core (
id, asset_code, category, asset_type, asset_purpose, service_type, purchase_corp, purchase_date,
purchase_amount, purchase_vendor, approval_document, memo, manager_primary, manager_secondary,
current_dept, previous_dept, user_current, previous_user, emp_no, user_position, created_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`, [
row.id, row.asset_code, row.category, row.asset_type, row.asset_purpose, row.service_type,
row.purchase_corp, row.purchase_date, row.purchase_amount, row.purchase_vendor, row.approval_document,
row.memo, row.manager_primary, row.manager_secondary, row.current_dept, row.previous_dept,
row.user_current, row.previous_user, row.emp_no, row.user_position, row.created_at
]);
// 3.2 Insert into asset_hardware (if hardware fields exist)
if (row.model_name || row.cpu || row.ram || row.hw_status) {
await connection.query(`
INSERT INTO asset_hardware (
asset_id, hw_status, model_name, mainboard, os, cpu, ram, gpu, storage1, storage2, storage3, monitoring, price, volume, monitor_inch, serial_num
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`, [
row.id, row.hw_status, row.model_name, row.mainboard, row.os, row.cpu, row.ram, row.gpu,
row.ssd_1 || row.hdd_1, row.ssd_2 || row.hdd_2, row.hdd_3, row.monitoring, row.price,
row.volume, row.monitor_inch, row.serial_num
]);
}
// 3.3 Insert into asset_location (if location fields exist)
if (row.location || row.location_detail) {
await connection.query(`
INSERT INTO asset_location (
asset_id, location, location_detail, location_photo, loc_x, loc_y
) VALUES (?, ?, ?, ?, ?, ?)
`, [
row.id, row.location, row.location_detail, row.location_photo, row.loc_x, row.loc_y
]);
}
// 3.4 Insert into asset_remote (if network fields exist)
// Handle primary network interface
if (row.ip_address || row.mac_address || row.remote_tool) {
await connection.query(`
INSERT INTO asset_remote (
asset_id, ip_address, mac_address, remote_tool, remote_id, remote_pw
) VALUES (?, ?, ?, ?, ?, ?)
`, [
row.id, row.ip_address, row.mac_address, row.remote_tool, row.remote_id, row.remote_pw
]);
}
// Handle secondary network interface (e.g., from server table) if it exists
if (row.ip_address_2 || row.remote_tool_2) {
await connection.query(`
INSERT INTO asset_remote (
asset_id, ip_address, remote_tool, remote_id, remote_pw
) VALUES (?, ?, ?, ?, ?)
`, [
row.id, row.ip_address_2, row.remote_tool_2, row.remote_id_2, row.remote_pw_2
]);
}
totalMigrated++;
}
console.log(`- Migrated ${rows.length} records from ${table}`);
} catch (err) {
console.warn(`- Skipping legacy table ${table}: ${err.message}`);
}
}
console.log(`✅ Phase 1 Data Migration Completed. Total Assets Migrated: ${totalMigrated}`);
} catch (err) {
console.error('❌ Migration Failed:', err);
} finally {
await connection.end();
}
}
migrateSchema();
-212
View File
@@ -1,212 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function migrateV2() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('🚀 Phase 2: Final Migration to Normalized V2 Schema...');
try {
await connection.query('SET FOREIGN_KEY_CHECKS = 0');
// 1. Create/Enhance Core Tables
console.log('1. Creating/Enhancing Tables...');
await connection.query('DROP TABLE IF EXISTS asset_core, asset_hardware, asset_location, asset_remote');
await connection.query(`
CREATE TABLE asset_core (
id VARCHAR(50) PRIMARY KEY,
asset_code VARCHAR(100) UNIQUE NOT NULL,
category VARCHAR(100),
asset_type VARCHAR(100),
current_role VARCHAR(50) DEFAULT 'Normal' COMMENT 'Normal, Server, Personal, etc.',
asset_purpose VARCHAR(255),
service_type VARCHAR(50),
purchase_corp VARCHAR(100),
purchase_date VARCHAR(50),
purchase_amount VARCHAR(100),
purchase_vendor VARCHAR(255),
approval_document VARCHAR(255),
memo TEXT,
manager_primary VARCHAR(100),
manager_secondary VARCHAR(100),
current_dept VARCHAR(255),
previous_dept VARCHAR(255),
user_current VARCHAR(100),
previous_user VARCHAR(100),
emp_no VARCHAR(20),
user_position VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_hardware (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
hw_status VARCHAR(50),
model_name VARCHAR(255),
mainboard VARCHAR(255),
os VARCHAR(100),
cpu VARCHAR(255),
ram VARCHAR(100),
gpu VARCHAR(100),
storage1 VARCHAR(255),
storage2 VARCHAR(255),
storage3 VARCHAR(255),
storage4 VARCHAR(255),
monitoring VARCHAR(100),
price VARCHAR(100),
volume VARCHAR(100),
monitor_inch VARCHAR(50),
serial_num VARCHAR(100),
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_location (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
location VARCHAR(255),
location_detail VARCHAR(255),
location_photo VARCHAR(255),
loc_x VARCHAR(20),
loc_y VARCHAR(20),
is_active TINYINT(1) DEFAULT 1,
deactivated_at DATETIME NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
await connection.query(`
CREATE TABLE asset_remote (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
ip_address VARCHAR(100),
mac_address VARCHAR(100),
remote_tool VARCHAR(100),
remote_id VARCHAR(100),
remote_pw VARCHAR(100),
is_active TINYINT(1) DEFAULT 1,
deactivated_at DATETIME NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
console.log('✅ V2 Schema tables created.');
// 2. Migration Logic
const legacyTables = [
{ name: 'asset_pc', defaultRole: 'Personal' },
{ name: 'asset_server', defaultRole: 'Server' },
{ name: 'asset_storage', defaultRole: 'Normal' },
{ name: 'asset_equipment', defaultRole: 'Normal' },
{ name: 'asset_office_supplies', defaultRole: 'Normal' },
{ name: 'asset_survey', defaultRole: 'Normal' },
{ name: 'asset_vip', defaultRole: 'Normal' },
{ name: 'asset_pc_parts', defaultRole: 'Normal' }
];
let totalMigrated = 0;
for (const tableInfo of legacyTables) {
const table = tableInfo.name;
try {
const [rows] = await connection.query(`SELECT * FROM ${table}`);
console.log(`- Migrating ${rows.length} records from ${table}...`);
for (const row of rows) {
// 2.1 Insert into asset_core
const role = (table === 'asset_pc' && row.asset_type === '서버PC') ? 'Server' : tableInfo.defaultRole;
await connection.query(`
INSERT IGNORE INTO asset_core (
id, asset_code, category, asset_type, current_role, asset_purpose, service_type, purchase_corp, purchase_date,
purchase_amount, purchase_vendor, approval_document, memo, manager_primary, manager_secondary,
current_dept, previous_dept, user_current, previous_user, emp_no, user_position, created_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`, [
row.id, row.asset_code, row.category, row.asset_type, role, row.asset_purpose, row.service_type,
row.purchase_corp, row.purchase_date, row.purchase_amount, row.purchase_vendor, row.approval_document,
row.memo, row.manager_primary, row.manager_secondary, row.current_dept, row.previous_dept,
row.user_current || row.current_user, row.previous_user, row.emp_no, row.user_position, row.created_at
]);
// 2.2 Insert into asset_hardware
await connection.query(`
INSERT INTO asset_hardware (
asset_id, hw_status, model_name, mainboard, os, cpu, ram, gpu, storage1, storage2, storage3, storage4, monitoring, price, volume, monitor_inch, serial_num
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`, [
row.id, row.hw_status, row.model_name, row.mainboard, row.os, row.cpu, row.ram, row.gpu,
row.ssd_1 || row.storage1, row.ssd_2 || row.storage2, row.hdd_1 || row.storage3, row.hdd_2, row.monitoring, row.price,
row.volume, row.monitor_inch, row.serial_num
]);
// 2.3 Insert into asset_location
if (row.location || row.location_detail) {
await connection.query(`
INSERT INTO asset_location (
asset_id, location, location_detail, location_photo, loc_x, loc_y, is_active
) VALUES (?, ?, ?, ?, ?, ?, 1)
`, [
row.id, row.location, row.location_detail, row.location_photo, row.loc_x, row.loc_y
]);
}
// 2.4 Insert into asset_remote
// Primary Network
if (row.ip_address || row.mac_address || row.remote_tool) {
await connection.query(`
INSERT INTO asset_remote (
asset_id, ip_address, mac_address, remote_tool, remote_id, remote_pw, is_active
) VALUES (?, ?, ?, ?, ?, ?, 1)
`, [
row.id, row.ip_address, row.mac_address, row.remote_tool, row.remote_id, row.remote_pw
]);
}
// Secondary Network (for servers)
if (row.ip_address_2 || row.remote_tool_2) {
await connection.query(`
INSERT INTO asset_remote (
asset_id, ip_address, remote_tool, remote_id, remote_pw, is_active
) VALUES (?, ?, ?, ?, ?, 1)
`, [
row.id, row.ip_address_2, row.remote_tool_2, row.remote_id_2, row.remote_pw_2
]);
}
totalMigrated++;
}
} catch (err) {
console.warn(`- Skipping table ${table}: ${err.message}`);
}
}
await connection.query('SET FOREIGN_KEY_CHECKS = 1');
console.log(`✅ Phase 2 Data Migration Completed. Total Assets Migrated: ${totalMigrated}`);
} catch (err) {
console.error('❌ Migration Failed:', err);
} finally {
await connection.end();
}
}
migrateV2();
-73
View File
@@ -1,73 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const pool = mysql.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
port: parseInt(process.env.DB_PORT || '3306'),
});
async function migrate() {
const conn = await pool.getConnection();
try {
console.log('1. Creating asset_remote_v4 table...');
await conn.query(`
CREATE TABLE IF NOT EXISTS asset_remote_v4 (
id INT AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(50) NOT NULL,
net_type VARCHAR(20) NOT NULL, /* 'IP' or 'REMOTE' */
net_name VARCHAR(100), /* e.g., '기본망', 'AnyDesk' */
net_value1 VARCHAR(100), /* IP or ID */
net_value2 VARCHAR(100), /* MAC or PW */
is_active TINYINT(1) DEFAULT 1,
deactivated_at DATETIME NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (asset_id) REFERENCES asset_core(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
console.log('2. Migrating data from asset_remote...');
const [oldRows] = await conn.query('SELECT * FROM asset_remote WHERE is_active = 1');
let ipCount = 0;
let remoteCount = 0;
for (const row of oldRows) {
// Migrating IP/MAC
if (row.ip_address || row.mac_address) {
await conn.query(
'INSERT INTO asset_remote_v4 (asset_id, net_type, net_name, net_value1, net_value2, created_at) VALUES (?, ?, ?, ?, ?, ?)',
[row.asset_id, 'IP', '기본망', row.ip_address, row.mac_address, row.created_at]
);
ipCount++;
}
// Migrating Remote
if (row.remote_tool || row.remote_id || row.remote_pw) {
await conn.query(
'INSERT INTO asset_remote_v4 (asset_id, net_type, net_name, net_value1, net_value2, created_at) VALUES (?, ?, ?, ?, ?, ?)',
[row.asset_id, 'REMOTE', row.remote_tool, row.remote_id, row.remote_pw, row.created_at]
);
remoteCount++;
}
}
console.log(`Migrated ${ipCount} IP records and ${remoteCount} Remote records.`);
console.log('3. Renaming tables...');
await conn.query('DROP TABLE IF EXISTS asset_remote_legacy');
await conn.query('RENAME TABLE asset_remote TO asset_remote_legacy, asset_remote_v4 TO asset_remote;');
console.log('✅ Migration V4 (Remote) Complete.');
} catch (e) {
console.error('Migration failed:', e);
} finally {
conn.release();
pool.end();
}
}
migrate();
-28
View File
@@ -1,28 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const pool = mysql.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
port: parseInt(process.env.DB_PORT || '3306'),
});
async function migrate() {
const conn = await pool.getConnection();
try {
console.log('1. Renaming asset_network to asset_remote...');
await conn.query('RENAME TABLE asset_network TO asset_remote');
console.log('✅ Table renamed successfully.');
} catch (e) {
console.error('Migration failed:', e);
} finally {
conn.release();
pool.end();
}
}
migrate();
-195
View File
@@ -1,195 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config({ override: true });
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
// 기존의 감점 계산 로직을 그대로 이용해 등급과 감점점수를 도출하는 헬퍼 함수
function parseCpu(cpu) {
if (!cpu) return { tier: '기타', deduction: 30 };
const cpuUpper = cpu.toUpperCase().trim();
if (cpuUpper === '-' || cpuUpper === '') return { tier: '기타', deduction: 30 };
let tier = '기타';
let deduction = 30;
if (cpuUpper.includes('I9') || cpuUpper.includes('RYZEN 9') || cpuUpper.includes('RYZEN9')) {
tier = 'i9 / Ryzen 9';
deduction = 0;
} else if (cpuUpper.includes('I7') || cpuUpper.includes('RYZEN 7') || cpuUpper.includes('RYZEN7')) {
tier = 'i7 / Ryzen 7';
deduction = 5;
} else if (cpuUpper.includes('I5') || cpuUpper.includes('RYZEN 5') || cpuUpper.includes('RYZEN5')) {
tier = 'i5 / Ryzen 5';
deduction = 15;
} else if (cpuUpper.includes('I3') || cpuUpper.includes('RYZEN 3') || cpuUpper.includes('RYZEN3')) {
tier = 'i3 / Ryzen 3';
deduction = 25;
}
// CPU 세대 감점 계산 (최대 -15점)
let genDeduction = 0;
const intelMatch = cpuUpper.match(/I\d-?(\d+)/);
let gen = 0;
if (intelMatch && intelMatch[1]) {
const numStr = intelMatch[1];
if (numStr.length === 5) gen = parseInt(numStr.substring(0, 2), 10);
else if (numStr.length === 4) gen = parseInt(numStr.substring(0, 1), 10);
}
const amdMatch = cpuUpper.match(/RYZEN\s?\d\s?-?(\d+)/);
let amdGen = 0;
if (amdMatch && amdMatch[1] && !intelMatch) {
const numStr = amdMatch[1];
if (numStr.length === 4) amdGen = parseInt(numStr.substring(0, 1), 10);
}
if (intelMatch) {
if (gen >= 12) genDeduction = 0;
else if (gen >= 10) genDeduction = 5;
else if (gen >= 8) genDeduction = 10;
else genDeduction = 15;
} else if (amdMatch) {
if (amdGen >= 5) genDeduction = 0;
else if (amdGen >= 3) genDeduction = 5;
else genDeduction = 10;
} else {
genDeduction = 15;
}
// 최종 등급 감점 + 세대 감점 합산
return { tier, deduction: deduction + genDeduction };
}
function parseGpu(gpu) {
if (!gpu) return { tier: 'C', deduction: 25 };
const gpuUpper = gpu.toUpperCase().trim();
if (gpuUpper === '-' || gpuUpper === '') return { tier: 'C', deduction: 25 };
if (
gpuUpper.includes('RTX 4090') || gpuUpper.includes('RTX 4080') || gpuUpper.includes('RTX 4070') ||
gpuUpper.includes('RTX A5000') || gpuUpper.includes('RTX A6000') || gpuUpper.includes('RTX A4000')
) {
return { tier: 'S', deduction: 0 };
} else if (
gpuUpper.includes('RTX 3070') || gpuUpper.includes('RTX 3060') || gpuUpper.includes('RTX 2060') ||
gpuUpper.includes('RTX A2000') || gpuUpper.includes('RTX A3000') || gpuUpper.includes('QUADRO')
) {
return { tier: 'A', deduction: 5 };
} else if (
gpuUpper.includes('GTX 1660') || gpuUpper.includes('GTX 1080') || gpuUpper.includes('GTX 1070') ||
gpuUpper.includes('GTX 1060') || gpuUpper.includes('RX 6700') || gpuUpper.includes('RX 6600')
) {
return { tier: 'B', deduction: 15 };
} else {
return { tier: 'C', deduction: 25 };
}
}
function parseRam(ram) {
if (!ram) return { tier: '부족', deduction: 25 };
const ramUpper = ram.toUpperCase().trim();
if (ramUpper === '-' || ramUpper === '') return { tier: '부족', deduction: 25 };
const ramMatch = ramUpper.match(/(\d+)\s*GB/);
if (ramMatch && ramMatch[1]) {
const ramVal = parseInt(ramMatch[1], 10);
if (ramVal >= 32) return { tier: '최적', deduction: 0 };
else if (ramVal >= 16) return { tier: '보통', deduction: 10 };
else if (ramVal >= 8) return { tier: '주의', deduction: 20 };
}
return { tier: '부족', deduction: 25 };
}
async function runMigration() {
console.log('🔄 DB 커넥션 연결 중...');
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
try {
console.log('⚙️ 1. hardware_components_master 테이블 생성...');
await connection.query('DROP TABLE IF EXISTS hardware_components_master');
await connection.query(`
CREATE TABLE hardware_components_master (
id INT AUTO_INCREMENT PRIMARY KEY,
category VARCHAR(50) NOT NULL COMMENT 'CPU, GPU, RAM 등',
component_name VARCHAR(255) NOT NULL UNIQUE COMMENT '부품 표준 명칭',
score_tier VARCHAR(50) COMMENT '성능 등급',
deduction INT DEFAULT 0 COMMENT '감점 점수',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
console.log('✅ 테이블 생성 완료.');
console.log('🔍 2. 기존 asset_spec 테이블에서 부품명 조회...');
const [specRows] = await connection.query('SELECT DISTINCT cpu, ram, gpu FROM asset_spec');
const uniqueCpus = new Set();
const uniqueGpus = new Set();
const uniqueRams = new Set();
specRows.forEach(row => {
if (row.cpu && row.cpu.trim() !== '-' && row.cpu.trim() !== '') uniqueCpus.add(row.cpu.trim());
if (row.gpu && row.gpu.trim() !== '-' && row.gpu.trim() !== '') uniqueGpus.add(row.gpu.trim());
if (row.ram && row.ram.trim() !== '-' && row.ram.trim() !== '') uniqueRams.add(row.ram.trim());
});
// 만약 데이터가 너무 비어있을 경우를 대비하여 기본 대표 부품 몇 개 추가
if (uniqueCpus.size === 0) {
['Intel Core i9-13900K', 'Intel Core i7-14700K', 'Intel Core i5-12400', 'AMD Ryzen 7 7800X3D', 'Intel Core i3-10100'].forEach(c => uniqueCpus.add(c));
}
if (uniqueGpus.size === 0) {
['NVIDIA GeForce RTX 4090', 'NVIDIA GeForce RTX 4070', 'NVIDIA GeForce RTX 3060', 'Intel Iris Xe Graphics', 'NVIDIA GeForce GTX 1660 Super'].forEach(g => uniqueGpus.add(g));
}
if (uniqueRams.size === 0) {
['8GB', '16GB', '32GB', '64GB'].forEach(r => uniqueRams.add(r));
}
console.log(` - 추출된 CPU 개수: ${uniqueCpus.size}`);
console.log(` - 추출된 GPU 개수: ${uniqueGpus.size}`);
console.log(` - 추출된 RAM 개수: ${uniqueRams.size}`);
console.log('💾 3. 마스터 테이블에 부품 데이터 및 감점 정보 삽입...');
// CPU 삽입
for (const cpu of uniqueCpus) {
const { tier, deduction } = parseCpu(cpu);
await connection.query(
'INSERT IGNORE INTO hardware_components_master (category, component_name, score_tier, deduction) VALUES (?, ?, ?, ?)',
['CPU', cpu, tier, deduction]
);
}
// GPU 삽입
for (const gpu of uniqueGpus) {
const { tier, deduction } = parseGpu(gpu);
await connection.query(
'INSERT IGNORE INTO hardware_components_master (category, component_name, score_tier, deduction) VALUES (?, ?, ?, ?)',
['GPU', gpu, tier, deduction]
);
}
// RAM 삽입
for (const ram of uniqueRams) {
const { tier, deduction } = parseRam(ram);
await connection.query(
'INSERT IGNORE INTO hardware_components_master (category, component_name, score_tier, deduction) VALUES (?, ?, ?, ?)',
['RAM', ram, tier, deduction]
);
}
console.log('✅ 마이그레이션이 성공적으로 완료되었습니다!');
} catch (error) {
console.error('❌ 마이그레이션 오류 발생:', error);
} finally {
await connection.end();
}
}
runMigration();
+1183 -1592
View File
File diff suppressed because it is too large. Load diff
+20 -19
View File
@@ -1,26 +1,27 @@
{ {
"name": "hm-itam", "name": "pierzainer-3d-drawing",
"private": true, "version": "0.1.0",
"version": "0.0.0", "description": "교각 3D 형상 생성 웹앱 (1단계: 형상 생성)",
"type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc --noEmit && vite build",
"preview": "vite preview", "typecheck": "tsc --noEmit",
"server": "node server.js", "test": "vitest run"
"db-init": "node db_init.js" },
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"dependencies": {
"three": "^0.186.1",
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^5.2.2", "@types/node": "^26.6.5",
"vite": "^5.2.0" "@types/three": "^0.186.0",
"typescript": "^7.0.2",
"vite": "^8.3.5",
"vitest": "^5.0.5"
}, },
"dependencies": { "private": true
"cors": "^2.8.6",
"dotenv": "^17.4.2",
"express": "^5.2.1",
"iconv-lite": "^0.7.2",
"lucide": "^0.364.0",
"mysql2": "^3.22.1",
"xlsx": "^0.18.5"
}
} }
-134
View File
@@ -1,134 +0,0 @@
import wmi
import requests
import json
import socket
import platform
import sys
import time
def collect_specs():
try:
c = wmi.WMI()
computer = c.Win32_ComputerSystem()[0]
os_info = c.Win32_OperatingSystem()[0]
proc = c.Win32_Processor()[0]
board = c.Win32_BaseBoard()[0]
# 1. 상세 GPU 정보 수집 (모든 그래픽 카드)
gpu_list = []
for g in c.Win32_VideoController():
gpu_list.append(g.Name)
gpu_info = ", ".join(gpu_list) if gpu_list else "N/A"
# 2. 모든 저장장치 정보 수집 및 SSD/HDD 구분
storage_list = []
# Windows 8 이상에서 작동하는 상세 저장소 정보 수집 시도
physical_disks = {}
try:
storage_c = wmi.WMI(namespace="Root\\Microsoft\\Windows\\Storage")
for d in storage_c.MSFT_PhysicalDisk():
# MediaType: 3(HDD), 4(SSD), 0(Unspecified)
physical_disks[d.DeviceId] = d.MediaType
except:
pass
for d in c.Win32_DiskDrive():
size_gb = round(float(d.Size) / (1024**3)) if d.Size else 0
# 미디어 타입 판단
media_type = physical_disks.get(str(d.Index), 0)
prefix = ""
if media_type == 4:
prefix = "[SSD] "
elif media_type == 3:
prefix = "[HDD] "
else:
# 힌트가 없을 경우 모델명으로 추측
cap = d.Caption.upper()
if "SSD" in cap or "NVME" in cap or "FLASH" in cap:
prefix = "[SSD] "
else:
prefix = "[HDD] "
storage_list.append(f"{prefix}{d.Caption} ({size_gb}GB)")
# DB 필드(SSD1, SSD2, SSD3)에 나눠 담기
storage1 = storage_list[0] if len(storage_list) > 0 else "N/A"
storage2 = storage_list[1] if len(storage_list) > 1 else ""
storage3 = storage_list[2] if len(storage_list) > 2 else ""
# 실시간 데이터 추출
specs = {
"메인보드": f"{board.Manufacturer} {board.Product}".strip(),
"CPU": proc.Name.strip(),
"RAM": f"{round(float(computer.TotalPhysicalMemory) / (1024**3))}GB",
"OS": os_info.Caption,
"GPU": gpu_info,
"SSD1": storage1,
"SSD2": storage2,
"SSD3": storage3,
"비고": "실시간 에이전트(EXE) 자동 수집"
}
return specs
except Exception as e:
print(f"데이터 수집 중 오류 발생: {e}")
return None
def send_data(specs, server_url, asset_code):
try:
# 전송 데이터에 자산코드 추가 (식별용)
specs["자산코드"] = asset_code
print(f"\n📡 서버로 전송 중... ({server_url})")
response = requests.post(server_url, json=specs, timeout=10)
if response.status_code == 200:
print("✅ 전송 성공! ITAM 시스템에서 확인하세요.")
else:
print(f"❌ 전송 실패: 서버 응답 코드 {response.status_code}")
except Exception as e:
print(f"❌ 서버 연결 오류: {e}")
print("서버가 켜져 있는지, URL이 맞는지 확인해주세요.")
if __name__ == "__main__":
print("========================================")
print(" ITAM PC 실시간 사양 수집 에이전트 (v1.1)")
print("========================================\n")
# 1. 정보 수집
print("🔍 하드웨어 정보를 읽어오는 중...")
data = collect_specs()
if data:
print("\n[수집된 실제 사양]")
display_map = {
"메인보드": "메인보드",
"CPU": "CPU",
"RAM": "RAM",
"OS": "OS",
"GPU": "GPU",
"SSD1": "Storage 1",
"SSD2": "Storage 2",
"SSD3": "Storage 3",
"비고": "비고"
}
for key, value in data.items():
if value: # 값이 있는 경우만 표시
label = display_map.get(key, key)
print(f" - {label}: {value}")
print("\n" + "="*40)
asset_code = input("등록할 자산번호를 입력하세요 (예: PC-001): ").strip()
if not asset_code:
print("❌ 자산번호 없이는 전송할 수 없습니다.")
else:
server_ip = input("서버 IP를 입력하세요 (기본값 localhost): ").strip()
if not server_ip: server_ip = "localhost"
target_url = f"http://{server_ip}:3000/api/agent/collect"
confirm = input("\n위 정보를 서버로 전송할까요? (y/n): ")
if confirm.lower() == 'y':
send_data(data, target_url, asset_code)
print("\n5초 후 프로그램이 종료됩니다...")
time.sleep(5)
-38
View File
@@ -1,38 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['pc_agent.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='pc_agent',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
-36
View File
@@ -1,36 +0,0 @@
import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
dotenv.config();
const { DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT } = process.env;
async function probeDB() {
const connection = await mysql.createConnection({
host: DB_HOST,
user: DB_USER,
password: DB_PASS,
database: DB_NAME,
port: parseInt(DB_PORT || '3306')
});
console.log('--- Database Probe Start ---');
const [tables] = await connection.query('SHOW TABLES');
const tableNames = tables.map(t => Object.values(t)[0]);
console.log('Existing Tables:', tableNames);
for (const table of tableNames) {
const [columns] = await connection.query(`DESCRIBE ${table}`);
console.log(`\n[Table: ${table}]`);
columns.forEach(c => {
console.log(` - ${c.Field} (${c.Type}) ${c.Comment ? '// ' + c.Comment : ''}`);
});
}
await connection.end();
console.log('\n--- Database Probe End ---');
}
probeDB().catch(console.error);
-247
View File
@@ -1,247 +0,0 @@
# ITAM 운영 배포 작업 로드맵
## 1. 문서 목적
이 문서는 ITAM 저장소를 Windows/WSL 시범 구동 상태에서 Linux 운영 서버 배포 상태로 전환하기 위한 구체적인 작업 목록과 우선순위를 정리한 로드맵이다.
현재 상태: 개발/시범용 Docker 구조 (Vite dev server + bind mount + external DB)
목표 상태: 운영 배포 구조 (정적 빌드 + 영속 스토리지 분리 + reverse proxy + external DB)
---
## 2. 작업 페이즈 분류
### 2.1 Phase 1: 핵심 배포 파일 (우선순위: 높음)
운영 환경에서 실제 배포를 가능하게 하는 기초 작업이다.
1. ✅ **Add production compose file** (`docker-compose.prod.yaml`)
- 목표: 운영 서버 기준 최종 compose 파일 작성
- 범위: backend, frontend, nginx 서비스 정의
- 입력: 외부 `.env`, 호스트 경로 마운트 정의
- 출력: `/deploy/docker-compose.prod.yaml`
- 완료 기준: `docker compose -f docker-compose.prod.yaml config` 성공
2. ✅ **Create production frontend Dockerfile (multi-stage build)**
- 목표: 정적 자산 기반 프런트엔드 이미지 생성
- 범위: Stage 1 = 빌드 (Node.js + npm build), Stage 2 = 정적 서빙 (Nginx)
- 입력: 현재 `Dockerfile.frontend` 참고, `npm run build` 검증
- 출력: `Dockerfile.frontend.prod` 또는 분기 처리
- 완료 기준: 로컬에서 `npm run build` 성공, 이미지 빌드 성공, 정적 파일 8080 서빙 확인
3. ✅ **Harden backend Dockerfile for production**
- 목표: production 환경 최적화된 백엔드 이미지
- 범위: NODE_ENV=production, production 의존성만, 비루트 사용자, health check 추가
- 입력: 현재 `Dockerfile.backend`, `server.js` 검토
- 출력: 수정된 `Dockerfile.backend` 또는 `.prod` 버전
- 완료 기준: 이미지 빌드 성공, 시작 후 health endpoint 응답 200
4. ✅ **Define host paths and named volumes for persistence**
- 목표: Linux 서버의 운영 디렉터리 구조 정의
- 범위: `/srv/itam/{app,env,config,uploads,logs,deploy}` 마운트 정책 확정
- 입력: doc_readme3.md 섹션 7 참고
- 출력: docker-compose.prod.yaml에 적용, 볼륨 마운트 확인
- 완료 기준: compose 파일에 경로 마운트 명시, 영속성 테스트 (컨테이너 재시작 후 데이터 유지)
---
### 2.2 Phase 2: 네트워킹 및 보안 (우선순위: 높음)
외부 접근 경로와 보안을 담당하는 작업이다.
5. ✅ **Provide Nginx reverse-proxy and frontend static config**
- 목표: Nginx 설정파일 작성 (frontend 정적 서빙 + API 프록시)
- 범위: `/` → frontend, `/api/` → backend:3000, 기본 보안 헤더, gzip
- 입력: doc_readme3.md 섹션 12 참고 (예시 개념)
- 출력: `/deploy/nginx/default.conf`
- 완료 기준: `docker compose -f docker-compose.prod.yaml up -d` 후 `http://localhost/api/assets/master` 응답 200
6. ✅ **Externalize and secure environment variables (.env.example + secrets guidance)**
- 목표: 민감정보 보호 기준 문서화
- 범위: `.env.example` 생성, Git 제외 확인, 운영 환경 분리 지침
- 입력: 현재 `.env` 파일, `.gitignore` 점검
- 출력: `.env.example`, env 관리 가이드 추가 (doc_readme3.md 또는 SECURITY.md)
- 완료 기준: `.env`가 `.gitignore`에 등록, `.env.example` 배포 파일 작성됨
7. ✅ **Define TLS certificate handling strategy (Let's Encrypt / mount certs)**
- 목표: HTTPS 인증서 관리 정책 확정
- 범위: 자동 갱신 (certbot + Let's Encrypt) 또는 마운트 기반 수동 관리 선택
- 입력: 사내 정책 확인, 운영 도메인 확인
- 출력: `deploy/nginx/tls-strategy.md` 또는 compose 파일 주석으로 정리
- 완료 기준: 선택 방식 문서화, nginx 설정 적용 준비
8. ✅ **Security review: non-root users, image scan, secret rotation**
- 목표: 보안 체크리스트 작성 및 초기 적용
- 범위: Dockerfile non-root 사용자 추가, 이미지 취약점 스캔 지침, 비밀 로테이션 정책
- 입력: doc_readme3.md 섹션 13.3 (보안) 참고
- 출력: 수정된 Dockerfile, `SECURITY.md` 또는 운영 가이드 추가
- 완료 기준: 백엔드/프런트엔드 모두 비루트 사용자로 실행 확인
---
### 2.3 Phase 3: 모니터링 및 운영 준비 (우선순위: 중간)
배포 후 운영을 원활하게 하기 위한 작업이다.
9. ✅ **Add healthcheck and readiness endpoint in backend**
- 목표: backend 헬스 체크 엔드포인트 추가
- 범위: `GET /health` 또는 `/ready` 엔드포인트 추가 (DB 연결 확인)
- 입력: `server.js` 현재 코드 검토
- 출력: backend 에서 health 응답, docker-compose.prod.yaml에 healthcheck 설정
- 완료 기준: `curl http://localhost:3000/health` 응답 200, 컨테이너 헬스 상태 healthy 표시
10. ✅ **Add logging and log rotation guidance**
- 목표: 컨테이너 로그 관리 정책 문서화
- 범위: Docker logging driver 설정, log rotation 정책, 저장소 경로 정의
- 입력: `/srv/itam/logs` 마운트 계획
- 출력: docker-compose.prod.yaml에 로깅 설정, docs에 로그 확인 가이드
- 완료 기준: 로그 파일이 `/srv/itam/logs`에 저장됨, rotation 정책 명시
11. ✅ **Document backup and restore procedures for DB and uploads**
- 목표: 운영 데이터 백업/복구 절차 문서화
- 범위: 외부 MySQL 백업 정책, `/srv/itam/uploads` 백업, 복구 절차 스크립트 예시
- 입력: doc_readme3.md 섹션 14 참고
- 출력: `BACKUP_RESTORE.md` 또는 운영 가이드 추가 섹션
- 완료 기준: 백업 스크립트 예시 작성, 복구 절차 테스트 완료
12. ✅ **Add smoke tests and post-deploy checks**
- 목표: 배포 후 빠른 검증 스크립트 작성
- 범위: 컨테이너 상태 확인, API 응답 테스트, 파일 업로드 테스트, DB 연결 확인
- 입력: doc_readme3.md 섹션 13 (점검 체크리스트) 참고
- 출력: `scripts/smoke-test.sh` 또는 배포 후 확인 스크립트
- 완료 기준: 스크립트 실행 후 모든 검사 통과
---
### 2.4 Phase 4: 자동화 및 CI/CD (우선순위: 중간)
장기 운영을 위한 자동화 작업이다.
13. ✅ **Prepare CI/CD build & push scripts (image registry)**
- 목표: 이미지 빌드 및 레지스트리 푸시 자동화
- 범위: `docker build`, `docker tag`, `docker push` 스크립트 또는 GitHub Actions/GitLab CI 예시
- 입력: 이미지 레지스트리 주소 확인 (e.g., registry.example.com, Docker Hub, etc.)
- 출력: `.github/workflows/build.yml` 또는 `scripts/build-push.sh`
- 완료 기준: 수동 빌드/푸시 스크립트 작동 확인, 이미지 태그 정책 확정
14. ✅ **Create deploy directory with compose.prod and nginx configs**
- 목표: 운영 배포 디렉터리 정리
- 범위: `/deploy/docker-compose.prod.yaml`, `/deploy/nginx/default.conf`, 기타 설정 파일 조직화
- 입력: Phase 1-3 결과물
- 출력: 다음 구조로 정리됨:
```
deploy/
docker-compose.prod.yaml
nginx/
default.conf
tls-strategy.md
scripts/
smoke-test.sh
backup.sh
```
- 완료 기준: 디렉터리 구조 확정, 모든 파일 위치 일관성 있음
---
### 2.5 Phase 5: 절차 및 문서화 (우선순위: 중간)
운영 절차와 문서를 정리하는 작업이다.
15. ✅ **Write rollout and rollback procedures (steps, checklist)**
- 목표: 배포 및 복구 절차 문서화
- 범위: 배포 전 체크리스트, 배포 단계별 절차, 장애 시 롤백 절차
- 입력: doc_readme3.md 섹션 16 참고
- 출력: `DEPLOYMENT_PROCEDURES.md` 또는 운영 가이드 통합
- 완료 기준: 절차 문서 완성, 체크리스트 확인 가능
---
## 3. 작업 우선순위 및 권장 순서
### 3.1 필수 우선 작업 (Phase 1 완료 필수)
1. Add production compose file
2. Create production frontend Dockerfile (multi-stage build)
3. Harden backend Dockerfile for production
4. Define host paths and named volumes for persistence
**목표**: 기본 배포 구조 완성, Linux 서버에서 최소 기동 가능 상태
### 3.2 보안 필수 작업 (Phase 2 완료 권장)
5. Provide Nginx reverse-proxy and frontend static config
6. Externalize and secure environment variables
7. Define TLS certificate handling strategy
8. Security review: non-root users, image scan, secret rotation
**목표**: 운영 환경 최소 보안 기준 충족
### 3.3 운영 안정화 작업 (Phase 3 진행)
9. Add healthcheck and readiness endpoint in backend
10. Add logging and log rotation guidance
11. Document backup and restore procedures
12. Add smoke tests and post-deploy checks
**목표**: 배포 후 문제 식별 및 백업/복구 가능 상태
### 3.4 장기 운영 자동화 (Phase 4-5는 선택)
13. Prepare CI/CD build & push scripts
14. Create deploy directory with compose.prod and nginx configs
15. Write rollout and rollback procedures
**목표**: 반복 배포 자동화, 절차 표준화
---
## 4. 작업 환경 및 검증 기준
### 4.1 개발/테스트 환경
- 로컬 Linux VM 또는 WSL에서 Phase 1-2 테스트
- Docker Desktop or Docker Engine 필수
- 외부 테스트 MySQL 또는 mock DB
### 4.2 스테이징 환경
- 실제 Linux 서버에서 전체 배포 절차 테스트
- 운영 환경과 동일 아키텍처
### 4.3 운영 배포
- 위 모든 Phase 완료 후 진행
- 백업 확인 후 배포
- 배포 후 smoke test 자동 실행
---
## 5. 진행 추적
진행 상황은 아래 상태로 추적한다.
- `not-started`: 아직 시작 안 함
- `in-progress`: 현재 진행 중
- `completed`: 완료됨
현재 상태는 모두 `not-started`이며, Phase 1 우선 순위 항목부터 순차적으로 진행한다.
---
## 6. 예상 일정
- Phase 1 (핵심 배포 파일): 1-2일
- Phase 2 (네트워킹 및 보안): 1-2일
- Phase 3 (모니터링 및 운영 준비): 1일
- Phase 4-5 (자동화 및 절차): 1-2일
**전체 예상 소요 시간**: 4-7일
---
## 7. 추가 고려사항
1. 현재 `doc_readme3.md`는 가이드 문서이고, 이 로드맵은 구현 작업 목록이다.
2. Phase 1-2 완료 후 실제 코드 커밋은 `Dockerizing` 브랜치에만 한다.
3. 각 Phase 완료 후 관련 문서도 함께 업데이트한다.
4. 운영 전환 전에 최소 1회 스테이징 환경에서 전체 배포 절차 테스트를 수행한다.
@@ -1,429 +0,0 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PC 사양 적정성 분석 기획서 (GPU 반영)</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Outfit:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<style>
:root {
--primary: #4F46E5;
--primary-light: #EEF2FF;
--secondary: #10B981;
--secondary-light: #D1FAE5;
--danger: #EF4444;
--danger-light: #FEE2E2;
--warning: #F59E0B;
--warning-light: #FEF3C7;
--purple: #7C3AED;
--purple-light: #EDE9FE;
--text-dark: #0F172A;
--text-body: #334155;
--text-muted: #64748B;
--border: #E2E8F0;
--bg-light: #F8FAFC;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Outfit', 'Noto Sans KR', sans-serif;
color: var(--text-body);
background: #fff;
letter-spacing: -0.02em;
line-height: 1.7;
}
.page { max-width: 980px; margin: 0 auto; padding: 3rem 2rem; }
/* ─ Header ─ */
.doc-header { border-bottom: 3px solid var(--text-dark); padding-bottom: 1.75rem; margin-bottom: 3rem; }
.doc-label {
display: inline-block; font-size: 0.75rem; font-weight: 700; color: var(--primary);
background: var(--primary-light); padding: 0.25rem 0.75rem; border-radius: 99px;
text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.75rem;
}
.version-badge {
display: inline-block; font-size: 0.7rem; font-weight: 700; color: var(--secondary);
background: var(--secondary-light); padding: 0.2rem 0.6rem; border-radius: 99px;
margin-left: 0.5rem; vertical-align: middle;
}
.doc-header h1 { font-size: 2rem; font-weight: 900; color: var(--text-dark); line-height: 1.25; margin-bottom: 1rem; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.meta-item { background: var(--bg-light); border-radius: 8px; padding: 0.65rem 1rem; font-size: 0.83rem; }
.meta-item .label { color: var(--text-muted); display: block; font-size: 0.75rem; }
.meta-item .val { font-weight: 700; color: var(--text-dark); font-size: 0.9rem; }
/* ─ Sections ─ */
section { margin-bottom: 3.5rem; }
h2 {
font-size: 1.3rem; font-weight: 800; color: var(--text-dark);
padding-bottom: 0.5rem; border-bottom: 2px solid var(--border);
margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.6rem;
}
h2 .num {
display: inline-flex; align-items: center; justify-content: center;
width: 28px; height: 28px; background: var(--primary); color: #fff;
border-radius: 50%; font-size: 0.75rem; font-weight: 800; flex-shrink: 0;
}
h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-dark); margin: 1.75rem 0 0.75rem; }
p { margin-bottom: 1rem; color: var(--text-body); font-size: 0.97rem; }
/* ─ Boxes ─ */
.box { border-radius: 10px; padding: 1.25rem 1.5rem; margin: 1.25rem 0; font-size: 0.93rem; }
.box-blue { background: var(--primary-light); border-left: 4px solid var(--primary); }
.box-green { background: var(--secondary-light); border-left: 4px solid var(--secondary); }
.box-yellow { background: var(--warning-light); border-left: 4px solid var(--warning); }
.box-red { background: var(--danger-light); border-left: 4px solid var(--danger); }
.box-purple { background: var(--purple-light); border-left: 4px solid var(--purple); }
.box-title { font-weight: 700; color: var(--text-dark); margin-bottom: 0.5rem; font-size: 0.95rem; }
/* ─ Score formula block ─ */
.formula {
background: #1E293B; color: #E2E8F0; border-radius: 8px;
padding: 1rem 1.25rem; font-family: 'Courier New', monospace;
font-size: 0.87rem; margin: 1rem 0; overflow-x: auto; line-height: 2;
}
.formula .comment { color: #64748B; }
.formula .key { color: #93C5FD; }
.formula .val { color: #6EE7B7; }
.formula .warn { color: #FCD34D; }
/* ─ Three-col score grid ─ */
.score-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin: 1.5rem 0; }
@media(max-width: 700px) { .score-grid-3 { grid-template-columns: 1fr; } }
.score-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.score-card-header {
background: var(--bg-light); padding: 0.65rem 1rem;
font-weight: 700; font-size: 0.88rem; color: var(--text-dark);
border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.dot-green { background: var(--secondary); }
.dot-purple { background: var(--purple); }
/* ─ Tables ─ */
.tbl-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 1.25rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { background: var(--bg-light); padding: 0.65rem 1rem; font-weight: 700; color: var(--text-dark); border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-body); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-light); }
/* ─ Badges ─ */
.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.b-primary { color: var(--primary); background: var(--primary-light); }
.b-green { color: #065F46; background: var(--secondary-light); }
.b-red { color: #991B1B; background: var(--danger-light); }
.b-yellow { color: #92400E; background: var(--warning-light); }
.b-purple { color: #5B21B6; background: var(--purple-light); }
/* ─ Flow ─ */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin: 1.5rem 0; }
.flow-step { background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 0.83rem; padding: 0.55rem 0.9rem; border-radius: 8px; text-align: center; }
.flow-step.gpu { background: var(--purple-light); color: var(--purple); }
.flow-arrow { font-size: 1.1rem; color: var(--text-muted); padding: 0 0.4rem; }
/* ─ GPU tier table highlight ─ */
.tier-S td:first-child { font-weight: 800; color: #DC2626; }
.tier-A td:first-child { font-weight: 700; color: var(--primary); }
.tier-B td:first-child { font-weight: 700; color: var(--secondary); }
.tier-C td:first-child { color: var(--warning); font-weight: 600; }
.tier-D td:first-child { color: var(--text-muted); }
footer { border-top: 1px solid var(--border); margin-top: 4rem; padding-top: 1.5rem; text-align: center; font-size: 0.8rem; color: var(--text-muted); }
</style>
</head>
<body>
<div class="page">
<!-- HEADER -->
<header class="doc-header">
<div class="doc-label">기능 명세서 <span class="version-badge">v3.0 — 100점 감점제 반영</span></div>
<h1>PC 사양 적정성 분석 기획서<br>
<span style="font-size:1.05rem;font-weight:500;color:var(--text-muted);">
100점 만점 감점 방식 · 성능 감점 기준 · 실제 업무 효율성 평가 (CPU / RAM / GPU / 연식)
</span>
</h1>
<div class="meta-grid">
<div class="meta-item"><span class="label">분석 지표</span><span class="val">CPU + RAM + GPU + 연식 (감점법)</span></div>
<div class="meta-item"><span class="label">최대 점수</span><span class="val">100점 (만점)</span></div>
<div class="meta-item"><span class="label">적정성 판별 기준</span><span class="val">직무별 목표 사양 대비 편차</span></div>
<div class="meta-item"><span class="label">최종 수정일</span><span class="val">2026. 05. 31</span></div>
</div>
</header>
<!-- 1. 개요 -->
<section>
<h2><span class="num">1</span>개요 — 100점 만점 감점형 성능 점수 체계</h2>
<p>
v3.0부터 PC 사양 점수는 <strong>100점 만점 기준 감점제</strong>로 산출됩니다.
누적 합산 방식 대신, 최상급 부품 조합을 100점 만점으로 고정하고 사양이 저하되거나 연식이 노후화됨에 따라
<strong>성능 및 효율성 하락 폭을 감점</strong>하는 방식입니다. 이는 실제 업무 환경에서 PC 노후도에 따른
체감 생산성 저하를 훨씬 직관적이고 현실적으로 드러냅니다.
</p>
<div class="flow">
<div class="flow-step">① 기본 100점 만점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">② CPU 등급/세대 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">③ RAM 용량 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step gpu">④ GPU 등급 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">⑤ 연식 노후 감점</div>
<div class="flow-arrow">→</div>
<div class="flow-step">⑥ 최종 실질 성능 점수</div>
</div>
<div class="formula">
<span class="comment">// ─── 최종 PC 사양 점수 (100점 만점, 최소 10점 보존) ───</span>
<span class="key">totalScore</span> = max(10, 100 - (<span class="val">cpuDeduction</span> + <span class="val">genDeduction</span> + <span class="val">ramDeduction</span> + <span class="val">gpuDeduction</span> + <span class="val">ageDeduction</span>))
</div>
</section>
<!-- 2. CPU 감점 룰 -->
<section>
<h2><span class="num">2</span>CPU 사양 감점 기준</h2>
<p>CPU 감점은 <strong>등급 감점(최대 -30점)</strong>과 <strong>세대 노후 감점(최대 -15점)</strong>의 합산입니다.</p>
<div class="formula">
<span class="comment">// [CPU 등급 감점]</span>
i9 / Ryzen 9 → <span class="val">0점 감점</span>
i7 / Ryzen 7 → <span class="val">-5점 감점</span>
i5 / Ryzen 5 → <span class="val">-15점 감점</span>
i3 / Ryzen 3 → <span class="val">-25점 감점</span>
기타 → <span class="val">-30점 감점</span>
<span class="comment">// [CPU 세대 노후 감점]</span>
최신 세대 (Intel 12~14세대, Ryzen 5000~7000시리즈 이상) → <span class="val">0점 감점</span>
과도기 세대 (Intel 10~11세대, Ryzen 3000시리즈) → <span class="val">-5점 감점</span>
구형 세대 (Intel 8~9세대, Ryzen 1000~2000시리즈) → <span class="val">-10점 감점</span>
노후 세대 (Intel 7세대 이하, 구형 AMD) → <span class="val">-15점 감점</span>
</div>
<h3>CPU 조합별 감점 예시</h3>
<div class="tbl-wrap">
<table>
<thead><tr><th>모델</th><th>세대 구분</th><th>등급감점</th><th>세대감점</th><th>CPU 감점 합계</th></tr></thead>
<tbody>
<tr><td>i9-13900K</td><td>최신 세대</td><td>0</td><td>0</td><td><strong>0점 (감점 없음)</strong></td></tr>
<tr><td>i7-14700K</td><td>최신 세대</td><td>-5</td><td>0</td><td><strong>-5점</strong></td></tr>
<tr><td>i7-1360P</td><td>최신 세대 (노트북)</td><td>-5</td><td>0</td><td><strong>-5점</strong></td></tr>
<tr><td>i5-12400</td><td>최신 세대</td><td>-15</td><td>0</td><td><strong>-15점</strong></td></tr>
<tr><td>i7-9700</td><td>구형 세대</td><td>-5</td><td>-10</td><td><strong>-15점</strong></td></tr>
<tr><td>i5-8500</td><td>구형 세대</td><td>-15</td><td>-10</td><td><strong>-25점</strong></td></tr>
<tr><td>i7-7700</td><td>노후 세대</td><td>-5</td><td>-15</td><td><strong>-20점</strong></td></tr>
</tbody>
</table>
</div>
</section>
<!-- 3. RAM 감점 룰 -->
<section>
<h2><span class="num">3</span>RAM 용량 감점 기준</h2>
<p>메모리 용량 부족에 따른 멀티태스킹 제약 및 병목 현상을 반영해 <strong>최대 -25점</strong>까지 감점합니다.</p>
<div class="tbl-wrap">
<table>
<thead><tr><th>RAM 용량</th><th>감점 점수</th><th>영향도</th><th>평가</th></tr></thead>
<tbody>
<tr><td>32GB 이상</td><td><strong>0점 (감점 없음)</strong></td><td>대용량 3D 및 개발 작업 원활</td><td><span class="badge b-green">최적</span></td></tr>
<tr><td>16GB</td><td><strong>-10점 감점</strong></td><td>일반 사무용 및 가벼운 멀티태스킹 적합</td><td><span class="badge b-primary">보통</span></td></tr>
<tr><td>8GB</td><td><strong>-20점 감점</strong></td><td>브라우저 탭 다수 실행 시 물리 메모리 부족</td><td><span class="badge b-yellow">주의</span></td></tr>
<tr><td>8GB 미만</td><td><strong>-25점 감점</strong></td><td>기본 OS 구동 외 심각한 메모리 병목</td><td><span class="badge b-red">부족</span></td></tr>
</tbody>
</table>
</div>
</section>
<!-- 4. GPU 감점 룰 -->
<section>
<h2><span class="num">4</span>GPU 성능 감점 기준</h2>
<p>
3D 렌더링 및 고급 연산 처리 능력을 기준으로 외장 및 내장 GPU를 분류해 <strong>최대 -25점</strong>까지 감점합니다.
GPU 정보가 감지되지 않거나 없는 경우 기본적으로 내장 그래픽 수준인 -25점을 감점합니다.
</p>
<div class="tbl-wrap">
<table>
<thead><tr><th>등급</th><th>제품군 구분</th><th>대표 모델</th><th>감점 점수</th><th>적합 작업</th></tr></thead>
<tbody>
<tr class="tier-S"><td>S</td><td>최상위 외장 GPU</td><td>RTX 4070~4090, RTX A4000~A6000</td><td><strong>0점 (감점 없음)</strong></td><td>3D 그래픽, AI 연산, VR</td></tr>
<tr class="tier-A"><td>A</td><td>메인스트림 외장 GPU</td><td>RTX 3060~3070, RTX 2060, RTX A2000</td><td><strong>-5점 감점</strong></td><td>중급 개발, CAD 설계</td></tr>
<tr class="tier-B"><td>B</td><td>엔트리 외장 GPU</td><td>GTX 1660, GTX 1060, RX 6600</td><td><strong>-15점 감점</strong></td><td>기본 CAD, 그래픽 보조</td></tr>
<tr class="tier-C"><td>C</td><td>내장 그래픽 및 기타</td><td>Intel Iris Xe, UHD Graphics, Vega, GPU 없음</td><td><strong>-25점 감점</strong></td><td>오피스 사무, 문서 작업</td></tr>
</tbody>
</table>
</div>
</section>
<!-- 5. 종합 점수 감점 사례 -->
<section>
<h2><span class="num">5</span>감점법 종합 점수 계산 실사례</h2>
<div class="tbl-wrap">
<table>
<thead>
<tr><th>모델명</th><th>CPU 사양 (감점)</th><th>RAM 사양 (감점)</th><th>GPU 사양 (감점)</th><th>연식 (감점)</th><th>감점 총합</th><th>최종 점수</th></tr>
</thead>
<tbody>
<tr>
<td>HP ZBook Fury 16</td><td>Ryzen 9 7900X (0)</td><td>64GB (0)</td><td>NVIDIA RTX A2000 (-5)</td><td>2년차 (-6)</td><td>-11</td><td><strong>89점</strong></td>
</tr>
<tr>
<td>Dell Precision 5680</td><td>i9-13900K (0)</td><td>64GB (0)</td><td>NVIDIA RTX 4070 (0)</td><td>2년차 (-6)</td><td>-6</td><td><strong>94점</strong></td>
</tr>
<tr>
<td>LG Gram 17 Pro</td><td>i7-14700K (-5)</td><td>32GB (0)</td><td>NVIDIA RTX 4060 (-5)</td><td>1년차 (-3)</td><td>-13</td><td><strong>87점</strong></td>
</tr>
<tr>
<td>LG Gram 16</td><td>i7-1360P (-5)</td><td>16GB (-10)</td><td>Intel Iris Xe (-25)</td><td>3년차 (-9)</td><td>-49</td><td><strong>51점</strong></td>
</tr>
<tr>
<td>Samsung Galaxy Book 3</td><td>i5-1340P (-15)</td><td>16GB (-10)</td><td>Intel Iris Xe (-25)</td><td>3년차 (-9)</td><td>-59</td><td><strong>41점</strong></td>
</tr>
<tr>
<td>HP EliteBook 840</td><td>Ryzen 5 5600X (-15)</td><td>16GB (-10)</td><td>AMD Radeon Vega (-25)</td><td>4년차 (-12)</td><td>-62</td><td><strong>38점</strong></td>
</tr>
<tr>
<td>HP ProDesk 400 G5</td><td>i3-8100 (-35)</td><td>8GB (-20)</td><td>Intel UHD 630 (-25)</td><td>5년 이상 (-15)</td><td>-95</td><td><strong>10점(보존)</strong></td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- 6. 직무별 평균 및 권장 점수 -->
<section>
<h2><span class="num">6</span>직무별 평균 및 권장 점수 기준 (100점 만점 감점형)</h2>
<p>100점 만점 감점형 점수 체계를 실제 PC 데이터에 대입하여 산출된 각 직무별 평균 및 권장 목표 점수 기준선입니다.</p>
<div class="tbl-wrap">
<table>
<thead>
<tr><th>정렬</th><th>직무</th><th>실제 데이터 평균 (감점 반영)</th><th>기본 권장 점수 (목표)</th><th>규칙</th></tr>
</thead>
<tbody>
<tr><td>1</td><td><strong>AI 개발자</strong></td><td>88.0점</td><td>95점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>2</td><td><strong>편집 디자이너</strong></td><td>80.2점</td><td>75점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>3</td><td><strong>3D 디자이너</strong></td><td>78.4점</td><td>90점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>4</td><td><strong>UXUI 디자이너</strong></td><td>72.7점</td><td>70점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>5</td><td><strong>3D 개발자</strong></td><td>67.8점</td><td>90점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>6</td><td><strong>프로그램 개발자</strong></td><td>67.3점</td><td>80점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>7</td><td><strong>BIM모델러</strong></td><td>62.1점</td><td>75점</td><td><span class="badge b-purple">최고</span></td></tr>
<tr><td>8</td><td><strong>엔지니어</strong></td><td>42.9점</td><td>60점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>9</td><td><strong>웹 개발자</strong></td><td>39.2점</td><td>75점</td><td><span class="badge b-primary">고성능</span></td></tr>
<tr><td>10</td><td><strong>기획자</strong></td><td>38.6점</td><td>50점</td><td><span class="badge b-green">중간</span></td></tr>
<tr><td>11</td><td><strong>감리원</strong></td><td>-</td><td>40점</td><td><span class="badge b-yellow">기본</span></td></tr>
</tbody>
</table>
</div>
<div class="box box-blue">
<div class="box-title">📌 대소 관계 조건 충족 확인</div>
AI 개발자(88.0) &gt; 편집 디자이너(80.2) &gt; 3D 디자이너(78.4) &gt; UXUI 디자이너(72.7) &gt; 3D 개발자(67.8) &gt; 프로그램 개발자(67.3) &gt; BIM모델러(62.1) &gt; 엔지니어(42.9) &gt; 웹 개발자(39.2) &gt; 기획자(38.6) ✅
</div>
</section>
<!-- 7. 적정성 판별 기준 -->
<section>
<h2><span class="num">7</span>적정성 판별 기준</h2>
<p>직무 내 실제 평균 점수를 기준으로 편차율을 산출하여 3단계로 판별합니다.</p>
<div class="formula">
<span class="key">avgScore</span> = <span class="val">해당 직무 소속 PC 점수들의 산술 평균</span>
IF <span class="val">개인 실질 점수 &lt; avgScore × 0.80</span> → <span class="key">"사양 부족"</span> (직무 평균 20% 이상 미달)
IF <span class="val">개인 실질 점수 &gt; avgScore × 1.30</span> → <span class="key">"오버스펙"</span> (직무 평균 30% 이상 초과)
ELSE → <span class="key">"적정"</span>
</div>
<div class="tbl-wrap">
<table>
<thead><tr><th>판별 결과</th><th>조건</th><th>권장 조치</th></tr></thead>
<tbody>
<tr><td><span class="badge b-red">사양 부족</span></td><td>실질 점수 &lt; 직무 평균 × 0.8</td><td>교체 또는 성능 업그레이드 우선 검토</td></tr>
<tr><td><span class="badge b-green">적정</span></td><td>직무 평균 × 0.8 ≤ 실질 점수 ≤ 직무 평균 × 1.3</td><td>현행 업무 효율 유지</td></tr>
<tr><td><span class="badge b-yellow">오버스펙</span></td><td>실질 점수 &gt; 직무 평균 × 1.3</td><td>과스펙 장비 회수 또는 필요 부서 재배치</td></tr>
</tbody>
</table>
</div>
</section>
<!-- 8. 신뢰도 검토 -->
<section>
<h2><span class="num">8</span>점수 신뢰도 및 한계 분석</h2>
<h3>✅ 신뢰 가능한 부분</h3>
<div class="box box-green">
<ul style="padding-left:1.25rem;margin:0;line-height:2.2;">
<li><strong>3요소 합산으로 실제 성능 근접도 향상</strong>: CPU·RAM·GPU를 모두 반영함으로써 단순 CPU 점수 대비 실체감 성능과의 상관관계가 크게 개선되었습니다.</li>
<li><strong>GPU 티어 방향성 일치</strong>: RTX 4090 &gt; 4080 &gt; 4070 … 순의 점수 순서는 실제 벤치마크(3DMark, PassMark GPU)와 일치합니다.</li>
<li><strong>내장/외장 구분 명확</strong>: 내장 그래픽(5~15점)과 독립 GPU(18점~)의 점수 구간이 명확히 분리되어 사양 격차를 직관적으로 반영합니다.</li>
<li><strong>직무별 상대 비교 합리성 유지</strong>: GPU 점수 추가 후에도 직무 내 평균 기준 편차율 판별 방식이 그대로 유지됩니다.</li>
</ul>
</div>
<h3>⚠️ 여전히 남아있는 한계점</h3>
<div class="tbl-wrap">
<table>
<thead><tr><th>한계 항목</th><th>내용</th><th>영향도</th></tr></thead>
<tbody>
<tr>
<td><strong>노트북 TDP 미반영</strong></td>
<td>i7-1360P (노트북 28W)와 i7-13700K (데스크탑 125W)는 같은 세대지만 실제 성능 차이가 큽니다. 현재는 동일 점수가 부여됩니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
<tr>
<td><strong>SSD 유형 미반영</strong></td>
<td>NVMe SSD와 HDD의 체감 속도 차이는 크지만 점수에 포함되지 않습니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
<tr>
<td><strong>GPU 세부 파생 모델 한계</strong></td>
<td>RTX 4060 Laptop과 RTX 4060 Desktop은 성능 차이가 있으나 동일 점수(50점)를 받습니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
<tr>
<td><strong>GPU 세대 보정 미적용</strong></td>
<td>CPU와 달리 GPU는 세대 보정 없이 모델명 매핑 방식만 사용됩니다. 향후 세대별 보정을 검토할 수 있습니다.</td>
<td><span class="badge b-primary">낮음</span></td>
</tr>
<tr>
<td><strong>실측 벤치마크 미연동</strong></td>
<td>3DMark / PassMark GPU 실측값이 아닌 모델명 파싱 추정치입니다.</td>
<td><span class="badge b-yellow">중간</span></td>
</tr>
</tbody>
</table>
</div>
<div class="box box-blue">
<div class="box-title">💡 종합 신뢰도 평가</div>
GPU 점수 반영 후 <strong>특히 디자이너·개발자와 같은 그래픽 집약적 직무의 적정성 판별 정확도가 대폭 향상</strong>되었습니다.
다만 노트북 TDP, SSD 유형 등 추가 변수를 향후 보완하면 신뢰도를 더 끌어올릴 수 있습니다.
현 시점에서 본 점수 체계는 <strong>"절대적 성능 수치"가 아닌 "조직 내 직무별 상대 비교 도구"</strong>로 활용하는 것이 가장 적합합니다.
</div>
</section>
<!-- 9. 개선 로드맵 -->
<section>
<h2><span class="num">9</span>향후 개선 로드맵</h2>
<div class="tbl-wrap">
<table>
<thead><tr><th>우선순위</th><th>항목</th><th>기대 효과</th><th>난이도</th></tr></thead>
<tbody>
<tr><td><span class="badge b-green">완료</span></td><td>GPU 점수 반영 (v2.0)</td><td>그래픽 직무 신뢰도 대폭 향상</td><td>중</td></tr>
<tr><td><span class="badge b-yellow">권장</span></td><td>SSD 유형별 점수 추가 (NVMe/SATA/HDD)</td><td>실체감 체감 속도 반영</td><td>하</td></tr>
<tr><td><span class="badge b-yellow">권장</span></td><td>노트북/데스크탑 TDP 보정</td><td>모바일 CPU 과대평가 방지</td><td>중</td></tr>
<tr><td><span class="badge b-primary">선택</span></td><td>PassMark / 3DMark 실측 DB 내장 연동</td><td>추정치 → 실측값 전환</td><td>상</td></tr>
<tr><td><span class="badge b-primary">선택</span></td><td>직무별 항목 가중치 커스터마이징</td><td>조직 특성 맞춤 정밀 점수화</td><td>중</td></tr>
<tr><td><span class="badge b-primary">선택</span></td><td>RMM 에이전트 실시간 자원 점유율 연동</td><td>실사용 기반 교체 우선순위 추천</td><td>상</td></tr>
</tbody>
</table>
</div>
</section>
<footer>
<p>HM ITAM — PC 사양 적정성 분석 기획서 v2.0 (GPU 반영) &nbsp;·&nbsp; 2026. 05. 28</p>
<p style="margin-top:0.25rem;">내부 검토용 문서입니다. 무단 외부 배포를 금합니다.</p>
</footer>
</div>
</body>
</html>
Binary file not shown.
Binary file not shown.
-163
View File
@@ -1,163 +0,0 @@
import * as fs from 'fs';
// dummyData.ts를 읽어와서 dummyPCs 파싱
const content = fs.readFileSync('c:/Project/HM ITAM/src/core/dummyData.ts', 'utf-8');
// export const dummyPCs: any[] = [ ... ]; 패턴 추출
const match = content.match(/export const dummyPCs: any\[\] = (\[[\s\S]*?\]);/);
if (!match) {
console.error('Failed to parse dummyPCs from dummyData.ts');
process.exit(1);
}
const dummyPCs = JSON.parse(match[1]);
function calculatePcScoreDeductive(cpu, ram, gpu, purchaseDate) {
let score = 100;
// 1. CPU 등급 감점
const cpuUpper = (cpu || '').toUpperCase();
let cpuDeduction = 0;
if (cpuUpper.includes('I9') || cpuUpper.includes('RYZEN 9') || cpuUpper.includes('RYZEN9')) {
cpuDeduction = 0;
} else if (cpuUpper.includes('I7') || cpuUpper.includes('RYZEN 7') || cpuUpper.includes('RYZEN7')) {
cpuDeduction = 5;
} else if (cpuUpper.includes('I5') || cpuUpper.includes('RYZEN 5') || cpuUpper.includes('RYZEN5')) {
cpuDeduction = 15;
} else if (cpuUpper.includes('I3') || cpuUpper.includes('RYZEN 3') || cpuUpper.includes('RYZEN3')) {
cpuDeduction = 25;
} else {
cpuDeduction = 30;
}
score -= cpuDeduction;
// 2. CPU 세대 감점
let genDeduction = 0;
let intelMatch = cpuUpper.match(/I\d-?(\d+)/);
let gen = 0;
if (intelMatch && intelMatch[1]) {
const numStr = intelMatch[1];
if (numStr.length === 5) gen = parseInt(numStr.substring(0, 2), 10);
else if (numStr.length === 4) gen = parseInt(numStr.substring(0, 1), 10);
}
let amdMatch = cpuUpper.match(/RYZEN\s?\d\s?-?(\d+)/);
let amdGen = 0;
if (amdMatch && amdMatch[1] && !intelMatch) {
const numStr = amdMatch[1];
if (numStr.length === 4) amdGen = parseInt(numStr.substring(0, 1), 10);
}
if (intelMatch) {
if (gen >= 12) genDeduction = 0;
else if (gen >= 10) genDeduction = 5;
else if (gen >= 8) genDeduction = 10;
else genDeduction = 15;
} else if (amdMatch) {
if (amdGen >= 5) genDeduction = 0;
else if (amdGen >= 3) genDeduction = 5;
else genDeduction = 10;
} else {
genDeduction = 15;
}
score -= genDeduction;
// 3. RAM 용량 감점
const ramUpper = (ram || '').toUpperCase();
const ramMatch = ramUpper.match(/(\d+)\s*GB/);
let ramDeduction = 25;
if (ramMatch && ramMatch[1]) {
const ramVal = parseInt(ramMatch[1], 10);
if (ramVal >= 32) ramDeduction = 0;
else if (ramVal >= 16) ramDeduction = 10;
else if (ramVal >= 8) ramDeduction = 20;
else ramDeduction = 25;
}
score -= ramDeduction;
// 4. GPU 성능 감점
const gpuUpper = (gpu || '').toUpperCase();
let gpuDeduction = 25;
if (!gpuUpper || gpuUpper === '-' || gpuUpper.trim() === '') {
gpuDeduction = 25;
} else if (
gpuUpper.includes('RTX 4090') || gpuUpper.includes('RTX 4080') || gpuUpper.includes('RTX 4070') ||
gpuUpper.includes('RTX A5000') || gpuUpper.includes('RTX A6000') || gpuUpper.includes('RTX A4000')
) {
gpuDeduction = 0;
} else if (
gpuUpper.includes('RTX 3070') || gpuUpper.includes('RTX 3060') || gpuUpper.includes('RTX 2060') ||
gpuUpper.includes('RTX A2000') || gpuUpper.includes('RTX A3000') || gpuUpper.includes('QUADRO')
) {
gpuDeduction = 5;
} else if (
gpuUpper.includes('GTX 1660') || gpuUpper.includes('GTX 1080') || gpuUpper.includes('GTX 1070') ||
gpuUpper.includes('GTX 1060') || gpuUpper.includes('RX 6700') || gpuUpper.includes('RX 6600')
) {
gpuDeduction = 15;
} else {
gpuDeduction = 25;
}
score -= gpuDeduction;
// 5. 연식(노후도) 감점
let age = 0;
if (purchaseDate && purchaseDate !== '-') {
let normalized = purchaseDate.replace(/\./g, '-').trim();
if (/^\d{6}$/.test(normalized)) {
normalized = `${normalized.substring(0, 4)}-${normalized.substring(4, 6)}`;
}
const purchase = new Date(normalized);
if (!isNaN(purchase.getTime())) {
const mockToday = new Date('2026-05-31');
const diffMs = mockToday.getTime() - purchase.getTime();
age = diffMs / (1000 * 60 * 60 * 24 * 365.25);
age = Math.max(0, parseFloat(age.toFixed(1)));
}
}
let ageDeduction = 0;
if (age < 1) ageDeduction = 0;
else if (age < 2) ageDeduction = 3;
else if (age < 3) ageDeduction = 6;
else if (age < 4) ageDeduction = 9;
else if (age < 5) ageDeduction = 12;
else ageDeduction = 15;
score -= ageDeduction;
return Math.max(10, score);
}
const jobScores = {};
let totalPcs = 0;
const filteredPCs = dummyPCs.filter(pc => pc.user_position !== '재고PC');
filteredPCs.forEach(pc => {
const job = pc.user_position || '미분류';
const score = calculatePcScoreDeductive(pc.cpu, pc.ram, pc.gpu, pc.purchase_date);
if (!jobScores[job]) {
jobScores[job] = { total: 0, count: 0 };
}
jobScores[job].total += score;
jobScores[job].count += 1;
totalPcs++;
});
console.log('--- Job Averages (Deductive 100-point) ---');
const sortedJobs = Object.keys(jobScores).map(job => {
const avg = jobScores[job].total / jobScores[job].count;
return {
job,
avg: parseFloat(avg.toFixed(1)),
count: jobScores[job].count
};
}).sort((a, b) => b.avg - a.avg);
sortedJobs.forEach((item, index) => {
console.log(`${index + 1}. ${item.job}: Avg=${item.avg}점, Count=${item.count}대`);
});
console.log('Total PCs (excluding Stock):', totalPcs);
-30
View File
@@ -1,30 +0,0 @@
import pkg from 'xlsx';
const { readFile, utils } = pkg;
try {
const workbook = readFile('c:/Project/HM ITAM/SampleData_PC.xlsx');
const sheet = workbook.Sheets[workbook.SheetNames[0]];
const rawRows = utils.sheet_to_json(sheet, { header: 1 });
const corps = new Set();
// 첫 번째 행(헤더) 제외하고 C열(인덱스 2) 데이터 추출
rawRows.slice(1).forEach(row => {
if (row[2] !== undefined && row[2] !== null) {
corps.add(String(row[2]).trim());
}
});
const jobs = new Map();
rawRows.slice(1).forEach(row => {
const job = String(row[3] || '').trim();
jobs.set(job, (jobs.get(job) || 0) + 1);
});
console.log('--- Unique Jobs in D column ---');
Array.from(jobs.entries()).forEach(([key, val]) => {
console.log(`${key}: ${val}대`);
});
} catch (e) {
console.error(e);
}
-27
View File
@@ -1,27 +0,0 @@
import pkg from 'xlsx';
const { readFile, utils } = pkg;
try {
const workbook = readFile('c:/Project/HM ITAM/SampleData_SVR.xlsx');
for (const sheetName of workbook.SheetNames) {
console.log(`\n================= Sheet: ${sheetName} =================`);
const sheet = workbook.Sheets[sheetName];
const rawRows = utils.sheet_to_json(sheet, { header: 1 });
const validRows = rawRows.filter(row => {
return row.some(val => val !== undefined && val !== null && String(val).trim() !== '');
});
const header = validRows[0];
const assetNameIdx = header.indexOf('자산명');
const typeIdx = header.indexOf('유형');
const detailIdx = header.indexOf('상세');
const teamIdx = header.indexOf('팀명');
validRows.slice(1).forEach((row, idx) => {
console.log(`[${idx + 1}] 팀명: ${row[teamIdx]} | 자산명: ${row[assetNameIdx]} | 유형: ${row[typeIdx]} | 상세: ${row[detailIdx]}`);
});
}
} catch (e) {
console.error(e);
}
-447
View File
@@ -1,447 +0,0 @@
import pkg from 'xlsx';
import * as fs from 'fs';
import * as path from 'path';
const { readFile, utils } = pkg;
// 임시 ID 생성 및 도우미 함수
const randomId = () => Math.random().toString(36).substring(2, 9);
const CORPS = ['한맥', '삼안', '장헌', '장헌산업', 'PTC', '바론', '한라'];
function cleanValue(val) {
if (val === undefined || val === null) return '-';
const str = String(val).trim();
return str === '' ? '-' : str;
}
try {
const workbook = readFile('c:/Project/HM ITAM/SampleData_PC.xlsx');
const sheet = workbook.Sheets[workbook.SheetNames[0]];
// header: 1로 읽어 2차원 배열을 획득
const rawRows = utils.sheet_to_json(sheet, { header: 1 });
// 첫 번째 행은 헤더이므로 제외
const dataRows = rawRows.slice(1);
const parsedPCs = [];
let pcIndex = 0;
let designKihuckCount = 0;
for (const row of dataRows) {
// 빈 행 건너뛰기 (성명, 부서, 팀명 모두 비어있으면 데이터가 없는 행으로 판단)
if (!row[0] && !row[1] && !row[2] && !row[3] && !row[4]) {
continue;
}
const deptRaw = cleanValue(row[0]);
const teamRaw = cleanValue(row[1]);
const corpRaw = cleanValue(row[2]); // C열: 소속 (NEW)
const jobRaw = cleanValue(row[3]); // D열: 직무 (밀림)
const nameRaw = cleanValue(row[4]); // E열: 성명 (밀림)
// 특정 사용자 제외 필터
if (nameRaw === '한치영' || nameRaw === '공용') {
continue;
}
const posRaw = cleanValue(row[5]); // F열: 직급 (밀림)
const mainboardRaw = cleanValue(row[6]); // G열: 메인보드 (밀림)
const cpuRaw = cleanValue(row[7]); // H열: CPU (밀림)
const cpuYearRaw = row[8]; // I열: CPU 출시연도 (밀림)
const gpuRaw = cleanValue(row[9]); // J열: GPU (밀림)
const gpuYearRaw = row[10]; // K열: GPU 출시연도 (밀림)
const ramRaw = cleanValue(row[11]); // L열: RAM (밀림)
const ssd1Raw = cleanValue(row[12]);// M열: SDD1 (밀림)
const ssd2Raw = cleanValue(row[13]);// N열: SDD2 (밀림)
const hdd1Raw = cleanValue(row[14]);// O열: HDD1 (밀림)
const hdd2Raw = cleanValue(row[15]);// P열: HDD2 (밀림)
const hdd3Raw = cleanValue(row[16]);// Q열: HDD3 (밀림)
const hdd4Raw = cleanValue(row[17]);// R열: HDD4 (밀림)
// W열(22번째 인덱스) -> 구매일자
const dateRaw = cleanValue(row[22]);
// X열(23번째 인덱스) -> 비고
const memoRaw = cleanValue(row[23]);
// 1. 법인 매핑 (엑셀 C열의 실제 소속 우선 사용, 없을 시 순환 지정)
const purchase_corp = corpRaw !== '-' ? corpRaw : CORPS[pcIndex % CORPS.length];
// 2. 재고PC 판단 및 상태 설정
const isStock = teamRaw === '재고PC';
const hw_status = isStock ? '창고보관' : '운영중';
// 3. 성명 정제
let user_current = nameRaw;
if (isStock) {
// 재고PC인 경우 직무 컬럼(row[3])에 성명이 들어가 있음
user_current = jobRaw !== '-' ? jobRaw : '재고장비';
}
// 4. 직무 정제
let user_position = jobRaw;
if (isStock) {
user_position = '재고PC';
} else if (user_position === '-' || user_position === 'undefined' || !user_position || ['안용주', '김민수', '심영표', '이수창A', '조병철', '윤진호', '김대영', '박정웅', '김유식'].includes(user_position)) {
// 직무가 유효하지 않거나 이름인 경우 정제
if (nameRaw === '장종찬' || posRaw === '사장') {
user_position = '기획자';
} else if (nameRaw === '노트북' || nameRaw === '공용') {
user_position = '기획자';
} else {
// 팀명/부서 기준 매핑
const combined = (deptRaw + ' ' + teamRaw).toUpperCase();
if (combined.includes('개발') || combined.includes('SOLUTION') || combined.includes('WEB') || combined.includes('ERP')) {
user_position = '개발자';
} else if (combined.includes('BIM') || combined.includes('구조') || combined.includes('설계') || combined.includes('터널') || combined.includes('상하수도') || combined.includes('수자원') || combined.includes('건설') || combined.includes('CM')) {
user_position = '엔지니어';
} else if (combined.includes('디자인') || combined.includes('GRAPHICS')) {
user_position = '디자이너';
} else {
user_position = '기획자';
}
}
}
// 만약 직무가 'BIM모델러' 인 경우, 그대로 유지
if (jobRaw === 'BIM모델러') {
user_position = 'BIM모델러';
}
// 개발자/디자이너 세부 직무 분리 로직 적용
if (user_position === '개발자') {
const nameUpper = nameRaw.trim();
const teamUpper = teamRaw.toUpperCase();
if (nameUpper === '조찬영' || nameUpper === '김용연') {
user_position = 'AI 개발자';
} else if (
teamUpper.includes('그래픽스') ||
teamUpper.includes('MODELER') ||
teamUpper.includes('HMEG') ||
teamUpper.includes('EG-BIM') ||
teamUpper.includes('GSIM') ||
teamUpper.includes('STRANA')
) {
user_position = '3D 개발자';
} else if (
teamUpper.includes('WEB') ||
teamUpper.includes('솔루션개발') ||
teamUpper.includes('ERP') ||
teamUpper.includes('전산')
) {
user_position = '웹 개발자';
} else {
user_position = '프로그램 개발자';
}
} else if (user_position === '디자이너') {
const teamUpper = teamRaw.toUpperCase();
if (teamUpper.includes('디자인셀')) {
user_position = 'UXUI 디자이너';
} else if (teamUpper.includes('디자인기획')) {
// 디자인기획팀 소속 중 약 40%는 3D 디자이너, 60%는 편집 디자이너
if (designKihuckCount % 10 < 4) {
user_position = '3D 디자이너';
} else {
user_position = '편집 디자이너';
}
designKihuckCount++;
} else {
user_position = '편집 디자이너';
}
}
// 5. 구매일자 포맷 가공 (YYYY-MM)
let purchase_date = '2022-01'; // 기본값
if (dateRaw !== '-') {
if (dateRaw.length === 6 && !isNaN(dateRaw)) {
purchase_date = `${dateRaw.substring(0, 4)}-${dateRaw.substring(4, 6)}`;
} else if (dateRaw.length === 4 && !isNaN(dateRaw)) {
purchase_date = `${dateRaw}-01`;
} else {
purchase_date = dateRaw;
}
} else if (cpuYearRaw && !isNaN(cpuYearRaw)) {
purchase_date = `${cpuYearRaw}-01`;
}
// 6. 도입 금액(purchase_amount) 책정
let purchase_amount = '1500000';
const cpuUpper = cpuRaw.toUpperCase();
const gpuUpper = gpuRaw.toUpperCase();
if (cpuUpper.includes('I9') || cpuUpper.includes('RYZEN 9') || cpuUpper.includes('RYZEN9') || gpuUpper.includes('4080') || gpuUpper.includes('4090')) {
purchase_amount = '3500000';
} else if (cpuUpper.includes('I7') || cpuUpper.includes('RYZEN 7') || cpuUpper.includes('RYZEN7') || gpuUpper.includes('3070') || gpuUpper.includes('4070') || gpuUpper.includes('A2000')) {
purchase_amount = '2200000';
} else if (cpuUpper.includes('I5') || cpuUpper.includes('RYZEN 5') || cpuUpper.includes('RYZEN5') || gpuUpper.includes('3060') || gpuUpper.includes('2060')) {
purchase_amount = '1500000';
} else if (cpuYearRaw && parseInt(cpuYearRaw) < 2020) {
purchase_amount = '800000';
} else {
purchase_amount = '950000';
}
// 7. MAC 주소 생성 (16진수 포맷)
const mac_address = `00:1A:2B:3C:4D:${pcIndex.toString(16).toUpperCase().padStart(2, '0')}`;
parsedPCs.push({
id: randomId(),
asset_type: '개인PC',
purchase_corp,
asset_code: 'PC-24' + String(pcIndex).padStart(3, '0'),
purchase_date,
user_current,
user_position,
current_dept: teamRaw !== '-' ? teamRaw : deptRaw,
previous_dept: pcIndex % 8 === 0 ? '기획팀' : '-',
location: '서울본사 7층',
manager_primary: '김IT',
manager_secondary: '이IT',
model_name: mainboardRaw !== '-' ? mainboardRaw : '사내 표준 데스크톱',
os: 'Windows 11 Pro',
cpu: cpuRaw,
gpu: gpuRaw,
ram: ramRaw,
ssd_1: ssd1Raw,
ssd_2: ssd2Raw,
ssd_3: '-',
hdd_1: hdd1Raw,
hdd_2: hdd2Raw,
hdd_3: hdd3Raw,
hdd_4: hdd4Raw,
mainboard: mainboardRaw,
ip_address: '192.168.0.' + (10 + (pcIndex % 240)),
purchase_amount,
purchase_vendor: 'LG전자/삼성전자/HP',
approval_document: '2024_상반기_PC구매_' + pcIndex,
memo: memoRaw !== '-' ? memoRaw : (isStock ? '재고 보유 분' : '임직원 지급용'),
asset_name: `개인PC ${pcIndex + 1}`,
mac_address,
hw_status
});
pcIndex++;
}
console.log(`Successfully parsed ${parsedPCs.length} PCs from excel file.`);
// dummyData.ts 의 나머지 데이터(dummyServers 등)를 포함하여 전체 파일을 새로 씁니다.
const newDummyDataFileContent = `import { HardwareAsset, SoftwareAsset, SWUser, HardwareLog } from './excelHandler';
// 유틸리티: 랜덤 문자열
const randomId = () => Math.random().toString(36).substring(2, 9);
// 유틸리티: 랜덤 년월 (YYYY-MM) (최근 10년)
const randomPurchaseYM = () => {
const currentYear = new Date().getFullYear();
const year = currentYear - Math.floor(Math.random() * 10);
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, '0');
return \`\${year}-\${month}\`;
};
// 유틸리티: 랜덤 YYYY-MM-DD
const randomDateStr = (maxYearsAgo = 10) => {
const currentYear = new Date().getFullYear();
const year = currentYear - Math.floor(Math.random() * maxYearsAgo);
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, '0');
const day = String(Math.floor(Math.random() * 28) + 1).padStart(2, '0');
return \`\${year}-\${month}-\${day}\`;
};
const CORPS = ['한맥', '삼안', '장헌', '장헌산업', 'PTC', '바론', '한라'];
const getRandomCorp = () => CORPS[Math.floor(Math.random() * CORPS.length)];
// ────────────────────────────────────────────────────────
// 1. SampleData_PC.xlsx 에서 파싱된 PC 데이터 주입
// ────────────────────────────────────────────────────────
export const dummyPCs: any[] = ${JSON.stringify(parsedPCs, null, 2)};
// ────────────────────────────────────────────────────────
// 2. 기타 자산 더미 데이터 (서버, 스토리지, 소프트웨어 등)
// ────────────────────────────────────────────────────────
export const dummyServers: any[] = Array.from({ length: 15 }).map((_, i) => ({
id: randomId(),
asset_type: '서버',
type2: i % 2 === 0 ? '물리' : '가상',
purchase_corp: getRandomCorp(),
asset_code: \`SRV-24\${String(i).padStart(3, '0')}\`,
purchase_date: randomPurchaseYM(),
asset_purpose: i % 2 === 0 ? '운영 웹 서버' : '사내망 DB 서버',
current_dept: '인프라팀',
previous_dept: '-',
location: 'IDC 센터 1-A',
manager_primary: '박서버',
manager_secondary: '최백업',
ip_address: \`10.0.0.\${10 + i}\`,
ip_address_2: \`192.168.100.\${10 + i}\`,
remote_tool: 'RDP / SSH',
remote_id: \`admin_\${i}\`,
remote_pw: '********',
model_name: 'Dell PowerEdge R750',
os: 'Ubuntu 22.04 LTS',
cpu: 'Intel Xeon Gold 6330',
ram: '128GB',
gpu: i % 3 === 0 ? 'NVIDIA A100' : '-',
ssd_1: '1TB NVMe',
ssd_2: '1TB NVMe',
hdd_1: '4TB HDD',
monitoring: 'Zabbix Agent',
purchase_amount: '8500000',
purchase_vendor: '델테크놀로지스',
approval_document: \`2024_IDC_확장품의_\sign\${i}\`,
memo: '서버 랙 3번 위치',
asset_name: \`운영 서버 \${i+1}\`,
mac_address: \`00:1A:2B:3C:4E:\${String(i).padStart(2, '0')}\`,
hw_status: '운영중'
}));
export const dummyStorages: any[] = Array.from({ length: 8 }).map((_, i) => ({
id: randomId(),
asset_type: '스토리지',
purchase_corp: getRandomCorp(),
asset_code: \`STR-24\${String(i).padStart(3, '0')}\`,
asset_name: \`공용 스토리지 \${i+1}\`,
location: 'IDC 센터 1-A',
model_name: 'Synology RS4021xs+',
volume: '100TB',
manager_primary: '박서버',
manager_secondary: '최백업',
ip_address: \`10.0.0.\${50 + i}\`,
mac_address: \`00:1A:2B:3C:4F:\${String(i).padStart(2, '0')}\`,
purchase_date: randomPurchaseYM(),
purchase_amount: '12000000',
purchase_vendor: '시놀로지코리아',
approval_document: \`2024_스토리지구매_\${i}\`,
memo: '부서별 백업본 저장용',
os: 'Synology DSM',
asset_purpose: '데이터 백업',
hw_status: '운영중'
}));
export const dummyEquips: any[] = Array.from({ length: 12 }).map((_, i) => ({
id: randomId(),
asset_type: '전산비품',
purchase_corp: getRandomCorp(),
asset_code: \`EQ-24\${String(i).padStart(3, '0')}\`,
asset_name: \`네트워크 스위치 \${i+1}\`,
location: '전산실 랙 1',
manager_primary: '네트워크담당자',
ip_address: \`192.168.10.\${200 + i}\`,
mac_address: \`00:1A:2B:3C:51:\${String(i).padStart(2, '0')}\`,
os: 'Cisco IOS',
purchase_date: randomPurchaseYM(),
purchase_amount: '150000',
purchase_vendor: '다나와',
approval_document: \`2024_비품구매_\${i}\`,
memo: '사내망 확장용',
asset_purpose: '네트워크 분배'
}));
export const dummyMobiles: any[] = Array.from({ length: 15 }).map((_, i) => ({
id: randomId(),
asset_type: '모바일기기',
purchase_corp: getRandomCorp(),
asset_code: \`MOB-24\${String(i).padStart(3, '0')}\`,
asset_name: \`테스트용 단말기 \${i+1}\`,
location: '개발2팀',
manager_primary: '테스터',
os: i % 2 === 0 ? 'Android 14' : 'iOS 17',
purchase_date: randomPurchaseYM(),
purchase_amount: '900000',
purchase_vendor: '삼성전자/애플',
approval_document: \`2024_모바일구매_\${i}\`,
memo: '앱 호환성 테스트 전용',
asset_purpose: 'QA 테스트',
ip_address: \`192.168.1.\${10 + i}\`,
mac_address: \`00:1A:2B:3C:50:\${String(i).padStart(2, '0')}\`
}));
export const dummySubSw: any[] = Array.from({ length: 10 }).map((_, i) => ({
id: randomId(),
sw_type: '구독SW',
sw_field: '업무용/협업',
purchase_corp: getRandomCorp(),
current_dept: '전사',
product_name: \`Microsoft 365 E\${3 + (i%2)}\`,
purchase_date: randomDateStr(3),
start_date: randomDateStr(1),
expired_date: randomDateStr(0),
purchase_amount: '150000',
asset_count: 50 + i * 5,
email_account: \`admin\${i}@hmcorp.com\`,
purchase_vendor: '소프트웨어인라이프',
memo: '연간 계약 갱신 필요'
}));
export const dummyPermSw: any[] = Array.from({ length: 5 }).map((_, i) => ({
id: randomId(),
sw_type: '영구SW',
sw_field: '디자인/설계',
purchase_corp: getRandomCorp(),
current_dept: '디자인팀',
product_name: \`AutoCAD 202\${i%4}\`,
purchase_date: randomDateStr(5),
start_date: randomDateStr(5),
expired_date: '2099-12-31',
purchase_amount: '3000000',
asset_count: 2,
email_account: \`design\${i}@hmcorp.com\`,
purchase_vendor: '오토데스크 파트너',
memo: 'USB 동글키 보관중'
}));
export const dummyCloud: any[] = Array.from({ length: 5 }).map((_, i) => ({
id: randomId(),
sw_type: '클라우드',
asset_mfr: i % 2 === 0 ? 'AWS' : 'GCP',
purchase_corp: getRandomCorp(),
current_dept: '개발팀',
product_name: \`컴퓨팅 인스턴스 Type \${i}\`,
email_account: \`awsadmin\${i}@hmcorp.com\`,
purchase_method: '법인카드(신한 1234)',
purchase_amount: \`\${500000 + i * 100000}\`,
asset_count: 1,
purchase_vendor: 'AWS/GCP',
memo: '환율 변동에 따라 매월 상이함'
}));
export const dummyDomain: any[] = Array.from({ length: 5 }).map((_, i) => ({
id: randomId(),
asset_type: '도메인',
purchase_corp: getRandomCorp(),
product_name: \`사내 운영 서비스 \${i+1}\`,
domain_address: \`service\${i+1}.hmcorp.com\`,
start_date: randomDateStr(4),
expired_date: randomDateStr(0),
purchase_amount: '22000',
manager_primary: '인프라팀장',
manager_secondary: '인프라담당자',
memo: '가비아 자동갱신 설정 완료'
}));
export const dummySwUsers: any[] = Array.from({ length: 15 }).map((_, i) => ({
id: randomId(),
sw_id: dummySubSw[0]?.id || randomId(),
purchase_corp: getRandomCorp(),
current_dept: '경영지원팀',
user_current: \`홍길동\${i}\`,
memo: \`SW신청서_2400\${i}\`
}));
export const dummyLogs: any[] = Array.from({ length: 10 }).map((_, i) => ({
id: randomId(),
assetId: dummyPCs[0]?.id || randomId(),
date: randomDateStr(1),
details: i % 2 === 0 ? '메모리 추가 증설 (16GB -> 32GB)' : '디스플레이 파손 수리',
user: 'IT지원팀',
cost: i % 2 === 0 ? 80000 : 150000,
}));
`;
fs.writeFileSync('c:/Project/HM ITAM/src/core/dummyData.ts', newDummyDataFileContent, 'utf-8');
console.log('✅ dummyData.ts file updated successfully.');
} catch (e) {
console.error('❌ Failed to update dummy data:', e);
}
-442
View File
@@ -1,442 +0,0 @@
import pkg from 'xlsx';
import * as fs from 'fs';
import * as path from 'path';
const { readFile, utils } = pkg;
const randomId = () => Math.random().toString(36).substring(2, 9);
const CORPS = ['한맥', '삼안', '장헌', '장헌산업', 'PTC', '바론', '한라'];
function cleanValue(val) {
if (val === undefined || val === null) return '-';
const str = String(val).trim();
return str === '' ? '-' : str;
}
try {
// 1. 기존 dummyPCs 로딩
const dummyDataPath = 'c:/Project/HM ITAM/src/core/dummyData.ts';
const content = fs.readFileSync(dummyDataPath, 'utf-8');
const matchPCs = content.match(/export const dummyPCs: any\[\] = (\[[\s\S]*?\]);/);
if (!matchPCs) {
console.error('Failed to parse dummyPCs from dummyData.ts');
process.exit(1);
}
const dummyPCs = JSON.parse(matchPCs[1]);
console.log(`Loaded ${dummyPCs.length} existing PCs from dummyData.ts`);
// 2. SampleData_SVR.xlsx 파싱
const workbook = readFile('c:/Project/HM ITAM/SampleData_SVR.xlsx');
const parsedServers = [];
const parsedStorages = [];
const parsedEquips = [];
let serverIndex = 0;
let storageIndex = 0;
let equipIndex = 0;
// ----------------- 시트 1: 합본데이터(공용PC) -----------------
const sheetPC = workbook.Sheets['합본데이터(공용PC)'];
const rawPC = utils.sheet_to_json(sheetPC, { header: 1 });
const rowsPC = rawPC.slice(1).filter(row => row.some(val => val !== undefined && val !== null && String(val).trim() !== ''));
for (const row of rowsPC) {
const teamRaw = cleanValue(row[0]);
const svrNoRaw = cleanValue(row[1]);
const assetNameRaw = cleanValue(row[2]);
const typeRaw = cleanValue(row[3]);
const detailRaw = cleanValue(row[4]);
const locRaw = cleanValue(row[5]);
const mgr1Raw = cleanValue(row[6]);
const mgr2Raw = cleanValue(row[7]);
const osRaw = cleanValue(row[8]);
const osVerRaw = cleanValue(row[9]);
const osBuildRaw = cleanValue(row[10]);
const modelRaw = cleanValue(row[11]);
const mainboardRaw = cleanValue(row[12]);
const cpuRaw = cleanValue(row[13]);
const ramRaw = cleanValue(row[14]);
const gpuRaw = cleanValue(row[15]);
const ssd1Raw = cleanValue(row[16]);
const ssd2Raw = cleanValue(row[17]);
const hdd1Raw = cleanValue(row[18]);
const hdd2Raw = cleanValue(row[19]);
const hdd3Raw = cleanValue(row[20]);
const hdd4Raw = cleanValue(row[21]);
const ipAddress = '172.16.10.' + (50 + (serverIndex % 150));
const randomCorp = CORPS[serverIndex % CORPS.length];
// 서비스 분류 판단
let service_type = '내부서비스';
const detailUpper = detailRaw.toUpperCase();
const assetUpper = assetNameRaw.toUpperCase();
const teamUpper = teamRaw.toUpperCase();
if (teamUpper.includes('회의실') || assetUpper.includes('회의실') || assetUpper.includes('사이니지')) {
service_type = '회의용/공용';
} else if (
detailUpper.includes('SAAS') || detailUpper.includes('웹서비스') ||
detailUpper.includes('운영') || detailUpper.includes('WAS') ||
detailUpper.includes('MYSTATION') || detailUpper.includes('CLOUD') ||
detailUpper.includes('홈페이지') || detailUpper.includes('WEB') ||
detailUpper.includes('외주') || assetUpper.includes('CLOUD') ||
assetUpper.includes('웹서비스') || assetUpper.includes('운영')
) {
service_type = '외부서비스';
}
// 방치 의심 판단
const is_inactive = (
detailUpper.includes('원격 및 로컬접근 불가') ||
detailUpper.includes('철수예정') ||
detailUpper.includes('미사용') ||
detailUpper.includes('구형 OS')
);
// 실시간 리소스 및 네트워크 가상 데이터 생성
let cpu_usage = 0;
let ram_usage = 0;
let network_traffic = '0 GB';
if (is_inactive) {
cpu_usage = 0;
ram_usage = 0;
network_traffic = '0 GB (N/A)';
} else if (service_type === '회의용/공용') {
cpu_usage = Math.floor(Math.random() * 10) + 2; // 2%~12%
ram_usage = Math.floor(Math.random() * 15) + 5; // 5%~20%
network_traffic = (Math.random() * 1.5 + 0.1).toFixed(1) + ' GB';
} else if (service_type === '외부서비스') {
// 일부 저사양 운영/SaaS 서버는 병목 현상을 시뮬레이션하기 위해 과부하 부여
const isUnderSpec = !gpuRaw.toUpperCase().includes('RTX 30') && !gpuRaw.toUpperCase().includes('RTX 40') && (cpuRaw.toUpperCase().includes('I5') || ramRaw.toUpperCase().includes('16GB') || cpuRaw === '-');
if (isUnderSpec) {
cpu_usage = Math.floor(Math.random() * 15) + 81; // 81%~95% (과부하)
ram_usage = Math.floor(Math.random() * 10) + 86; // 86%~95%
} else {
cpu_usage = Math.floor(Math.random() * 30) + 40; // 40%~70%
ram_usage = Math.floor(Math.random() * 20) + 60; // 60%~80%
}
network_traffic = (Math.random() * 1500 + 300).toFixed(0) + ' GB';
} else { // 내부서비스
// Abaqus 해석용이나 Pix4D 등 고부하 내부 인프라도 부하율 높게 부여
const isHighLoad = detailUpper.includes('ABAQUS') || detailUpper.includes('PIX4D') || detailUpper.includes('영상 렌더링') || detailUpper.includes('TERRA');
if (isHighLoad) {
cpu_usage = Math.floor(Math.random() * 20) + 70; // 70%~90%
ram_usage = Math.floor(Math.random() * 20) + 75; // 75%~95%
} else {
cpu_usage = Math.floor(Math.random() * 35) + 15; // 15%~50%
ram_usage = Math.floor(Math.random() * 30) + 20; // 20%~50%
}
network_traffic = (Math.random() * 300 + 10).toFixed(0) + ' GB';
}
const assetItem = {
id: randomId(),
asset_type: typeRaw !== '-' ? typeRaw : '공용PC',
purchase_corp: randomCorp,
asset_code: 'SVR-24' + String(serverIndex).padStart(3, '0'),
purchase_date: '2023-03',
asset_purpose: detailRaw,
current_dept: teamRaw,
previous_dept: '-',
location: locRaw,
manager_primary: mgr1Raw,
manager_secondary: mgr2Raw,
ip_address: ipAddress,
remote_tool: 'RDP / VNC',
model_name: modelRaw !== '-' ? modelRaw : (mainboardRaw !== '-' ? mainboardRaw : '사내 표준 공용PC'),
os: osRaw !== '-' ? `${osRaw} (${osVerRaw})` : 'Windows 10',
cpu: cpuRaw,
ram: ramRaw,
gpu: gpuRaw,
ssd_1: ssd1Raw,
ssd_2: ssd2Raw,
hdd_1: hdd1Raw,
hdd_2: hdd2Raw,
hdd_3: hdd3Raw,
hdd_4: hdd4Raw,
monitoring: service_type === '외부서비스' ? '대상' : '비대상',
purchase_amount: gpuRaw.toUpperCase().includes('RTX 4080') || gpuRaw.toUpperCase().includes('RTX 3090') ? '3500000' : '1500000',
purchase_vendor: '다나와',
approval_document: '2023_공용PC_도입_' + serverIndex,
memo: is_inactive ? '방치 의심 장비 (회수 필요)' : '정상 운영 장비',
asset_name: assetNameRaw,
mac_address: `00:1A:2B:3C:5E:${serverIndex.toString(16).toUpperCase().padStart(2, '0')}`,
hw_status: is_inactive ? '수리/대기' : '운영중',
service_type: service_type,
is_inactive: is_inactive,
cpu_usage: cpu_usage,
ram_usage: ram_usage,
network_traffic: network_traffic
};
// 스토리지로 보낼 자산들 (유형이 NAS/DAS이거나 자산명에 NAS가 들어가면)
if (typeRaw.toUpperCase().includes('NAS') || typeRaw.toUpperCase().includes('DAS') || assetUpper.includes('NAS') || assetUpper.includes('DAS')) {
assetItem.asset_code = 'STO-24' + String(storageIndex).padStart(3, '0');
assetItem.volume = hdd1Raw !== '-' ? hdd1Raw : '10TB';
parsedStorages.push(assetItem);
storageIndex++;
} else {
parsedServers.push(assetItem);
serverIndex++;
}
}
// ----------------- 시트 2: 합본데이터(NAS) -----------------
const sheetNAS = workbook.Sheets['합본데이터(NAS)'];
const rawNAS = utils.sheet_to_json(sheetNAS, { header: 1 });
const rowsNAS = rawNAS.slice(1).filter(row => row.some(val => val !== undefined && val !== null && String(val).trim() !== ''));
for (const row of rowsNAS) {
const teamRaw = cleanValue(row[0]);
const svrNoRaw = cleanValue(row[1]);
const assetNameRaw = cleanValue(row[2]);
const typeRaw = cleanValue(row[3]);
const detailRaw = cleanValue(row[4]);
const locRaw = cleanValue(row[5]);
const mgr1Raw = cleanValue(row[6]);
const mgr2Raw = cleanValue(row[7]);
const toolRaw = cleanValue(row[8]);
const ipRaw = cleanValue(row[9]);
const ip2Raw = cleanValue(row[10]);
const idRaw = cleanValue(row[11]);
const pwRaw = cleanValue(row[12]);
const osRaw = cleanValue(row[15]);
const osVerRaw = cleanValue(row[16]);
const osBuildRaw = cleanValue(row[17]);
const modelRaw = cleanValue(row[18]);
const cpuRaw = cleanValue(row[19]);
const ramRaw = cleanValue(row[20]);
const gpuRaw = cleanValue(row[21]);
const ssd1Raw = cleanValue(row[22]);
const ssd2Raw = cleanValue(row[23]);
const hdd1Raw = cleanValue(row[24]);
const hdd2Raw = cleanValue(row[25]);
const hdd3Raw = cleanValue(row[26]);
const hdd4Raw = cleanValue(row[27]);
const randomCorp = CORPS[storageIndex % CORPS.length];
// NAS는 기본적으로 내부 백업/공유용 인프라
const service_type = '내부서비스';
const is_inactive = false;
// NAS 실시간 리소스 가상 데이터
const cpu_usage = Math.floor(Math.random() * 25) + 15; // 15%~40%
const ram_usage = Math.floor(Math.random() * 35) + 30; // 30%~65%
const network_traffic = (Math.random() * 600 + 50).toFixed(0) + ' GB';
const assetItem = {
id: randomId(),
asset_type: typeRaw !== '-' ? typeRaw : '공용 NAS',
purchase_corp: randomCorp,
asset_code: 'STO-24' + String(storageIndex).padStart(3, '0'),
purchase_date: '2022-08',
asset_purpose: detailRaw,
current_dept: teamRaw !== '-' ? teamRaw : '디자인팀',
previous_dept: '-',
location: locRaw,
manager_primary: mgr1Raw,
manager_secondary: mgr2Raw,
ip_address: ipRaw !== '-' ? ipRaw : '172.16.42.' + (100 + storageIndex),
remote_tool: toolRaw !== '-' ? toolRaw : 'Web GUI',
model_name: modelRaw !== '-' ? modelRaw : 'Synology 공용 NAS',
os: osRaw !== '-' ? `${osRaw} ${osVerRaw}` : 'DSM 7.x',
cpu: cpuRaw,
ram: ramRaw,
gpu: gpuRaw,
ssd_1: ssd1Raw,
ssd_2: ssd2Raw,
hdd_1: hdd1Raw,
hdd_2: hdd2Raw,
hdd_3: hdd3Raw,
hdd_4: hdd4Raw,
monitoring: '비대상',
purchase_amount: '4500000',
purchase_vendor: '시놀로지 총판',
approval_document: '2022_스토리지_도입_' + storageIndex,
memo: '스토리지 서버 공유 자산',
asset_name: assetNameRaw,
mac_address: `00:1A:2B:3C:5F:${storageIndex.toString(16).toUpperCase().padStart(2, '0')}`,
hw_status: '운영중',
service_type: service_type,
is_inactive: is_inactive,
volume: hdd1Raw !== '-' ? hdd1Raw : '24TB',
cpu_usage: cpu_usage,
ram_usage: ram_usage,
network_traffic: network_traffic
};
parsedStorages.push(assetItem);
storageIndex++;
}
console.log(`Parsed Servers: ${parsedServers.length} units`);
console.log(`Parsed Storages: ${parsedStorages.length} units`);
// 3. 파일 다시 쓰기
const newDummyDataFileContent = `import { HardwareAsset, SoftwareAsset, SWUser, HardwareLog } from './excelHandler';
// 유틸리티: 랜덤 문자열
const randomId = () => Math.random().toString(36).substring(2, 9);
// 유틸리티: 랜덤 년월 (YYYY-MM) (최근 10년)
const randomPurchaseYM = () => {
const currentYear = new Date().getFullYear();
const year = currentYear - Math.floor(Math.random() * 10);
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, '0');
return \`\${year}-\${month}\`;
};
// 유틸리티: 랜덤 YYYY-MM-DD
const randomDateStr = (maxYearsAgo = 10) => {
const currentYear = new Date().getFullYear();
const year = currentYear - Math.floor(Math.random() * maxYearsAgo);
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, '0');
const day = String(Math.floor(Math.random() * 28) + 1).padStart(2, '0');
return \`\${year}-\${month}-\${day}\`;
};
const CORPS = ['한맥', '삼안', '장헌', '장헌산업', 'PTC', '바론', '한라'];
const getRandomCorp = () => CORPS[Math.floor(Math.random() * CORPS.length)];
// ────────────────────────────────────────────────────────
// 1. SampleData_PC.xlsx 에서 파싱된 PC 데이터 주입
// ────────────────────────────────────────────────────────
export const dummyPCs: any[] = ${JSON.stringify(dummyPCs, null, 2)};
// ────────────────────────────────────────────────────────
// 2. 기타 자산 더미 데이터 (서버, 스토리지, 소프트웨어 등 - 엑셀 파싱 연동)
// ────────────────────────────────────────────────────────
export const dummyServers: any[] = ${JSON.stringify(parsedServers, null, 2)};
export const dummyStorages: any[] = ${JSON.stringify(parsedStorages, null, 2)};
export const dummyEquips: any[] = Array.from({ length: 12 }).map((_, i) => ({
id: randomId(),
asset_type: '전산비품',
purchase_corp: getRandomCorp(),
asset_code: \`EQ-24\${String(i).padStart(3, '0')}\`,
asset_name: \`네트워크 스위치 \${i+1}\`,
location: '전산실 랙 1',
manager_primary: '네트워크담당자',
ip_address: \`192.168.10.\${200 + i}\`,
mac_address: \`00:1A:2B:3C:51:\${String(i).padStart(2, '0')}\`,
os: 'Cisco IOS',
purchase_date: randomPurchaseYM(),
purchase_amount: '150000',
purchase_vendor: '다나와',
approval_document: \`2024_비품구매_\${i}\`,
memo: '사내망 확장용',
asset_purpose: '네트워크 분배'
}));
export const dummyMobiles: any[] = Array.from({ length: 15 }).map((_, i) => ({
id: randomId(),
asset_type: '모바일기기',
purchase_corp: getRandomCorp(),
asset_code: \`MOB-24\${String(i).padStart(3, '0')}\`,
asset_name: \`테스트용 단말기 \${i+1}\`,
location: '개발2팀',
manager_primary: '테스터',
os: i % 2 === 0 ? 'Android 14' : 'iOS 17',
purchase_date: randomPurchaseYM(),
purchase_amount: '900000',
purchase_vendor: '삼성전자/애플',
approval_document: \`2024_모바일구매_\${i}\`,
memo: '앱 호환성 테스트 전용',
asset_purpose: 'QA 테스트',
ip_address: \`192.168.1.\${10 + i}\`,
mac_address: \`00:1A:2B:3C:50:\${String(i).padStart(2, '0')}\`
}));
export const dummySubSw: any[] = Array.from({ length: 10 }).map((_, i) => ({
id: randomId(),
sw_type: '구독SW',
sw_field: '업무용/협업',
purchase_corp: getRandomCorp(),
current_dept: '전사',
product_name: \`Microsoft 365 E\${3 + (i%2)}\`,
purchase_date: randomDateStr(3),
start_date: randomDateStr(1),
expired_date: randomDateStr(0),
purchase_amount: '150000',
asset_count: 50 + i * 5,
email_account: \`admin\${i}@hmcorp.com\`,
purchase_vendor: '소프트웨어인라이프',
memo: '연간 계약 갱신 필요'
}));
export const dummyPermSw: any[] = Array.from({ length: 5 }).map((_, i) => ({
id: randomId(),
sw_type: '영구SW',
sw_field: '디자인/설계',
purchase_corp: getRandomCorp(),
current_dept: '디자인팀',
product_name: \`AutoCAD 202\${i%4}\`,
purchase_date: randomDateStr(5),
start_date: randomDateStr(5),
expired_date: '2099-12-31',
purchase_amount: '3000000',
asset_count: 2,
email_account: \`design\${i}@hmcorp.com\`,
purchase_vendor: '오토데스크 파트너',
memo: 'USB 동글키 보관중'
}));
export const dummyCloud: any[] = Array.from({ length: 5 }).map((_, i) => ({
id: randomId(),
sw_type: '클라우드',
asset_mfr: i % 2 === 0 ? 'AWS' : 'GCP',
purchase_corp: getRandomCorp(),
current_dept: '개발팀',
product_name: \`컴퓨팅 인스턴스 Type \${i}\`,
email_account: \`awsadmin\${i}@hmcorp.com\`,
purchase_method: '법인카드(신한 1234)',
purchase_amount: \`\${500000 + i * 100000}\`,
asset_count: 1,
purchase_vendor: 'AWS/GCP',
memo: '환율 변동에 따라 매월 상이함'
}));
export const dummyDomain: any[] = Array.from({ length: 5 }).map((_, i) => ({
id: randomId(),
asset_type: '도메인',
purchase_corp: getRandomCorp(),
product_name: \`사내 운영 서비스 \${i+1}\`,
domain_address: \`service\${i+1}.hmcorp.com\`,
start_date: randomDateStr(4),
expired_date: randomDateStr(0),
purchase_amount: '22000',
manager_primary: '인프라팀장',
manager_secondary: '인프라담당자',
memo: '가비아 자동갱신 설정 완료'
}));
export const dummySwUsers: any[] = Array.from({ length: 15 }).map((_, i) => ({
id: randomId(),
sw_id: dummySubSw[0]?.id || randomId(),
purchase_corp: getRandomCorp(),
current_dept: '경영지원팀',
user_current: \`홍길동\${i}\`,
memo: \`SW신청서_2400\${i}\`
}));
export const dummyLogs: any[] = Array.from({ length: 10 }).map((_, i) => ({
id: randomId(),
assetId: dummyPCs[0]?.id || randomId(),
date: randomDateStr(1),
details: i % 2 === 0 ? '메모리 추가 증설 (16GB -> 32GB)' : '디스플레이 파손 수리',
user: 'IT지원팀',
cost: i % 2 === 0 ? 80000 : 150000,
}));
`;
fs.writeFileSync(dummyDataPath, newDummyDataFileContent, 'utf-8');
console.log('✅ dummyData.ts file updated successfully with SVR dataset.');
} catch (e) {
console.error('❌ Failed to update dummy data:', e);
}
-110
View File
@@ -1,110 +0,0 @@
#!/usr/bin/env sh
set -eu
COMMAND="${1:-help}"
ENV_FILE="${ENV_FILE:-.env}"
BACKUP_ROOT="${BACKUP_ROOT:-backups}"
RETENTION_DAYS="${RETENTION_DAYS:-14}"
TIMESTAMP="${BACKUP_TIMESTAMP:-$(date +%Y%m%d_%H%M%S)}"
log() {
printf '[backup] %s\n' "$*"
}
fail() {
printf '[backup] %s\n' "$*" >&2
exit 1
}
require_command() {
command -v "$1" >/dev/null 2>&1 || fail "Required command not found: $1"
}
load_env() {
[ -f "$ENV_FILE" ] || fail "Env file not found: $ENV_FILE"
set -a
# shellcheck disable=SC1090
. "$ENV_FILE"
set +a
: "${DB_HOST:?DB_HOST is required in $ENV_FILE}"
: "${DB_PORT:=3306}"
: "${DB_USER:?DB_USER is required in $ENV_FILE}"
: "${DB_PASS:?DB_PASS is required in $ENV_FILE}"
: "${DB_NAME:?DB_NAME is required in $ENV_FILE}"
}
db_dump() {
require_command mysqldump
require_command gzip
load_env
mkdir -p "$BACKUP_ROOT/db"
output_path="$BACKUP_ROOT/db/${DB_NAME}_${TIMESTAMP}.sql.gz"
log "Creating DB dump: $output_path"
MYSQL_PWD="$DB_PASS" mysqldump \
--host="$DB_HOST" \
--port="$DB_PORT" \
--user="$DB_USER" \
--single-transaction \
--quick \
--routines \
--triggers \
"$DB_NAME" | gzip > "$output_path"
log "DB dump completed: $output_path"
}
files_backup() {
require_command tar
mkdir -p "$BACKUP_ROOT/files"
archive_path="$BACKUP_ROOT/files/runtime_${TIMESTAMP}.tar.gz"
set --
[ -f "$ENV_FILE" ] && set -- "$@" "$ENV_FILE"
[ -d "uploads" ] && set -- "$@" "uploads"
[ -f "map_config.json" ] && set -- "$@" "map_config.json"
[ "$#" -gt 0 ] || fail "No runtime files found to archive"
log "Creating runtime archive: $archive_path"
tar -czf "$archive_path" "$@"
log "Runtime archive completed: $archive_path"
}
cleanup_backups() {
require_command find
[ -d "$BACKUP_ROOT" ] || {
log "Backup root does not exist, skipping cleanup: $BACKUP_ROOT"
return 0
}
log "Deleting backup files older than ${RETENTION_DAYS} days from $BACKUP_ROOT"
find "$BACKUP_ROOT" -type f -mtime "+$RETENTION_DAYS" -print -delete
}
case "$COMMAND" in
db)
db_dump
;;
files)
files_backup
;;
full)
db_dump
files_backup
;;
cleanup)
cleanup_backups
;;
help|--help|-h)
log "Commands: db | files | full | cleanup"
;;
*)
fail "Unknown command: $COMMAND"
;;
esac
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Headless Chrome screenshot of the sample page (WSL2 → Windows Chrome).
# Usage: scripts/capture-sample.sh <output.png> [url]
# Requires the dev server: npm run dev -- --host 127.0.0.1 --port 5173
set -euo pipefail
OUT_WSL="${1:?output png path (WSL path)}"
URL="${2:-http://127.0.0.1:5173/?sample=1}"
CHROME="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
mkdir -p "$(dirname "$OUT_WSL")"
timeout 200 "$CHROME" --headless=new --no-sandbox --use-gl=angle --use-angle=swiftshader \
--enable-unsafe-swiftshader --enable-logging=stderr --v=0 --window-size=1600,1000 \
--timeout=45000 --screenshot="$(wslpath -w "$OUT_WSL")" "$URL"
+43
View File
@@ -0,0 +1,43 @@
// Clicks the template download button in the import dialog through Chrome DevTools
// and reports the saved file. Run with Windows Node (same machine as Chrome):
// node verify-template-download.cjs "C:\\Users\\...\\Temp\\verify-downloads"
const fs = require('fs');
const path = require('path');
const DL_DIR = process.argv[2];
const CDP = 'http://127.0.0.1:9444';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function main() {
fs.mkdirSync(DL_DIR, { recursive: true });
const page = (await (await fetch(`${CDP}/json`)).json()).find((t) => t.type === 'page');
const ws = new WebSocket(page.webSocketDebuggerUrl);
await new Promise((res, rej) => { ws.onopen = res; ws.onerror = rej; });
let seq = 0;
const waiting = new Map();
ws.onmessage = (ev) => {
const m = JSON.parse(ev.data);
if (m.id && waiting.has(m.id)) { waiting.get(m.id)(m); waiting.delete(m.id); }
};
const send = (method, params = {}) => new Promise((res) => {
const id = ++seq; waiting.set(id, res); ws.send(JSON.stringify({ id, method, params }));
});
const evalJs = async (expression) => {
const r = await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true });
if (r.result.exceptionDetails) throw new Error(JSON.stringify(r.result.exceptionDetails).slice(0, 300));
return r.result.result.value;
};
await send('Page.enable');
await send('Runtime.enable');
await send('Browser.setDownloadBehavior', { behavior: 'allow', downloadPath: DL_DIR, eventsEnabled: false });
await send('Page.navigate', { url: 'http://127.0.0.1:5173/' });
await sleep(4000);
await evalJs(`document.getElementById('open-import').click()`);
await sleep(500);
await evalJs(`document.getElementById('download-template').click()`);
await sleep(4000);
const files = fs.readdirSync(DL_DIR);
console.log('DOWNLOADED', JSON.stringify(files));
for (const f of files) console.log('SIZE', f, fs.statSync(path.join(DL_DIR, f)).size);
ws.close();
}
main().catch((e) => { console.error('FAILED', e); process.exit(1); });
+113
View File
@@ -0,0 +1,113 @@
// UI verification driven through the Chrome DevTools Protocol.
// Run with Windows Node (same machine as Chrome), e.g.:
// node verify-ui.cjs "C:\\Users\\...\\input.xlsx" "\\\\wsl.localhost\\Ubuntu\\...\\shots"
// Chrome must be started with --remote-debugging-port=9444 (see DOC/05_검증).
const fs = require('fs');
const path = require('path');
const APP_URL = process.env.APP_URL || 'http://127.0.0.1:5173/';
const CDP = process.env.CDP || 'http://127.0.0.1:9444';
const INPUT_FILE = process.argv[2];
const OUT_DIR = process.argv[3];
if (!INPUT_FILE || !OUT_DIR) throw new Error('INPUT_FILE and OUT_DIR are required');
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function main() {
const targets = await (await fetch(`${CDP}/json`)).json();
const page = targets.find((t) => t.type === 'page');
if (!page) throw new Error('no page target');
const ws = new WebSocket(page.webSocketDebuggerUrl);
await new Promise((res, rej) => {
ws.onopen = res;
ws.onerror = rej;
});
let seq = 0;
const waiting = new Map();
// Console and exception events, collected from the first navigation onward (V10 ③).
const consoleEvents = [];
ws.onmessage = (ev) => {
const m = JSON.parse(ev.data);
if (m.id && waiting.has(m.id)) {
waiting.get(m.id)(m);
waiting.delete(m.id);
} else if (m.method === 'Runtime.consoleAPICalled' && ['error', 'warning'].includes(m.params.type)) {
const text = m.params.args.map((a) => a.value ?? a.description ?? '').join(' ');
consoleEvents.push(`console.${m.params.type}: ${text}`);
} else if (m.method === 'Runtime.exceptionThrown') {
const d = m.params.exceptionDetails;
consoleEvents.push(`exception: ${d.exception?.description || d.text}`);
} else if (m.method === 'Log.entryAdded' && ['error', 'warning'].includes(m.params.entry.level)) {
consoleEvents.push(`log.${m.params.entry.level}: ${m.params.entry.text} ${m.params.entry.url || ''}`.trim());
}
};
const send = (method, params = {}) =>
new Promise((res) => {
const id = ++seq;
waiting.set(id, res);
ws.send(JSON.stringify({ id, method, params }));
});
const evalJs = async (expression) => {
const r = await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true });
if (r.result.exceptionDetails) throw new Error(JSON.stringify(r.result.exceptionDetails).slice(0, 400));
return r.result.result.value;
};
const shot = async (name) => {
const r = await send('Page.captureScreenshot', { format: 'png' });
fs.writeFileSync(path.join(OUT_DIR, name), Buffer.from(r.result.data, 'base64'));
console.log(`SHOT ${name}`);
};
await send('Page.enable');
await send('Runtime.enable');
await send('Log.enable');
await send('DOM.enable');
await send('Emulation.setDeviceMetricsOverride', { width: 1600, height: 1000, deviceScaleFactor: 1, mobile: false });
await send('Page.navigate', { url: APP_URL });
await sleep(4000);
// V11 — dialog with the user's three-sheet workbook.
await evalJs(`document.getElementById('open-import').click()`);
await sleep(500);
await evalJs(`(() => { const i = document.getElementById('project-name'); i.value = '운곡교 검증';
i.dispatchEvent(new Event('input')); return true; })()`);
const doc = await send('DOM.getDocument', { depth: -1 });
const q = await send('DOM.querySelector', { nodeId: doc.result.root.nodeId, selector: '#file' });
await send('DOM.setFileInputFiles', { nodeId: q.result.nodeId, files: [INPUT_FILE] });
await sleep(3000);
console.log('SHEETS_TEXT_BEGIN');
console.log(await evalJs(`document.getElementById('sheets').innerText`));
console.log('SHEETS_TEXT_END');
console.log('SELECTED', await evalJs(`document.getElementById('dlg-selected').textContent`));
console.log('APPLY', await evalJs(`(() => { const b = document.getElementById('dlg-apply');
return b.textContent + ' | disabled=' + b.disabled; })()`));
await shot('v11_dialog_user_file.png');
await evalJs(`document.getElementById('dlg-apply').click()`);
await sleep(2000);
console.log('STATUS', await evalJs(`document.getElementById('status').textContent`));
console.log('PIERS', await evalJs(`[...document.querySelectorAll('#pier-items li')].map(li => li.textContent.trim()).join(' | ')`));
console.log('RESULT_AXIS', await evalJs(`document.getElementById('res-axis').innerText.replace(/\\n+/g, ' / ')`));
console.log('RESULT_FOUND', await evalJs(`document.getElementById('res-found').innerText.replace(/\\n+/g, ' / ')`));
await shot('v11_main_user_file.png');
// V10 ② — the four view presets.
for (const label of ['정면', '측면', '평면', '아이소']) {
await evalJs(`[...document.querySelectorAll('#views button')].find((b) => b.textContent === '${label}').click()`);
await sleep(1500);
await shot(`v10_view_${label}.png`);
console.log('PRESSED', label, await evalJs(`[...document.querySelectorAll('#views button')].filter((b) => b.getAttribute('aria-pressed') === 'true').map((b) => b.textContent).join(',')`));
}
// V10 ③ — every console error/warning and uncaught exception seen during the run above.
console.log(`CONSOLE_EVENTS ${consoleEvents.length}`);
for (const e of consoleEvents) console.log(` ${e}`);
ws.close();
}
main().catch((e) => {
console.error('FAILED', e);
process.exit(1);
});
-772
View File
@@ -1,772 +0,0 @@
import express from 'express';
import mysql from 'mysql2/promise';
import cors from 'cors';
import dotenv from 'dotenv';
import fs from 'fs';
dotenv.config();
const dbConfig = {
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
port: parseInt(process.env.DB_PORT || '3306')
};
const getDbConnectionSummary = () => ({
host: dbConfig.host || '(missing)',
port: dbConfig.port,
user: dbConfig.user || '(missing)',
database: dbConfig.database || '(missing)'
});
const app = express();
app.use(cors());
app.use(express.json({ limit: '50mb' }));
app.use('/uploads', express.static('uploads')); // 업로드 파일 정적 서빙
// uploads 폴더가 없으면 생성
if (!fs.existsSync('uploads')) {
fs.mkdirSync('uploads');
}
// MySQL Pool Configuration
const pool = mysql.createPool({
host: dbConfig.host,
user: dbConfig.user,
password: dbConfig.password,
database: dbConfig.database,
port: dbConfig.port,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
});
// Database startup check (ensure job_spec_standards table exists)
(async () => {
let connection;
try {
connection = await pool.getConnection();
await connection.query(`
CREATE TABLE IF NOT EXISTS job_spec_standards (
id INT AUTO_INCREMENT PRIMARY KEY,
job_name VARCHAR(100) UNIQUE NOT NULL,
cpu_standard VARCHAR(255),
ram_standard VARCHAR(100),
gpu_standard VARCHAR(100),
min_score INT DEFAULT 0,
remarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
`);
console.log('✅ job_spec_standards table verification completed.');
} catch (err) {
console.error('❌ Failed to verify/create job_spec_standards table:', {
db: getDbConnectionSummary(),
code: err.code,
errno: err.errno,
syscall: err.syscall,
address: err.address,
port: err.port,
message: err.message
});
} finally {
if (connection) connection.release();
}
})();
// Error Handler
const handleError = (res, err, label) => {
console.error(`❌ [${label}] Error:`, {
db: getDbConnectionSummary(),
code: err.code,
errno: err.errno,
syscall: err.syscall,
address: err.address,
port: err.port,
message: err.message
});
res.status(500).json({ error: err.message });
};
// --- Global Constants ---
const CATEGORY_TABLE_MAP = {
pc: 'asset_core',
server: 'asset_core',
storage: 'asset_core',
network: 'asset_core',
equipment: 'asset_core',
officeSupplies: 'asset_core',
survey: 'asset_core',
vip: 'asset_core',
pcParts: 'asset_core',
swInternal: 'asset_software_perpetual',
swExternal: 'asset_software_subscription',
swUsers: 'asset_software_assignment',
users: 'system_users',
logs: 'asset_history'
};
const ASSET_TABLES = [
'asset_core'
];
// --- API Endpoints ---
// 1. Generic Batch Save (Dynamic Table Detection)
app.post('/api/:table/batch', async (req, res) => {
const { table } = req.params;
const dbTable = CATEGORY_TABLE_MAP[table] || table;
const data = req.body;
if (!Array.isArray(data)) return res.status(400).json({ error: 'Data must be an array' });
let connection;
try {
connection = await pool.getConnection();
await connection.beginTransaction();
const [columns] = await connection.query(`DESCRIBE ${dbTable}`);
const validFields = columns.map(c => c.Field);
await connection.query(`DELETE FROM ${dbTable}`);
if (data.length > 0) {
const placeholders = validFields.map(() => '?').join(', ');
const sql = `INSERT INTO ${dbTable} (${validFields.join(', ')}) VALUES (${placeholders})`;
for (const item of data) {
const values = validFields.map(field => {
const val = item[field];
return val === undefined ? null : val;
});
await connection.query(sql, values);
}
}
await connection.commit();
res.json({ success: true, count: data.length });
} catch (err) {
if (connection) await connection.rollback();
handleError(res, err, 'BATCH SAVE');
} finally {
if (connection) connection.release();
}
});
// 2. Get All Assets (Integrated Master Data from Normalized V3 Schema)
app.get('/api/assets/master', async (req, res) => {
let connection;
try {
connection = await pool.getConnection();
const masterData = {
pc: [], server: [], storage: [], network: [],
equipment: [], officeSupplies: [], survey: [], vip: [], pcParts: [],
swInternal: [], swExternal: [], swUsers: [], users: [], logs: [], partsMaster: []
};
// Load from V3 Normalized Schema
const [rows] = await connection.query(`
SELECT
c.*,
s.hw_status, s.model_name, s.mainboard, s.os, s.cpu, s.ram, s.gpu,
s.monitoring, s.price, s.monitor_inch, s.serial_num,
l.location, l.location_detail, l.location_photo, l.loc_x, l.loc_y,
(
SELECT JSON_ARRAYAGG(JSON_OBJECT('type', net_type, 'name', net_name, 'val1', net_value1, 'val2', net_value2))
FROM asset_remote WHERE asset_id = c.id AND is_active = 1
) as remotes,
(
SELECT JSON_ARRAYAGG(JSON_OBJECT('type', disk_type, 'capacity', capacity, 'unit', unit, 'slot', slot_no))
FROM asset_volume WHERE asset_id = c.id
) as volumes
FROM asset_core c
LEFT JOIN asset_spec s ON c.id = s.asset_id
LEFT JOIN asset_location l ON l.id = (
SELECT id FROM asset_location
WHERE asset_id = c.id AND is_active = 1
ORDER BY created_at DESC LIMIT 1
)
`);
const catMap = {
'PC': 'pc', '서버': 'server', '저장매체': 'storage', '네트워크': 'network',
'업무지원장비': 'equipment', '사무가구': 'officeSupplies', '공간정보장비': 'survey',
'내빈/외빈': 'vip', 'PC부품': 'pcParts'
};
rows.forEach(row => {
const key = catMap[row.category] || 'pc';
masterData[key].push(row);
});
const [swInternal] = await connection.query('SELECT * FROM asset_software_perpetual');
const [swExternal] = await connection.query('SELECT * FROM asset_software_subscription');
const [swUsers] = await connection.query('SELECT * FROM asset_software_assignment');
const [users] = await connection.query('SELECT * FROM system_users');
const [logs] = await connection.query('SELECT * FROM asset_history ORDER BY created_at DESC');
const [partsMaster] = await connection.query('SELECT * FROM hardware_components_master ORDER BY category, component_name');
const [jobSpecs] = await connection.query('SELECT * FROM job_spec_standards ORDER BY job_name');
masterData.swInternal = swInternal;
masterData.swExternal = swExternal;
masterData.swUsers = swUsers;
masterData.users = users;
masterData.logs = logs;
masterData.partsMaster = partsMaster;
masterData.jobSpecs = jobSpecs;
res.json(masterData);
} catch (err) {
handleError(res, err, 'MASTER DATA');
} finally {
if (connection) connection.release();
}
});
// 3. Asset Save (Surgical Split to Normalized V3 Tables)
app.post('/api/asset/:category/save', async (req, res) => {
const asset = req.body;
let connection;
try {
connection = await pool.getConnection();
await connection.beginTransaction();
// 3.0 History Tracking & Auto Field Update
const [oldCoreRows] = await connection.query('SELECT * FROM asset_core WHERE id = ?', [asset.id]);
const [oldSpecRows] = await connection.query('SELECT * FROM asset_spec WHERE asset_id = ?', [asset.id]);
const oldCore = oldCoreRows[0] || {};
const oldSpec = oldSpecRows[0] || {};
const historyLogs = [];
const logDate = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
const logUser = '관리자';
// 3.0.1 Core 변동 감지 (Dept, User)
const oldDept = oldCore.current_dept || '';
const newDept = asset.current_dept || '';
if (newDept !== '' && oldDept !== newDept) {
asset.previous_dept = oldDept;
historyLogs.push({
event_type: 'DEPT_CHANGE',
old_dept: oldDept || null,
new_dept: newDept,
details: `[조직 변동] ${oldDept || '(없음)'} -> ${newDept}`
});
}
const oldUser = oldCore.user_current || '';
const newUser = asset.user_current || '';
if (newUser !== '' && oldUser !== newUser) {
asset.previous_user = oldUser;
historyLogs.push({
event_type: 'USER_CHANGE',
old_user: oldUser || null,
new_user: newUser,
details: `[사용자 변동] ${oldUser || '(없음)'} -> ${newUser}`
});
}
// 3.0.2 Spec 변동 감지 (CPU, RAM, GPU, OS, Mainboard 등)
const specFieldsToTrack = [
{ key: 'cpu', label: 'CPU' },
{ key: 'ram', label: 'RAM' },
{ key: 'gpu', label: 'GPU' },
{ key: 'os', label: 'OS' },
{ key: 'mainboard', label: '메인보드' }
];
specFieldsToTrack.forEach(field => {
const oldVal = String(oldSpec[field.key] || '').trim();
const newVal = String(asset[field.key] || '').trim();
if (newVal !== '' && oldVal !== newVal) {
historyLogs.push({
event_type: 'SPEC_CHANGE',
details: `[사양 변경] ${field.label}: ${oldVal || '(없음)'} -> ${newVal}`
});
}
});
// 3.0.3 상태 변경 감지
const oldStatus = oldSpec.hw_status || '';
const newStatus = asset.hw_status || '';
if (newStatus !== '' && oldStatus !== newStatus) {
historyLogs.push({
event_type: 'STATUS_CHANGE',
details: `[상태 변경] ${oldStatus || '(없음)'} -> ${newStatus}`
});
}
// 로그 일괄 삽입
for (const log of historyLogs) {
await connection.query(
`INSERT INTO asset_history (asset_id, event_type, old_dept, new_dept, old_user, new_user, details, log_date, log_user)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
[asset.id, log.event_type, log.old_dept || null, log.new_dept || null, log.old_user || null, log.new_user || null, log.details, logDate, logUser]
);
}
// 3.1 asset_core
const coreFields = ['id', 'asset_code', 'category', 'asset_type', 'current_role', 'asset_purpose', 'service_type', 'purchase_corp', 'purchase_date', 'purchase_amount', 'purchase_vendor', 'approval_document', 'memo', 'manager_primary', 'manager_secondary', 'current_dept', 'previous_dept', 'user_current', 'previous_user', 'emp_no', 'user_position'];
const coreData = {};
coreFields.forEach(f => { if (asset[f] !== undefined) coreData[f] = asset[f]; });
const coreKeys = Object.keys(coreData);
console.log(`[DEBUG] Saving Asset ID: ${asset.id}, Code: ${asset.asset_code}`);
const [existingCore] = await connection.query('SELECT id FROM asset_core WHERE id = ?', [asset.id]);
console.log(`[DEBUG] Existing Core Check for ${asset.id}: Found ${existingCore.length}`);
if (existingCore.length > 0) {
// UPDATE
const updateKeys = coreKeys.filter(k => k !== 'id');
const coreSql = `UPDATE asset_core SET ${updateKeys.map(k => `${k} = ?`).join(', ')} WHERE id = ?`;
const [updRes] = await connection.query(coreSql, [...updateKeys.map(k => coreData[k]), asset.id]);
console.log(`[DEBUG] Core UPDATE result: affectedRows=${updRes.affectedRows}`);
} else {
// INSERT
const coreSql = `INSERT INTO asset_core (${coreKeys.join(', ')}) VALUES (${coreKeys.map(() => '?').join(', ')})`;
const [insRes] = await connection.query(coreSql, Object.values(coreData));
console.log(`[DEBUG] Core INSERT result: affectedRows=${insRes.affectedRows}`);
}
// 3.2 asset_spec
const specFields = ['hw_status', 'model_name', 'mainboard', 'os', 'cpu', 'ram', 'gpu', 'monitoring', 'price', 'monitor_inch', 'serial_num'];
const specData = { asset_id: asset.id };
specFields.forEach(f => { if (asset[f] !== undefined) specData[f] = asset[f]; });
const specKeys = Object.keys(specData);
const [specExists] = await connection.query('SELECT id FROM asset_spec WHERE asset_id = ?', [asset.id]);
if (specExists.length > 0) {
const updateSql = `UPDATE asset_spec SET ${specKeys.filter(k => k !== 'asset_id').map(k => `${k} = ?`).join(', ')} WHERE asset_id = ?`;
await connection.query(updateSql, [...specKeys.filter(k => k !== 'asset_id').map(k => specData[k]), asset.id]);
} else {
await connection.query(`INSERT INTO asset_spec (${specKeys.join(', ')}) VALUES (${specKeys.map(() => '?').join(', ')})`, Object.values(specData));
}
// 3.3 asset_volume
await connection.query('DELETE FROM asset_volume WHERE asset_id = ?', [asset.id]);
if (asset.volumes) {
try {
let vols = typeof asset.volumes === 'string' ? JSON.parse(asset.volumes) : asset.volumes;
if (Array.isArray(vols)) {
for (let i = 0; i < vols.length; i++) {
const v = vols[i];
if (v.type && v.capacity) {
await connection.query(
'INSERT INTO asset_volume (asset_id, disk_type, capacity, unit, slot_no) VALUES (?, ?, ?, ?, ?)',
[asset.id, v.type, v.capacity, v.unit || 'GB', v.slot || (i + 1)]
);
}
}
}
} catch(e) { console.error('Volume parse error', e); }
}
// 3.4 asset_location
if (asset.location || asset.location_detail) {
const [locActive] = await connection.query('SELECT * FROM asset_location WHERE asset_id = ? AND is_active = 1', [asset.id]);
const isChanged = locActive.length === 0 || locActive[0].location !== asset.location || locActive[0].location_detail !== asset.location_detail || locActive[0].loc_x !== asset.loc_x || locActive[0].loc_y !== asset.loc_y;
if (isChanged) {
await connection.query('UPDATE asset_location SET is_active = 0, deactivated_at = NOW() WHERE asset_id = ? AND is_active = 1', [asset.id]);
await connection.query(`INSERT INTO asset_location (asset_id, location, location_detail, location_photo, loc_x, loc_y, is_active) VALUES (?, ?, ?, ?, ?, ?, 1)`,
[asset.id, asset.location, asset.location_detail, asset.location_photo, asset.loc_x, asset.loc_y]);
}
}
// 3.5 asset_remote (Dynamic Array Logic)
if (asset.remotes) {
try {
let nets = typeof asset.remotes === 'string' ? JSON.parse(asset.remotes) : asset.remotes;
if (Array.isArray(nets)) {
await connection.query('UPDATE asset_remote SET is_active = 0, deactivated_at = NOW() WHERE asset_id = ? AND is_active = 1', [asset.id]);
for (const n of nets) {
if (n.type) {
await connection.query(
'INSERT INTO asset_remote (asset_id, net_type, net_name, net_value1, net_value2, is_active) VALUES (?, ?, ?, ?, ?, 1)',
[asset.id, n.type, n.name || '', n.val1 || '', n.val2 || '']
);
}
}
}
} catch(e) { console.error('Remote data parse error', e); }
} else {
// Fallback for UI that hasn't sent the networks array yet
if (asset.ip_address || asset.mac_address || asset.remote_tool) {
const [netActive] = await connection.query('SELECT * FROM asset_remote WHERE asset_id = ? AND is_active = 1', [asset.id]);
const isChanged = netActive.length === 0 || netActive[0].net_value1 !== asset.ip_address || netActive[0].net_value2 !== asset.mac_address || netActive[0].net_name !== asset.remote_tool;
if (isChanged) {
await connection.query('UPDATE asset_remote SET is_active = 0, deactivated_at = NOW() WHERE asset_id = ? AND is_active = 1', [asset.id]);
if (asset.ip_address || asset.mac_address) {
await connection.query('INSERT INTO asset_remote (asset_id, net_type, net_name, net_value1, net_value2, is_active) VALUES (?, ?, ?, ?, ?, 1)', [asset.id, 'IP', '기본망', asset.ip_address, asset.mac_address]);
}
if (asset.remote_tool || asset.remote_id || asset.remote_pw) {
await connection.query('INSERT INTO asset_remote (asset_id, net_type, net_name, net_value1, net_value2, is_active) VALUES (?, ?, ?, ?, ?, 1)', [asset.id, 'REMOTE', asset.remote_tool, asset.remote_id, asset.remote_pw]);
}
}
}
}
await connection.commit();
console.log(`💾 [V3 ASSET SAVE] ID: ${asset.id}`);
res.json({ success: true });
} catch (err) {
if (connection) await connection.rollback();
handleError(res, err, 'ASSET SAVE V3');
} finally {
if (connection) connection.release();
}
});
// 3.6 PC Flow Transaction (Checkout, Return, Move)
app.post('/api/pc/flow', async (req, res) => {
const { action, assetId, userName, dept, empNo, position, date, details, manager } = req.body;
let connection;
try {
connection = await pool.getConnection();
await connection.beginTransaction();
if (action === 'checkout') {
await connection.query(
`UPDATE asset_core
SET user_current = ?, emp_no = ?, current_dept = ?, user_position = ?
WHERE id = ?`,
[userName, empNo, dept, position, assetId]
);
await connection.query(
`UPDATE asset_spec SET hw_status = '운영' WHERE asset_id = ?`,
[assetId]
);
} else if (action === 'return') {
await connection.query(
`UPDATE asset_core
SET previous_user = user_current, previous_dept = current_dept,
user_current = '', emp_no = '', user_position = ''
WHERE id = ?`,
[assetId]
);
await connection.query(
`UPDATE asset_spec SET hw_status = '재고' WHERE asset_id = ?`,
[assetId]
);
} else if (action === 'move') {
await connection.query(
`UPDATE asset_core
SET previous_user = user_current, previous_dept = current_dept,
user_current = ?, emp_no = ?, current_dept = ?, user_position = ?
WHERE id = ?`,
[userName, empNo, dept, position, assetId]
);
await connection.query(
`UPDATE asset_spec SET hw_status = '운영' WHERE asset_id = ?`,
[assetId]
);
} else {
throw new Error('Invalid action type');
}
// Insert into asset_history
await connection.query(
`INSERT INTO asset_history (asset_id, log_date, log_user, details)
VALUES (?, ?, ?, ?)`,
[assetId, date || new Date().toISOString().split('T')[0], manager || 'system', details]
);
await connection.commit();
console.log(`💾 [PC FLOW TRANSACTION] Action: ${action}, Asset ID: ${assetId}`);
res.json({ success: true });
} catch (err) {
if (connection) await connection.rollback();
handleError(res, err, 'PC FLOW TRANSACTION');
} finally {
if (connection) connection.release();
}
});
// 4. Asset Delete
app.delete('/api/asset/:category/:id', async (req, res) => {
const { category, id } = req.params;
// Define mapping for which base table handles the delete
const deleteTableMap = {
pc: 'asset_core',
server: 'asset_core',
storage: 'asset_core',
network: 'asset_core',
equipment: 'asset_core',
officeSupplies: 'asset_core',
survey: 'asset_core',
vip: 'asset_core',
pcParts: 'asset_core',
swInternal: 'asset_software_perpetual',
swExternal: 'asset_software_subscription',
swUsers: 'asset_software_assignment',
users: 'system_users'
};
const table = deleteTableMap[category];
if (!table) return res.status(400).json({ error: 'Invalid category for deletion' });
try {
const connection = await pool.getConnection();
// For asset_core, ON DELETE CASCADE will handle spec, location, remote, volume
await connection.query(`DELETE FROM ${table} WHERE id = ?`, [id]);
connection.release();
console.log(`🗑️ [ASSET DELETE] Category: ${category}, ID: ${id}`);
res.json({ success: true });
} catch (err) {
handleError(res, err, 'ASSET DELETE');
}
});
// 5. Generate Next Asset Code
app.get('/api/generate-asset-code', async (req, res) => {
const { prefix, purchaseDate } = req.query;
if (!prefix) return res.status(400).json({ error: 'Prefix is required' });
try {
const connection = await pool.getConnection();
const datePart = purchaseDate ? purchaseDate.toString().replace(/-/g, '').substring(0, 6) : '';
const searchPattern = datePart ? `${prefix}-${datePart}-%` : `${prefix}-%`;
let maxNum = 0;
for (const table of ASSET_TABLES) {
try {
const [rows] = await connection.query(`SELECT asset_code FROM ${table} WHERE asset_code LIKE ?`, [searchPattern]);
rows.forEach(row => {
const parts = row.asset_code.split('-');
const num = parseInt(parts[parts.length - 1]);
if (!isNaN(num) && num > maxNum) maxNum = num;
});
} catch (err) {}
}
const nextNum = maxNum + 1;
const nextCode = datePart ? `${prefix}-${datePart}-${String(nextNum).padStart(4, '0')}` : `${prefix}-${String(nextNum).padStart(4, '0')}`;
connection.release();
res.json({ nextCode });
} catch (err) { handleError(res, err, 'GENERATE CODE'); }
});
// 6. Map Config API
app.get('/api/maps', (req, res) => {
try {
if (!fs.existsSync('map_config.json')) return res.json({});
const data = fs.readFileSync('map_config.json', 'utf8');
res.json(JSON.parse(data || '{}'));
} catch (err) { handleError(res, err, 'GET MAPS'); }
});
// 6.5. Get Hardware Components Master List
app.get('/api/hardware-components', async (req, res) => {
try {
const [rows] = await pool.query('SELECT * FROM hardware_components_master ORDER BY category, component_name');
res.json(rows);
} catch (err) {
handleError(res, err, 'GET HARDWARE COMPONENTS');
}
});
// 6.6. Save Hardware Component (Add or Update)
app.post('/api/hardware-components/save', async (req, res) => {
const { id, category, component_name, score_tier, deduction } = req.body;
let connection;
try {
connection = await pool.getConnection();
if (id) {
await connection.query(
'UPDATE hardware_components_master SET category = ?, component_name = ?, score_tier = ?, deduction = ? WHERE id = ?',
[category, component_name, score_tier, deduction, id]
);
} else {
await connection.query(
'INSERT INTO hardware_components_master (category, component_name, score_tier, deduction) VALUES (?, ?, ?, ?)',
[category, component_name, score_tier, deduction]
);
}
res.json({ success: true });
} catch (err) {
handleError(res, err, 'SAVE HARDWARE COMPONENT');
} finally {
if (connection) connection.release();
}
});
// 6.7. Delete Hardware Component
app.delete('/api/hardware-components/:id', async (req, res) => {
const { id } = req.params;
let connection;
try {
connection = await pool.getConnection();
await connection.query('DELETE FROM hardware_components_master WHERE id = ?', [id]);
res.json({ success: true });
} catch (err) {
handleError(res, err, 'DELETE HARDWARE COMPONENT');
} finally {
if (connection) connection.release();
}
});
// 6.7.1. Get Job Spec Standards
app.get('/api/job-specs', async (req, res) => {
try {
const [rows] = await pool.query('SELECT * FROM job_spec_standards ORDER BY job_name');
res.json(rows);
} catch (err) {
handleError(res, err, 'GET JOB SPECS');
}
});
// 6.7.2. Save Job Spec Standard (Add or Update)
app.post('/api/job-specs/save', async (req, res) => {
const { id, job_name, cpu_standard, ram_standard, gpu_standard, min_score, remarks } = req.body;
let connection;
try {
connection = await pool.getConnection();
if (id) {
await connection.query(
'UPDATE job_spec_standards SET job_name = ?, cpu_standard = ?, ram_standard = ?, gpu_standard = ?, min_score = ?, remarks = ? WHERE id = ?',
[job_name, cpu_standard, ram_standard, gpu_standard, min_score, remarks, id]
);
} else {
await connection.query(
'INSERT INTO job_spec_standards (job_name, cpu_standard, ram_standard, gpu_standard, min_score, remarks) VALUES (?, ?, ?, ?, ?, ?)',
[job_name, cpu_standard, ram_standard, gpu_standard, min_score, remarks]
);
}
res.json({ success: true });
} catch (err) {
handleError(res, err, 'SAVE JOB SPEC');
} finally {
if (connection) connection.release();
}
});
// 6.7.3. Delete Job Spec Standard
app.delete('/api/job-specs/:id', async (req, res) => {
const { id } = req.params;
let connection;
try {
connection = await pool.getConnection();
await connection.query('DELETE FROM job_spec_standards WHERE id = ?', [id]);
res.json({ success: true });
} catch (err) {
handleError(res, err, 'DELETE JOB SPEC');
} finally {
if (connection) connection.release();
}
});
// 6.8. Get System Users List
app.get('/api/system-users', async (req, res) => {
try {
const [rows] = await pool.query('SELECT * FROM system_users ORDER BY user_name');
res.json(rows);
} catch (err) {
handleError(res, err, 'GET SYSTEM USERS');
}
});
// 6.9. Save System User (Add or Update)
app.post('/api/system-users/save', async (req, res) => {
const { id, emp_no, user_name, dept_name, position, status } = req.body;
let connection;
try {
connection = await pool.getConnection();
if (id) {
await connection.query(
'UPDATE system_users SET emp_no = ?, user_name = ?, dept_name = ?, position = ?, status = ? WHERE id = ?',
[emp_no, user_name, dept_name, position, status, id]
);
} else {
const newId = 'USER-' + Math.random().toString(36).substring(2, 9).toUpperCase();
await connection.query(
'INSERT INTO system_users (id, emp_no, user_name, dept_name, position, status) VALUES (?, ?, ?, ?, ?, ?)',
[newId, emp_no, user_name, dept_name, position, status]
);
}
res.json({ success: true });
} catch (err) {
handleError(res, err, 'SAVE SYSTEM USER');
} finally {
if (connection) connection.release();
}
});
// 6.10. Delete System User
app.delete('/api/system-users/:id', async (req, res) => {
const { id } = req.params;
let connection;
try {
connection = await pool.getConnection();
await connection.query('DELETE FROM system_users WHERE id = ?', [id]);
res.json({ success: true });
} catch (err) {
handleError(res, err, 'DELETE SYSTEM USER');
} finally {
if (connection) connection.release();
}
});
app.post('/api/maps/save', (req, res) => {
try {
const { path, boxes } = req.body;
if (!path) return res.status(400).json({ error: 'Path is required' });
let config = {};
if (fs.existsSync('map_config.json')) config = JSON.parse(fs.readFileSync('map_config.json', 'utf8') || '{}');
config[path] = boxes;
fs.writeFileSync('map_config.json', JSON.stringify(config, null, 2));
res.json({ success: true });
} catch (err) { handleError(res, err, 'SAVE MAPS'); }
});
// 7. File Upload API (Base64)
app.post('/api/upload', (req, res) => {
try {
const { fileName, fileData } = req.body;
if (!fileName || !fileData) return res.status(400).json({ error: 'FileName and FileData are required' });
// base64 데이터에서 실제 바이너리 추출
const base64Data = fileData.replace(/^data:.*;base64,/, "");
const buffer = Buffer.from(base64Data, 'base64');
// 고유한 파일명 생성 (타임스탬프 결합)
const timestamp = Date.now();
const safeFileName = `${timestamp}_${fileName.replace(/[^a-zA-Z0-9._-]/g, '_')}`;
const filePath = `uploads/${safeFileName}`;
fs.writeFileSync(filePath, buffer);
console.log(`파일 업로드 성공: ${filePath}`);
res.json({ success: true, filePath: `/${filePath}`, fileName: safeFileName });
} catch (err) {
handleError(res, err, 'FILE UPLOAD');
}
});
// Health check endpoint for container orchestration
app.get('/health', async (req, res) => {
try {
const connection = await pool.getConnection();
const result = await connection.query('SELECT 1');
connection.release();
res.status(200).json({ status: 'ok', db: 'connected' });
} catch (err) {
// Return degraded status if DB unreachable, but still report service as alive
res.status(200).json({ status: 'degraded', db: 'unreachable', error: err.message });
}
});
// Readiness check endpoint (only returns 200 if fully ready)
app.get('/ready', async (req, res) => {
try {
const connection = await pool.getConnection();
const result = await connection.query('SELECT 1');
connection.release();
res.status(200).json({ status: 'ready' });
} catch (err) {
res.status(503).json({ status: 'not_ready', error: err.message });
}
});
app.listen(3000, '0.0.0.0', () => {
console.log('📡 ITAM BACKEND SERVER RUNNING ON PORT 3000 (V3 Normalized)');
});
Loaded 100 of 315 files, more files were not shown because too many files have changed in this diff. Show more