Files
TK-FB-Project/api.hyungi.net/db/migrations/20260129000001_register_attendance_pages.js
Hyungi Ahn b6485e3140 feat: 대시보드 작업장 현황 지도 구현
- 실시간 작업장 현황을 지도로 시각화
- 작업장 관리 페이지에서 정의한 구역 정보 활용
- TBM 작업자 및 방문자 현황 표시

주요 변경사항:
- dashboard.html: 작업장 현황 섹션 추가 (기존 작업 현황 테이블 제거)
- workplace-status.js: 지도 렌더링 및 데이터 통합 로직 구현
- modern-dashboard.js: 삭제된 DOM 요소 조건부 체크 추가

시각화 방식:
- 인원 없음: 회색 테두리 + 작업장 이름
- 내부 작업자: 파란색 영역 + 인원 수
- 외부 방문자: 보라색 영역 + 인원 수
- 둘 다: 초록색 영역 + 총 인원 수

기술 구현:
- Canvas API 기반 사각형 영역 렌더링
- map-regions API를 통한 데이터 일관성 보장
- 클릭 이벤트로 상세 정보 모달 표시

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 15:46:47 +09:00

85 lines
2.5 KiB
JavaScript

/**
* Migration: Register attendance management pages
* Purpose: Add 4 new pages to pages table for attendance management system
* Date: 2026-01-29
*/
exports.up = async function(knex) {
// 페이지 등록 (실제 pages 테이블 컬럼에 맞춤)
await knex('pages').insert([
{
page_key: 'daily-attendance',
page_name: '일일 출퇴근 입력',
page_path: '/pages/common/daily-attendance.html',
description: '일일 출퇴근 기록 입력 페이지 (관리자/조장)',
category: 'common',
is_admin_only: false,
display_order: 50
},
{
page_key: 'monthly-attendance',
page_name: '월별 출퇴근 현황',
page_path: '/pages/common/monthly-attendance.html',
description: '월별 출퇴근 현황 조회 페이지',
category: 'common',
is_admin_only: false,
display_order: 51
},
{
page_key: 'vacation-management',
page_name: '휴가 관리',
page_path: '/pages/common/vacation-management.html',
description: '휴가 신청 및 승인 관리 페이지',
category: 'common',
is_admin_only: false,
display_order: 52
},
{
page_key: 'attendance-report-comparison',
page_name: '출퇴근-작업보고서 대조',
page_path: '/pages/admin/attendance-report-comparison.html',
description: '출퇴근 기록과 작업보고서 대조 페이지 (관리자)',
category: 'admin',
is_admin_only: true,
display_order: 120
}
]);
console.log('✅ 출퇴근 관리 페이지 4개 등록 완료');
// Admin 사용자(user_id=1)에게 페이지 접근 권한 부여
const adminUserId = 1;
const pages = await knex('pages')
.whereIn('page_key', [
'daily-attendance',
'monthly-attendance',
'vacation-management',
'attendance-report-comparison'
])
.select('id');
const accessRecords = pages.map(page => ({
user_id: adminUserId,
page_id: page.id,
can_access: true,
granted_by: adminUserId
}));
await knex('user_page_access').insert(accessRecords);
console.log('✅ Admin 사용자에게 출퇴근 관리 페이지 접근 권한 부여 완료');
};
exports.down = async function(knex) {
// 페이지 삭제 (user_page_access는 FK CASCADE로 자동 삭제됨)
await knex('pages')
.whereIn('page_key', [
'daily-attendance',
'monthly-attendance',
'vacation-management',
'attendance-report-comparison'
])
.delete();
console.log('✅ 출퇴근 관리 페이지 삭제 완료');
};