refactor: System1 API 인증 체계 SSO 전환 및 마이그레이션 정비

- SSO JWT 인증으로 전환 (auth.service.js)
- worker_id → user_id 마이그레이션 완료
- departments 연동, CORS 미들웨어 정리
- 불필요 파일 삭제 (tk_database.db, visitRequestController.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-06 23:18:00 +09:00
parent 2f7e083db0
commit ec755ed52f
47 changed files with 181 additions and 716 deletions

View File

@@ -33,7 +33,7 @@ exports.createWorker = asyncHandler(async (req, res) => {
try {
const db = await getDb();
const username = await generateUniqueUsername(workerData.worker_name, db);
const hashedPassword = await bcrypt.hash('1234', 10);
const hashedPassword = await bcrypt.hash(process.env.DEFAULT_PASSWORD || 'changeme!1', 10);
// User 역할 조회
const [userRole] = await db.query('SELECT id FROM roles WHERE name = ?', ['User']);
@@ -139,13 +139,6 @@ exports.updateWorker = asyncHandler(async (req, res) => {
const workerData = { ...req.body, user_id: id };
const createAccount = req.body.create_account;
console.log('🔧 작업자 수정 요청:', {
user_id: id,
받은데이터: req.body,
처리할데이터: workerData,
create_account: createAccount
});
// 먼저 현재 작업자 정보 조회 (계정 여부 확인용, user_id 기준)
const currentWorker = await workerModel.getByUserId(id);
@@ -166,7 +159,7 @@ exports.updateWorker = asyncHandler(async (req, res) => {
// 계정 생성
try {
const username = await generateUniqueUsername(workerData.worker_name, db);
const hashedPassword = await bcrypt.hash('1234', 10);
const hashedPassword = await bcrypt.hash(process.env.DEFAULT_PASSWORD || 'changeme!1', 10);
const [userRole] = await db.query('SELECT id FROM roles WHERE name = ?', ['User']);