diff options
| author | joonhoekim <26rote@gmail.com> | 2025-08-12 09:50:35 +0000 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-08-12 09:50:35 +0000 |
| commit | 58dd81f6208199791e7451a1cb239f23bcd0a20f (patch) | |
| tree | 365d6e0f15a5df9be09bda8061af1d3118c84c77 /lib/approval-template/service.ts | |
| parent | bcd462d6e60871b86008e072f4b914138fc5c328 (diff) | |
(김준회) 결재 템플릿 및 결재선 관리 revalidate 처리, 결재선 관리 카테고리 처리
Diffstat (limited to 'lib/approval-template/service.ts')
| -rw-r--r-- | lib/approval-template/service.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/approval-template/service.ts b/lib/approval-template/service.ts index 5dc989d9..cb687c4f 100644 --- a/lib/approval-template/service.ts +++ b/lib/approval-template/service.ts @@ -1,6 +1,7 @@ 'use server'; import db from '@/db/db'; +import { revalidateI18nPaths } from '@/lib/revalidate'; import { and, asc, @@ -28,6 +29,13 @@ export type ApprovalTemplateVariable = typeof approvalTemplateVariables.$inferSelect; export type ApprovalTemplateHistory = typeof approvalTemplateHistory.$inferSelect; +// --------------------------------------------- +// Revalidation helpers +// --------------------------------------------- +async function revalidateApprovalTemplatesPaths() { + await revalidateI18nPaths('/evcp/approval/template'); +} + export interface ApprovalTemplateWithVariables extends ApprovalTemplate { variables: ApprovalTemplateVariable[]; @@ -209,6 +217,7 @@ export async function createApprovalTemplate(data: CreateInput): Promise<Approva const result = await getApprovalTemplate(newTemplate.id); if (!result) throw new Error('생성된 템플릿을 조회할 수 없습니다.'); + await revalidateApprovalTemplatesPaths(); return result; } @@ -262,6 +271,7 @@ export async function updateApprovalTemplate(id: string, data: UpdateInput): Pro const result = await getApprovalTemplate(id); if (!result) throw new Error('업데이트된 템플릿을 조회할 수 없습니다.'); + await revalidateApprovalTemplatesPaths(); return result; } @@ -320,6 +330,7 @@ export async function duplicateApprovalTemplate( export async function deleteApprovalTemplate(id: string): Promise<{ success: boolean; error?: string }> { try { await db.delete(approvalTemplates).where(eq(approvalTemplates.id, id)); + await revalidateApprovalTemplatesPaths(); return { success: true }; } catch (error) { return { |
