기능검증 중

This commit is contained in:
2026-01-11 12:59:21 +09:00
parent d4620dc1fa
commit 1f9745fdfc
14 changed files with 2000 additions and 88 deletions

View File

@@ -50,7 +50,14 @@ export default defineEventHandler(async (event) => {
createdAt: employee.created_at,
createdIp: employee.created_ip,
updatedAt: employee.updated_at,
updatedIp: employee.updated_ip
updatedIp: employee.updated_ip,
// 계정 관련 필드
hasPassword: !!employee.password_hash,
googleId: employee.google_id,
googleEmail: employee.google_email,
googleLinkedAt: employee.google_linked_at,
lastLoginAt: employee.last_login_at,
lastLoginIp: employee.last_login_ip
},
loginHistory: loginHistory.map(h => ({
historyId: h.history_id,

View File

@@ -0,0 +1,34 @@
import { execute } from '../../../utils/db'
import { getClientIp } from '../../../utils/ip'
import { requireAuth } from '../../../utils/session'
/**
* Google 계정 연결 해제
* POST /api/employee/[id]/unlink-google
*/
export default defineEventHandler(async (event) => {
await requireAuth(event)
const employeeId = parseInt(event.context.params?.id || '0')
if (!employeeId) {
throw createError({ statusCode: 400, message: '사용자 ID가 필요합니다.' })
}
const ip = getClientIp(event)
const result = await execute(`
UPDATE wr_employee_info
SET google_id = NULL,
google_email = NULL,
google_linked_at = NULL,
updated_at = NOW(),
updated_ip = $1
WHERE employee_id = $2
`, [ip, employeeId])
if (result === 0) {
throw createError({ statusCode: 404, message: '사용자를 찾을 수 없습니다.' })
}
return { success: true, message: 'Google 계정 연결이 해제되었습니다.' }
})