직원정보수정오류 해결

This commit is contained in:
2026-01-05 14:09:22 +09:00
parent cfbd9e71ca
commit 0dd4b561f0
3 changed files with 28 additions and 5 deletions

View File

@@ -2,6 +2,9 @@ import { execute, queryOne } from '../../../utils/db'
import { getClientIp } from '../../../utils/ip'
import { getCurrentUserEmail } from '../../../utils/user'
// 빈 문자열을 null로 변환 (date 타입 등에서 필요)
const emptyToNull = (value: any) => (value === '' ? null : value)
interface UpdateEmployeeBody {
employeeName?: string
employeePhone?: string
@@ -43,10 +46,10 @@ export default defineEventHandler(async (event) => {
WHERE employee_id = $9
`, [
body.employeeName ?? existing.employee_name,
body.employeePhone ?? existing.employee_phone,
body.employeePosition ?? existing.employee_position,
emptyToNull(body.employeePhone) ?? existing.employee_phone,
emptyToNull(body.employeePosition) ?? existing.employee_position,
body.company ?? existing.company,
body.joinDate ?? existing.join_date,
emptyToNull(body.joinDate) ?? existing.join_date,
body.isActive ?? existing.is_active,
clientIp,
userEmail,