From 48a2255bfc45ffcfb0b39ffefdd57cbacf8b36df Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 18 Jul 2025 07:52:02 +0000 Subject: (대표님) 파일관리변경, 클라IP추적, 실시간알림, 미들웨어변경, 알림API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/file-download-log/validation.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/file-download-log/validation.ts (limited to 'lib/file-download-log/validation.ts') diff --git a/lib/file-download-log/validation.ts b/lib/file-download-log/validation.ts new file mode 100644 index 00000000..bf888e9c --- /dev/null +++ b/lib/file-download-log/validation.ts @@ -0,0 +1,37 @@ +import { fileDownloadLogs } from "@/db/schema"; +import { createInsertSchema, createSelectSchema } from "drizzle-zod"; +import { z } from 'zod'; + +// Zod 스키마 +export const fileDownloadLogInsertSchema = createInsertSchema(fileDownloadLogs); +export const fileDownloadLogSelectSchema = createSelectSchema(fileDownloadLogs); + +export type FileDownloadLog = typeof fileDownloadLogs.$inferSelect; +export type NewFileDownloadLog = typeof fileDownloadLogs.$inferInsert; + +// validation.ts에 추가할 타입 +interface FileInfo { + fileName?: string; + filePath?: string; + fileSize?: number; + } + + // 수정된 입력 스키마 +export const createFileDownloadLogSchema = z.object({ + fileId: z.number(), + success: z.boolean(), + errorMessage: z.string().optional(), + requestId: z.string().optional(), + downloadDurationMs: z.number().optional(), + // 파일 정보를 직접 받을 수 있도록 추가 + fileInfo: z.object({ + fileName: z.string().optional(), + filePath: z.string().optional(), + fileSize: z.number().optional(), + }).optional(), + // 또는 다른 테이블에서 조회할 수 있도록 + fileSource: z.enum(['rfqAttachments', 'documents', 'uploads']).optional(), + }); + + +export type CreateFileDownloadLogInput = z.infer; -- cgit v1.2.3