diff options
Diffstat (limited to 'lib/vendor-investigation/service.ts')
| -rw-r--r-- | lib/vendor-investigation/service.ts | 13 |
1 files changed, 3 insertions, 10 deletions
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: { |
