refactor: worker_id → user_id 전체 마이그레이션 (Phase 1-4)

sso_users.user_id를 단일 식별자로 통합. JWT에서 worker_id 제거,
department_id/is_production 추가. 백엔드 15개 모델, 11개 컨트롤러,
4개 서비스, 7개 라우트, 프론트엔드 32+ JS/11+ HTML 변환.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-05 13:13:10 +09:00
parent 2197cdb3d5
commit abd7564e6b
90 changed files with 1790 additions and 925 deletions

View File

@@ -322,7 +322,7 @@ async function fetchDailyWorkReports(date) {
async function updateWorkerHours(workerId, date, newHours, reason = '') {
try {
const data = {
worker_id: workerId,
user_id: workerId,
report_date: date,
work_hours: parseFloat(newHours),
modification_reason: reason,
@@ -412,7 +412,7 @@ async function calculateDateStatus(dateStr) {
status = 'missing';
} else {
const hasDiscrepancy = workReports.some(wr => {
const dr = dailyReports.find(d => d.worker_id === wr.worker_id);
const dr = dailyReports.find(d => d.user_id === wr.user_id);
if (!dr) return true;
const expected = calculateExpectedHours(wr.status, wr.overtime_hours);
@@ -607,8 +607,8 @@ async function getWorkersForDate(dateStr) {
// WorkReports 데이터 추가
workReports.forEach(wr => {
workerMap.set(wr.worker_id, {
worker_id: wr.worker_id,
workerMap.set(wr.user_id, {
user_id: wr.user_id,
worker_name: wr.worker_name,
overtime_hours: wr.overtime_hours || 0,
status: wr.status || 'normal',
@@ -621,13 +621,13 @@ async function getWorkersForDate(dateStr) {
// DailyReports 데이터 추가
dailyReports.forEach(dr => {
if (workerMap.has(dr.worker_id)) {
const worker = workerMap.get(dr.worker_id);
if (workerMap.has(dr.user_id)) {
const worker = workerMap.get(dr.user_id);
worker.reported_hours = dr.work_hours;
worker.hasDailyReport = true;
} else {
workerMap.set(dr.worker_id, {
worker_id: dr.worker_id,
workerMap.set(dr.user_id, {
user_id: dr.user_id,
worker_name: dr.worker_name,
overtime_hours: 0,
status: 'normal',
@@ -739,7 +739,7 @@ async function saveEditedWork() {
showMessage('수정 중...', 'loading');
await updateWorkerHours(editingWorker.worker_id, selectedDate, newHours, reason);
await updateWorkerHours(editingWorker.user_id, selectedDate, newHours, reason);
showMessage('✅ 근무시간이 성공적으로 수정되었습니다!', 'success');
closeEditModal();
@@ -767,7 +767,7 @@ async function deleteWorker(worker) {
try {
showMessage('삭제 중...', 'loading');
await deleteWorkerReport(worker.worker_id, selectedDate);
await deleteWorkerReport(worker.user_id, selectedDate);
showMessage('✅ 작업 데이터가 성공적으로 삭제되었습니다!', 'success');
@@ -884,7 +884,7 @@ function renderWorkersList(workers) {
</div>
<div>
<div class="worker-name">${worker.worker_name}</div>
<div class="worker-id">작업자 ID: ${worker.worker_id}</div>
<div class="worker-id">작업자 ID: ${worker.user_id}</div>
</div>
</div>
<div class="status-badge">${getStatusIcon(worker.validationStatus)}</div>