- Added comprehensive validation for user data during registration and updates, including email format, company code existence, user type validation, and password length checks.
- Implemented JWT token invalidation for users when their status changes or when roles are updated, ensuring security and compliance with the latest policies.
- Introduced a new TokenInvalidationService to manage token versioning and invalidation processes efficiently.
- Updated the admin controller to provide detailed error messages and success responses for user status changes and validations.
- Enhanced the authentication middleware to check token versions against the database, ensuring that invalidated tokens cannot be used.
This commit improves the overall security and user management experience within the application.
- Integrated express-async-errors to automatically handle errors in async route handlers, enhancing the overall error management in the application.
- Updated app.ts to include the express-async-errors import for global error handling.
- Removed redundant logging statements in admin and user menu retrieval functions to streamline the code and improve readability.
- Adjusted logging levels from info to debug for less critical logs, ensuring that important information is logged appropriately without cluttering the logs.
Phase 1.5 완료: 인증 서비스 Raw Query 전환 및 테스트 완료
✅ AuthService 전환 완료 (5개 Prisma 호출 제거):
- loginPwdCheck(): Raw Query로 사용자 비밀번호 조회
- insertLoginAccessLog(): Raw Query로 로그인 로그 기록
- getUserInfo(): Raw Query로 사용자/권한/회사 정보 조회
- authority_sub_user ↔ authority_master JOIN (master_objid ↔ objid)
- 3개 쿼리로 분리 (사용자, 권한, 회사)
- processLogin(): 전체 로그인 플로우 통합
- processLogout(): 로그아웃 로그 기록
🧪 테스트 완료:
- 단위 테스트: 30개 테스트 모두 통과 ✅
- 로그인 검증 (6개)
- 사용자 정보 조회 (5개)
- 로그인 로그 기록 (4개)
- 전체 로그인 프로세스 (5개)
- 로그아웃 (2개)
- 토큰 검증 (3개)
- Raw Query 전환 검증 (3개)
- 성능 테스트 (2개)
- 통합 테스트: 작성 완료 (auth.integration.test.ts)
- 로그인 → 토큰 발급 → 인증 → 로그아웃 플로우
🔧 주요 변경사항:
- Prisma import 제거 → Raw Query (query from db.ts)
- authority 테이블 JOIN 수정 (auth_code → master_objid/objid)
- 파라미터 바인딩으로 SQL Injection 방지
- 타입 안전성 유지 (TypeScript Generic 사용)
📊 성능:
- 로그인 프로세스: < 1초
- 사용자 정보 조회: < 500ms
- 모든 테스트 실행 시간: 2.016초
🎯 다음 단계:
- Phase 2: 핵심 서비스 전환 (ScreenManagement, TableManagement 등)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>