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:
@@ -22,23 +22,23 @@ const logger = require('../utils/logger');
|
||||
* @param {string} issueData.start_time - 이슈 시작 시간
|
||||
* @param {string} issueData.end_time - 이슈 종료 시간
|
||||
* @param {number} issueData.issue_type_id - 이슈 유형 ID
|
||||
* @param {number[]} issueData.worker_ids - 작업자 ID 배열
|
||||
* @param {number[]} issueData.user_ids - 작업자 ID 배열
|
||||
* @returns {Promise<object>} 생성 결과
|
||||
*/
|
||||
const createDailyIssueReportService = async (issueData) => {
|
||||
const { date, project_id, start_time, end_time, issue_type_id, worker_ids } = issueData;
|
||||
const { date, project_id, start_time, end_time, issue_type_id, user_ids } = issueData;
|
||||
|
||||
// 필수 필드 검증
|
||||
if (!date || !project_id || !start_time || !end_time || !issue_type_id || !worker_ids) {
|
||||
if (!date || !project_id || !start_time || !end_time || !issue_type_id || !user_ids) {
|
||||
throw new ValidationError('필수 필드가 누락되었습니다', {
|
||||
required: ['date', 'project_id', 'start_time', 'end_time', 'issue_type_id', 'worker_ids'],
|
||||
received: { date, project_id, start_time, end_time, issue_type_id, worker_ids: !!worker_ids }
|
||||
required: ['date', 'project_id', 'start_time', 'end_time', 'issue_type_id', 'user_ids'],
|
||||
received: { date, project_id, start_time, end_time, issue_type_id, user_ids: !!user_ids }
|
||||
});
|
||||
}
|
||||
|
||||
if (!Array.isArray(worker_ids) || worker_ids.length === 0) {
|
||||
throw new ValidationError('worker_ids는 최소 한 명 이상의 작업자를 포함하는 배열이어야 합니다', {
|
||||
received: { worker_ids, isArray: Array.isArray(worker_ids), length: worker_ids?.length }
|
||||
if (!Array.isArray(user_ids) || user_ids.length === 0) {
|
||||
throw new ValidationError('user_ids는 최소 한 명 이상의 작업자를 포함하는 배열이어야 합니다', {
|
||||
received: { user_ids, isArray: Array.isArray(user_ids), length: user_ids?.length }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,17 +46,17 @@ const createDailyIssueReportService = async (issueData) => {
|
||||
date,
|
||||
project_id,
|
||||
issue_type_id,
|
||||
worker_count: worker_ids.length
|
||||
worker_count: user_ids.length
|
||||
});
|
||||
|
||||
// 모델에 전달할 데이터 준비
|
||||
const reportsToCreate = worker_ids.map(worker_id => ({
|
||||
const reportsToCreate = user_ids.map(user_id => ({
|
||||
date,
|
||||
project_id,
|
||||
start_time,
|
||||
end_time,
|
||||
issue_type_id,
|
||||
worker_id
|
||||
user_id
|
||||
}));
|
||||
|
||||
try {
|
||||
@@ -75,7 +75,7 @@ const createDailyIssueReportService = async (issueData) => {
|
||||
logger.error('이슈 보고서 생성 실패', {
|
||||
date,
|
||||
project_id,
|
||||
worker_ids,
|
||||
user_ids,
|
||||
error: error.message
|
||||
});
|
||||
throw new DatabaseError('이슈 보고서 생성 중 오류가 발생했습니다');
|
||||
|
||||
Reference in New Issue
Block a user