This commit is contained in:
2026-01-04 20:58:47 +09:00
parent a87c11597a
commit 0660ed3973
37 changed files with 1723 additions and 885 deletions

16
backend/utils/user.ts Normal file
View File

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