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:
@@ -124,10 +124,10 @@
|
||||
|
||||
function isMySession(s) {
|
||||
var userId = currentUser.user_id;
|
||||
var workerId = currentUser.worker_id;
|
||||
var workerId = currentUser.user_id;
|
||||
var userName = currentUser.name;
|
||||
return (userId && String(s.created_by) === String(userId)) ||
|
||||
(workerId && String(s.leader_id) === String(workerId)) ||
|
||||
(workerId && String(s.leader_user_id) === String(workerId)) ||
|
||||
(userName && s.created_by_name === userName);
|
||||
}
|
||||
|
||||
@@ -645,7 +645,7 @@
|
||||
var wpId = document.getElementById('de_wp_' + i).value || null;
|
||||
|
||||
members.push({
|
||||
worker_id: m.worker_id,
|
||||
user_id: m.user_id,
|
||||
project_id: m.project_id || deSession.project_id || null,
|
||||
work_type_id: m.work_type_id || deSession.work_type_id || null,
|
||||
task_id: taskId ? parseInt(taskId) : null,
|
||||
@@ -798,7 +798,7 @@
|
||||
if (type === 'early' && (!hours || hours <= 0)) {
|
||||
window.showToast(esc(completeTeamMembers[i].worker_name) + '의 근무 시간을 입력해주세요.', 'error'); return;
|
||||
}
|
||||
attendanceData.push({ worker_id: completeTeamMembers[i].worker_id, attendance_type: type, attendance_hours: hours });
|
||||
attendanceData.push({ user_id: completeTeamMembers[i].user_id, attendance_type: type, attendance_hours: hours });
|
||||
}
|
||||
|
||||
var btn = document.getElementById('completeSheetBtn');
|
||||
@@ -996,7 +996,7 @@
|
||||
|
||||
// 1) 기존 항목: 시간만 줄이기 (프로젝트/공정 유지)
|
||||
await window.TbmAPI.updateTeamMember(deSessionId, {
|
||||
worker_id: m.worker_id,
|
||||
user_id: m.user_id,
|
||||
project_id: m.project_id || null,
|
||||
work_type_id: m.work_type_id || null,
|
||||
task_id: m.task_id || null,
|
||||
@@ -1009,7 +1009,7 @@
|
||||
|
||||
// 2) 나머지 시간으로 새 항목 추가 (프로젝트/공정 변경 가능)
|
||||
await window.TbmAPI.splitAssignment(deSessionId, {
|
||||
worker_id: m.worker_id,
|
||||
user_id: m.user_id,
|
||||
work_hours: remainHoursKeep,
|
||||
project_id: newProjectId,
|
||||
work_type_id: newWorkTypeId
|
||||
@@ -1033,7 +1033,7 @@
|
||||
// transfer API 호출
|
||||
var res = await window.TbmAPI.transfer({
|
||||
transfer_type: 'send',
|
||||
worker_id: m.worker_id,
|
||||
user_id: m.user_id,
|
||||
source_session_id: deSessionId,
|
||||
dest_session_id: splitTargetSessionId,
|
||||
hours: remainHours,
|
||||
@@ -1094,7 +1094,7 @@
|
||||
if (!myDraftSession) {
|
||||
btnHtml = '<button type="button" class="pull-btn" disabled title="내 TBM이 없음">내 TBM 없음</button>';
|
||||
} else {
|
||||
btnHtml = '<button type="button" class="pull-btn" onclick="event.stopPropagation(); startPull(' + m.worker_id + ', \'' + esc(m.worker_name).replace(/'/g, "\\'") + '\', ' + hours + ')">빼오기</button>';
|
||||
btnHtml = '<button type="button" class="pull-btn" onclick="event.stopPropagation(); startPull(' + m.user_id + ', \'' + esc(m.worker_name).replace(/'/g, "\\'") + '\', ' + hours + ')">빼오기</button>';
|
||||
}
|
||||
|
||||
html += '<div class="pull-member-item">' +
|
||||
@@ -1129,7 +1129,7 @@
|
||||
};
|
||||
|
||||
window.startPull = async function(workerId, workerName, maxHours) {
|
||||
pullWorker = { worker_id: workerId, worker_name: workerName, max_hours: maxHours };
|
||||
pullWorker = { user_id: workerId, worker_name: workerName, max_hours: maxHours };
|
||||
document.getElementById('pullHoursTitle').textContent = esc(workerName) + ' 빼오기';
|
||||
document.getElementById('pullHoursSubtitle').textContent = '최대 ' + maxHours + 'h 가능';
|
||||
document.getElementById('pullHoursInput').value = maxHours;
|
||||
@@ -1167,7 +1167,7 @@
|
||||
var pullWorkTypeId = document.getElementById('pullWorkTypeId').value || null;
|
||||
var res = await window.TbmAPI.transfer({
|
||||
transfer_type: 'pull',
|
||||
worker_id: pullWorker.worker_id,
|
||||
user_id: pullWorker.user_id,
|
||||
source_session_id: pullSessionId,
|
||||
dest_session_id: myDraftSession.session_id,
|
||||
hours: hours,
|
||||
@@ -1230,13 +1230,13 @@
|
||||
// 현재 세션 리더를 제외한 반장/그룹장 목록
|
||||
var leaders = workers.filter(function(w) {
|
||||
return (w.job_type === 'leader' || w.job_type === '그룹장' || w.job_type === 'admin') &&
|
||||
w.worker_id !== handoverSession.leader_id;
|
||||
w.user_id !== handoverSession.leader_user_id;
|
||||
});
|
||||
|
||||
var leaderSelect = document.getElementById('handoverLeaderId');
|
||||
leaderSelect.innerHTML = '<option value="">반장 선택...</option>' +
|
||||
leaders.map(function(w) {
|
||||
return '<option value="' + w.worker_id + '">' + esc(w.worker_name) + ' (' + (w.job_type || '') + ')</option>';
|
||||
return '<option value="' + w.user_id + '">' + esc(w.worker_name) + ' (' + (w.job_type || '') + ')</option>';
|
||||
}).join('');
|
||||
|
||||
// 인계할 팀원 체크리스트
|
||||
@@ -1246,7 +1246,7 @@
|
||||
} else {
|
||||
listEl.innerHTML = team.map(function(m) {
|
||||
return '<label style="display:flex; align-items:center; gap:0.5rem; padding:0.5rem; cursor:pointer;">' +
|
||||
'<input type="checkbox" class="handover-worker-cb" value="' + m.worker_id + '" checked style="width:16px; height:16px;">' +
|
||||
'<input type="checkbox" class="handover-worker-cb" value="' + m.user_id + '" checked style="width:16px; height:16px;">' +
|
||||
'<span style="font-weight:500; font-size:0.875rem;">' + esc(m.worker_name) + '</span>' +
|
||||
'<span style="font-size:0.75rem; color:#6b7280; margin-left:auto;">' + (m.job_type || '') + '</span>' +
|
||||
'</label>';
|
||||
@@ -1301,13 +1301,13 @@
|
||||
|
||||
var handoverData = {
|
||||
session_id: handoverSessionId,
|
||||
from_leader_id: handoverSession.leader_id,
|
||||
to_leader_id: toLeaderId,
|
||||
from_leader_user_id: handoverSession.leader_user_id,
|
||||
to_leader_user_id: toLeaderId,
|
||||
handover_date: today,
|
||||
handover_time: now,
|
||||
reason: '모바일 인계',
|
||||
handover_notes: notes,
|
||||
worker_ids: workerIds
|
||||
user_ids: workerIds
|
||||
};
|
||||
|
||||
var res = await window.TbmAPI.saveHandover(handoverData);
|
||||
|
||||
Reference in New Issue
Block a user