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:
@@ -581,7 +581,7 @@ window.submitTbmWorkReport = async function(index) {
|
||||
const reportData = {
|
||||
tbm_assignment_id: tbm.assignment_id,
|
||||
tbm_session_id: tbm.session_id,
|
||||
worker_id: tbm.worker_id,
|
||||
user_id: tbm.user_id,
|
||||
project_id: tbm.project_id,
|
||||
work_type_id: tbm.task_id, // task_id를 work_type_id 컬럼에 저장 (직접 작업보고서와 일관성 유지)
|
||||
report_date: reportDate,
|
||||
@@ -729,7 +729,7 @@ window.batchSubmitTbmSession = async function(sessionKey) {
|
||||
data: {
|
||||
tbm_assignment_id: tbm.assignment_id,
|
||||
tbm_session_id: tbm.session_id,
|
||||
worker_id: tbm.worker_id,
|
||||
user_id: tbm.user_id,
|
||||
project_id: tbm.project_id,
|
||||
work_type_id: tbm.task_id, // task_id를 work_type_id 컬럼에 저장 (일관성 유지)
|
||||
report_date: reportDate,
|
||||
@@ -847,7 +847,7 @@ window.addManualWorkRow = function() {
|
||||
<td>
|
||||
<select class="form-input-compact" id="worker_${manualIndex}" style="width: 120px;" required>
|
||||
<option value="">작업자 선택</option>
|
||||
${workers.map(w => `<option value="${escapeHtml(String(w.worker_id))}">${escapeHtml(w.worker_name)} (${escapeHtml(w.job_type || '-')})</option>`).join('')}
|
||||
${workers.map(w => `<option value="${escapeHtml(String(w.user_id))}">${escapeHtml(w.worker_name)} (${escapeHtml(w.job_type || '-')})</option>`).join('')}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
@@ -1418,7 +1418,7 @@ window.submitManualWorkReport = async function(manualIndex) {
|
||||
// 주의: 서비스에서 task_id를 work_type_id 컬럼에 매핑함
|
||||
const reportData = {
|
||||
report_date: reportDate,
|
||||
worker_id: parseInt(workerId),
|
||||
user_id: parseInt(workerId),
|
||||
work_entries: [{
|
||||
project_id: parseInt(projectId),
|
||||
task_id: parseInt(taskId), // 서비스에서 work_type_id로 매핑됨
|
||||
@@ -1577,7 +1577,7 @@ window.submitAllManualWorkReports = async function() {
|
||||
// 서비스 레이어가 기대하는 형식으로 변환
|
||||
const reportData = {
|
||||
report_date: reportDate,
|
||||
worker_id: parseInt(workerId),
|
||||
user_id: parseInt(workerId),
|
||||
work_entries: [{
|
||||
project_id: parseInt(projectId),
|
||||
task_id: parseInt(taskId),
|
||||
@@ -2282,7 +2282,7 @@ async function loadTbmTeamForDate(date) {
|
||||
// 팀 구성 조회
|
||||
const teamRes = await window.apiCall(`/tbm/sessions/${targetSession.session_id}/team`);
|
||||
if (teamRes && teamRes.success && teamRes.data) {
|
||||
const teamWorkerIds = teamRes.data.map(m => m.worker_id);
|
||||
const teamWorkerIds = teamRes.data.map(m => m.user_id);
|
||||
console.log(`✅ TBM 팀 구성 로드 성공: ${teamWorkerIds.length}명`);
|
||||
return teamWorkerIds;
|
||||
}
|
||||
@@ -2334,16 +2334,16 @@ async function populateWorkerGrid() {
|
||||
btn.type = 'button';
|
||||
btn.className = 'worker-card';
|
||||
btn.textContent = worker.worker_name;
|
||||
btn.dataset.id = worker.worker_id;
|
||||
btn.dataset.id = worker.user_id;
|
||||
|
||||
// TBM 팀 구성에 포함된 작업자는 자동 선택
|
||||
if (tbmWorkerIds.includes(worker.worker_id)) {
|
||||
if (tbmWorkerIds.includes(worker.user_id)) {
|
||||
btn.classList.add('selected');
|
||||
selectedWorkers.add(worker.worker_id);
|
||||
selectedWorkers.add(worker.user_id);
|
||||
}
|
||||
|
||||
btn.addEventListener('click', () => {
|
||||
toggleWorkerSelection(worker.worker_id, btn);
|
||||
toggleWorkerSelection(worker.user_id, btn);
|
||||
});
|
||||
|
||||
grid.appendChild(btn);
|
||||
@@ -2673,12 +2673,12 @@ async function saveWorkReport() {
|
||||
const failureDetails = [];
|
||||
|
||||
for (const workerId of selectedWorkers) {
|
||||
const workerName = workers.find(w => w.worker_id == workerId)?.worker_name || '알 수 없음';
|
||||
const workerName = workers.find(w => w.user_id == workerId)?.worker_name || '알 수 없음';
|
||||
|
||||
// 서버가 기대하는 work_entries 배열 형태로 전송
|
||||
const requestData = {
|
||||
report_date: reportDate,
|
||||
worker_id: parseInt(workerId),
|
||||
user_id: parseInt(workerId),
|
||||
work_entries: newWorkEntries.map(entry => ({
|
||||
project_id: entry.project_id,
|
||||
task_id: entry.work_type_id, // 서버에서 task_id로 기대
|
||||
|
||||
Reference in New Issue
Block a user