import type { H3Event } from 'h3' import { queryOne } from './db' import { getAuthenticatedUserId } from './session' /** * 현재 로그인한 사용자의 ID 조회 */ export async function getCurrentUserId(event: H3Event): Promise { return await getAuthenticatedUserId(event) } /** * 현재 로그인한 사용자의 이메일 조회 */ export async function getCurrentUserEmail(event: H3Event): Promise { const userId = await getAuthenticatedUserId(event) if (!userId) return null const user = await queryOne<{ employee_email: string }>(` SELECT employee_email FROM wr_employee_info WHERE employee_id = $1 `, [userId]) return user?.employee_email || null }