diff --git a/backend/api/auth/current-user.get.ts b/backend/api/auth/current-user.get.ts index e983713..fd552a7 100644 --- a/backend/api/auth/current-user.get.ts +++ b/backend/api/auth/current-user.get.ts @@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => { } // DB에서 세션 조회 - const session = await getSession(sessionId) + const session = await getDbSession(sessionId) if (!session) { // 세션이 만료되었거나 없음 → 쿠키 삭제 diff --git a/backend/api/auth/login-history.get.ts b/backend/api/auth/login-history.get.ts index 8bea7c4..56c130e 100644 --- a/backend/api/auth/login-history.get.ts +++ b/backend/api/auth/login-history.get.ts @@ -1,4 +1,4 @@ -import { getSession, getSessionIdFromCookie, deleteSessionCookie, SESSION_TIMEOUT_MINUTES } from '../../utils/session' +import { getDbSession, getSessionIdFromCookie, deleteSessionCookie, SESSION_TIMEOUT_MINUTES } from '../../utils/session' /** * 본인 로그인 이력 조회 @@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => { throw createError({ statusCode: 401, message: '로그인이 필요합니다.' }) } - const session = await getSession(sessionId) + const session = await getDbSession(sessionId) if (!session) { deleteSessionCookie(event) diff --git a/backend/api/auth/logout.post.ts b/backend/api/auth/logout.post.ts index 24b7997..5146364 100644 --- a/backend/api/auth/logout.post.ts +++ b/backend/api/auth/logout.post.ts @@ -1,5 +1,5 @@ import { getClientIp } from '../../utils/ip' -import { getSession, deleteSession, getSessionIdFromCookie, deleteSessionCookie } from '../../utils/session' +import { getDbSession, deleteSession, getSessionIdFromCookie, deleteSessionCookie } from '../../utils/session' /** * 로그아웃 @@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => { if (sessionId) { // 세션 정보 조회 - const session = await getSession(sessionId) + const session = await getDbSession(sessionId) // 로그아웃 이력 기록 if (session?.loginHistoryId) { diff --git a/backend/api/auth/me.get.ts b/backend/api/auth/me.get.ts index 852bbf9..9bc7372 100644 --- a/backend/api/auth/me.get.ts +++ b/backend/api/auth/me.get.ts @@ -1,4 +1,4 @@ -import { getSession, getSessionIdFromCookie, deleteSessionCookie } from '../../utils/session' +import { getDbSession, getSessionIdFromCookie, deleteSessionCookie } from '../../utils/session' /** * 로그인된 사용자 상세 정보 조회 @@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => { } // DB에서 세션 조회 - const session = await getSession(sessionId) + const session = await getDbSession(sessionId) if (!session) { deleteSessionCookie(event) diff --git a/backend/utils/session.ts b/backend/utils/session.ts index a526d69..aa701af 100644 --- a/backend/utils/session.ts +++ b/backend/utils/session.ts @@ -47,7 +47,7 @@ export async function createSession( /** * 세션 조회 (유효한 세션만) */ -export async function getSession(sessionId: string): Promise { +export async function getDbSession(sessionId: string): Promise { if (!sessionId) return null const row = await queryOne(` @@ -168,7 +168,7 @@ export async function getAuthenticatedUserId(event: any): Promise // 1. 새로운 세션 토큰 확인 const sessionId = getSessionIdFromCookie(event) if (sessionId) { - const session = await getSession(sessionId) + const session = await getDbSession(sessionId) if (session) { await refreshSession(sessionId) return session.employeeId