대시보드와 주간보고 기능 업데이트

This commit is contained in:
2026-01-10 14:40:01 +09:00
parent 0dd4b561f0
commit e4627caa4c
26 changed files with 3329 additions and 1720 deletions

View File

@@ -1,15 +1,24 @@
import { queryOne } from '../../utils/db'
import { getSession, getSessionIdFromCookie, deleteSessionCookie } from '../../utils/session'
/**
* 로그인된 사용자 정보 조회
* 로그인된 사용자 상세 정보 조회
* GET /api/auth/me
*/
export default defineEventHandler(async (event) => {
const userId = getCookie(event, 'user_id')
if (!userId) {
const sessionId = getSessionIdFromCookie(event)
if (!sessionId) {
throw createError({ statusCode: 401, message: '로그인이 필요합니다.' })
}
// DB에서 세션 조회
const session = await getSession(sessionId)
if (!session) {
deleteSessionCookie(event)
throw createError({ statusCode: 401, message: '세션이 만료되었습니다. 다시 로그인해주세요.' })
}
const employee = await queryOne<any>(`
SELECT
employee_id,
@@ -22,7 +31,7 @@ export default defineEventHandler(async (event) => {
is_active
FROM wr_employee_info
WHERE employee_id = $1
`, [userId])
`, [session.employeeId])
if (!employee) {
throw createError({ statusCode: 404, message: '사용자를 찾을 수 없습니다.' })