diff options
Diffstat (limited to 'lib/evaluation')
| -rw-r--r-- | lib/evaluation/service.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/evaluation/service.ts b/lib/evaluation/service.ts index 67a692ab..bbe9daa9 100644 --- a/lib/evaluation/service.ts +++ b/lib/evaluation/service.ts @@ -28,7 +28,8 @@ import { GetEvaluationTargetsSchema } from "../evaluation-target-list/validation import { sendEmail } from "../mail/sendEmail" import { revalidatePath } from "next/cache" import { DEPARTMENT_CODE_LABELS } from "@/types/evaluation" - +import { getServerSession } from "next-auth" +import { authOptions } from "@/app/api/auth/[...nextauth]/route" export async function getPeriodicEvaluations(input: GetEvaluationTargetsSchema) { try { @@ -756,8 +757,8 @@ export async function finalizeEvaluations( ) { try { // 현재 사용자 정보 가져오기 - const currentUser = await getCurrentUser() - if (!currentUser) { + const session = await getServerSession(authOptions) + if (!session?.user) { throw new Error("인증이 필요합니다") } @@ -795,7 +796,7 @@ export async function finalizeEvaluations( finalGrade: evaluation.finalGrade, status: "FINALIZED", finalizedAt: now, - finalizedBy: currentUser.id, + finalizedBy: session?.user?.id ? Number(session.user.id) : null, updatedAt: now, }) .where(eq(periodicEvaluations.id, evaluation.id)) @@ -824,8 +825,8 @@ export async function finalizeEvaluations( */ export async function unfinalizeEvaluations(evaluationIds: number[]) { try { - const currentUser = await getCurrentUser() - if (!currentUser) { + const session = await getServerSession(authOptions) + if (!session?.user) { throw new Error("인증이 필요합니다") } |
