기능구현중
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
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 계정 연결이 해제되었습니다.' }
|
||||
})
|
||||
Reference in New Issue
Block a user