diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-03 04:48:47 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-03 04:48:47 +0000 |
| commit | defda07c0bb4b0bd444ca8dc4fd3f89322bda0ce (patch) | |
| tree | d7f257781f107d7ec2fd4ef76cb4f840f5065a06 /lib/tbe-last/service.ts | |
| parent | 00743c8b4190fac9117c2d9c08981bbfdce576de (diff) | |
(대표님) edp, tbe, dolce 등
Diffstat (limited to 'lib/tbe-last/service.ts')
| -rw-r--r-- | lib/tbe-last/service.ts | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/tbe-last/service.ts b/lib/tbe-last/service.ts index da0a5a4c..346576e5 100644 --- a/lib/tbe-last/service.ts +++ b/lib/tbe-last/service.ts @@ -1,11 +1,11 @@ // lib/tbe-last/service.ts 'use server' -import { revalidatePath, unstable_cache } from "next/cache"; +import { revalidatePath, revalidateTag, unstable_cache } from "next/cache"; import db from "@/db/db"; import { and, desc, asc, eq, sql, or, isNull, isNotNull, ne, inArray } from "drizzle-orm"; import { tbeLastView, tbeDocumentsView } from "@/db/schema"; -import { rfqPrItems } from "@/db/schema/rfqLast"; +import { rfqPrItems, rfqsLast } from "@/db/schema/rfqLast"; import {rfqLastDetails, rfqLastTbeDocumentReviews, rfqLastTbePdftronComments, rfqLastTbeVendorDocuments,rfqLastTbeSessions } from "@/db/schema"; import { filterColumns } from "@/lib/filter-columns"; import { GetTBELastSchema } from "./validations"; @@ -320,10 +320,22 @@ export async function updateTbeEvaluation( // 상태 업데이트 if (data.status !== undefined) { updateData.status = data.status - + // 완료 상태로 변경 시 종료일 설정 if (data.status === "완료") { updateData.actualEndDate = new Date() + + // TBE 완료 시 연결된 RFQ 상태를 "TBE 완료"로 업데이트 + if (currentTbeSession.rfqsLastId) { + await db + .update(rfqsLast) + .set({ + status: "TBE 완료", + updatedBy: userId, + updatedAt: new Date() + }) + .where(eq(rfqsLast.id, currentTbeSession.rfqsLastId)) + } } } @@ -337,10 +349,11 @@ export async function updateTbeEvaluation( // 캐시 초기화 revalidateTag(`tbe-session-${tbeSessionId}`) revalidateTag(`tbe-sessions`) - + // RFQ 관련 캐시도 초기화 if (currentTbeSession.rfqsLastId) { revalidateTag(`rfq-${currentTbeSession.rfqsLastId}`) + revalidateTag(`rfqs`) } return { |
