Files
tk-factory-services/system3-nonconformance/web/sync-projects-from-db.html
Hyungi Ahn 550633b89d feat: 3-System 분리 프로젝트 초기 코드 작성
TK-FB(공장관리+신고)와 M-Project(부적합관리)를 3개 독립 시스템으로
분리하기 위한 전체 코드 구조 작성.
- SSO 인증 서비스 (bcrypt + pbkdf2 이중 해시 지원)
- System 1: 공장관리 (TK-FB 기반, 신고 코드 제거)
- System 2: 신고 (TK-FB에서 workIssue 코드 추출)
- System 3: 부적합관리 (M-Project 기반)
- Gateway 포털 (path-based 라우팅)
- 통합 docker-compose.yml 및 배포 스크립트

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:40:11 +09:00

105 lines
3.8 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>프로젝트 DB → localStorage 동기화</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
max-width: 800px;
margin: 0 auto;
}
.status {
padding: 15px;
margin: 10px 0;
border-radius: 5px;
}
.success { background: #d4edda; color: #155724; }
.error { background: #f8d7da; color: #721c24; }
.info { background: #d1ecf1; color: #0c5460; }
pre { background: #f4f4f4; padding: 10px; overflow-x: auto; }
</style>
</head>
<body>
<h1>프로젝트 DB → localStorage 동기화</h1>
<div id="status"></div>
<pre id="result"></pre>
<button onclick="syncProjects()">동기화 시작</button>
<button onclick="location.href='index.html'">메인으로</button>
<script>
// DB의 프로젝트 데이터 (backend에서 확인한 데이터)
const dbProjects = [
{
id: 1,
jobNo: 'TKR-25009R',
projectName: 'M Project',
isActive: true,
createdAt: '2025-10-24T09:49:42.456272+09:00',
createdByName: '관리자'
},
{
id: 2,
jobNo: 'TKG-24011P',
projectName: 'TKG Project',
isActive: true,
createdAt: '2025-10-24T10:59:49.71909+09:00',
createdByName: '관리자'
}
];
function showStatus(message, type = 'info') {
const statusDiv = document.getElementById('status');
statusDiv.className = 'status ' + type;
statusDiv.textContent = message;
}
function syncProjects() {
try {
// 기존 localStorage 데이터 확인
const existing = localStorage.getItem('work-report-projects');
if (existing) {
showStatus('기존 localStorage 데이터가 있습니다. 덮어쓰시겠습니까?', 'info');
if (!confirm('기존 프로젝트 데이터를 DB 데이터로 덮어쓰시겠습니까?')) {
showStatus('동기화 취소됨', 'error');
return;
}
}
// localStorage에 저장
localStorage.setItem('work-report-projects', JSON.stringify(dbProjects));
// 결과 표시
document.getElementById('result').textContent = JSON.stringify(dbProjects, null, 2);
showStatus('✅ DB 프로젝트 2개를 localStorage로 동기화 완료!', 'success');
// 2초 후 메인으로 이동
setTimeout(() => {
alert('동기화가 완료되었습니다. 메인 페이지로 이동합니다.');
location.href = 'index.html';
}, 2000);
} catch (error) {
showStatus('❌ 동기화 실패: ' + error.message, 'error');
}
}
// 페이지 로드 시 현재 상태 표시
window.onload = () => {
const current = localStorage.getItem('work-report-projects');
if (current) {
showStatus('현재 localStorage에 프로젝트 데이터가 있습니다.', 'info');
document.getElementById('result').textContent = 'Current: ' + current;
} else {
showStatus('localStorage에 프로젝트 데이터가 없습니다.', 'info');
}
};
</script>
</body>
</html>