From 90f79a7a691943a496f67f01c1e493256070e4de Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 7 Jul 2025 01:44:45 +0000 Subject: (대표님) 변경사항 20250707 10시 43분 - unstaged 변경사항 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vendor-investigation/service.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib/vendor-investigation/service.ts') diff --git a/lib/vendor-investigation/service.ts b/lib/vendor-investigation/service.ts index bcf9efd4..7c486fc9 100644 --- a/lib/vendor-investigation/service.ts +++ b/lib/vendor-investigation/service.ts @@ -14,6 +14,7 @@ import path from "path" import { v4 as uuid } from "uuid" import { vendorsLogs } from "@/db/schema"; import { cache } from "react" +import { deleteFile } from "../file-stroage"; export async function getVendorsInvestigation(input: GetVendorsInvestigationSchema) { return unstable_cache( @@ -340,11 +341,7 @@ export async function deleteInvestigationAttachment(attachmentId: number) { return { success: false, error: "첨부파일을 찾을 수 없습니다." } } - // 실제 파일 삭제 - const fullFilePath = path.join(process.cwd(), "public", attachment.filePath) - if (fs.existsSync(fullFilePath)) { - fs.unlinkSync(fullFilePath) - } + await deleteFile(attachment.filePath) // 데이터베이스에서 레코드 삭제 await db @@ -379,11 +376,7 @@ export async function getAttachmentDownloadInfo(attachmentId: number) { return { success: false, error: "첨부파일을 찾을 수 없습니다." } } - const fullFilePath = path.join(process.cwd(), "public", attachment.filePath) - if (!fs.existsSync(fullFilePath)) { - return { success: false, error: "파일이 존재하지 않습니다." } - } - + return { success: true, downloadInfo: { -- cgit v1.2.3