feat(tkuser): 입사일 자동표시 + 퇴사자 목록 분리 + 퇴사일 관리

- 사용자 추가 시 hire_date 전송 (서울 오늘날짜 기본값)
- resigned_date 컬럼 마이그레이션 + CRUD 지원
- 비활성화(삭제) 시 resigned_date 자동 설정 (COALESCE)
- 활성/비활성 사용자 목록 분리, 퇴사자 접기/펼치기
- 퇴사자 재활성화 기능 (resigned_date 초기화)
- 편집 모달에 퇴사일 필드 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-23 15:47:14 +09:00
parent 1f3eb14128
commit f09aa0875a
8 changed files with 120 additions and 27 deletions

View File

@@ -59,4 +59,25 @@ async function runMigration() {
console.log('[tkuser] Sprint 001 migration completed');
}
module.exports = { getAll, getByKey, updateSettings, loadAsObject, runMigration };
async function runGenericMigration(filename) {
const db = getPool();
const fs = require('fs');
const path = require('path');
const sqlFile = path.join(__dirname, '..', '..', 'migrations', filename);
const sql = fs.readFileSync(sqlFile, 'utf8');
const statements = sql.split(';').map(s => s.trim()).filter(s => s.length > 0);
for (const stmt of statements) {
try {
await db.query(stmt);
} catch (err) {
if (['ER_DUP_FIELDNAME', 'ER_TABLE_EXISTS_ERROR', 'ER_DUP_KEYNAME'].includes(err.code)) {
// Already migrated — safe to ignore
} else {
throw err;
}
}
}
console.log(`[tkuser] Migration ${filename} completed`);
}
module.exports = { getAll, getByKey, updateSettings, loadAsObject, runMigration, runGenericMigration };