From 44bdb81a60d3a44ba7e379f3c20fe6d8fb284339 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 7 Jul 2025 08:24:16 +0000 Subject: (대표님) 변경사항 20250707 12시 30분 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/evaluation/service.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/evaluation') 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("인증이 필요합니다") } -- cgit v1.2.3