diff options
| author | joonhoekim <26rote@gmail.com> | 2025-11-05 17:46:44 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-11-05 17:46:44 +0900 |
| commit | 0a0a4feabdc587125e58ce9c810719e208a481ed (patch) | |
| tree | 0a161c2f0d8f55a018c34806441360b63bfb657f | |
| parent | a2c78d3a00c569a37ab93f65b58a11ba3519b596 (diff) | |
(김준회) 벤더풀 import 및 서비스 관련 로깅 함수 주석 처리
| -rw-r--r-- | lib/vendor-pool/service.ts | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/lib/vendor-pool/service.ts b/lib/vendor-pool/service.ts index df947965..18d50ebd 100644 --- a/lib/vendor-pool/service.ts +++ b/lib/vendor-pool/service.ts @@ -4,8 +4,8 @@ import { GetVendorPoolSchema } from "./validations"; import { VendorPool } from "./types"; import db from "@/db/db"; import { vendorPool } from "@/db/schema/avl/vendor-pool"; -import { eq, and, or, ilike, count, desc, asc, sql } from "drizzle-orm"; -import { debugLog, debugError, debugSuccess, debugWarn } from "@/lib/debug-utils"; +import { eq, and, or, ilike, count, desc, sql } from "drizzle-orm"; +import { debugError } from "@/lib/debug-utils"; import { revalidateTag, unstable_cache } from "next/cache"; /** @@ -16,7 +16,7 @@ const _getVendorPools = async (input: GetVendorPoolSchema) => { try { const offset = (input.page - 1) * input.perPage; - debugLog('Vendor Pool 목록 조회 시작', { input, offset }); + // debugLog('Vendor Pool 목록 조회 시작', { input, offset }); // 검색 조건 구성 const whereConditions: any[] = []; @@ -380,7 +380,7 @@ const _getVendorPools = async (input: GetVendorPoolSchema) => { const pageCount = Math.ceil(totalCount[0].count / input.perPage); - debugSuccess('Vendor Pool 목록 조회 완료', { recordCount: transformedData.length, pageCount }); + // debugSuccess('Vendor Pool 목록 조회 완료', { recordCount: transformedData.length, pageCount }); return { data: transformedData, @@ -566,9 +566,9 @@ export async function handleVendorPoolAction( */ export async function createVendorPool(data: Omit<VendorPool, 'id' | 'registrationDate' | 'lastModifiedDate'>): Promise<VendorPool | null> { try { - debugLog('Vendor Pool 생성 시작', { inputData: data }); + // debugLog('Vendor Pool 생성 시작', { inputData: data }); - debugLog('데이터 검증 시작', { data, requiredFields: ['constructionSector', 'htDivision', 'designCategory', 'vendorName'] }); + // debugLog('데이터 검증 시작', { data, requiredFields: ['constructionSector', 'htDivision', 'designCategory', 'vendorName'] }); const currentTimestamp = new Date(); @@ -663,7 +663,7 @@ export async function createVendorPool(data: Omit<VendorPool, 'id' | 'registrati lastModifier: data.lastModifier || 'system', }; - debugLog('DB INSERT 시작', { table: 'vendor_pool', data: insertData }); + // debugLog('DB INSERT 시작', { table: 'vendor_pool', data: insertData }); // 데이터베이스에 삽입 const result = await db @@ -672,11 +672,11 @@ export async function createVendorPool(data: Omit<VendorPool, 'id' | 'registrati .returning(); if (result.length === 0) { - debugError('DB 삽입 실패: 결과가 없음', { insertData }); + // debugError('DB 삽입 실패: 결과가 없음', { insertData }); throw new Error("Failed to create vendor pool"); } - debugSuccess('DB INSERT 완료', { table: 'vendor_pool', result: result[0] }); + // debugSuccess('DB INSERT 완료', { table: 'vendor_pool', result: result[0] }); const createdItem = result[0]; @@ -741,17 +741,17 @@ export async function createVendorPool(data: Omit<VendorPool, 'id' | 'registrati offshoreTypeGom: createdItem.offshoreTypeGom ?? false, }; - debugSuccess('Vendor Pool 생성 완료', { result: transformedData }); + // debugSuccess('Vendor Pool 생성 완료', { result: transformedData }); // 캐시 무효화 - 모든 Vendor Pool 관련 캐시를 갱신 revalidateTag('vendor-pool-list'); revalidateTag('vendor-pool-stats'); - debugSuccess('Vendor Pool 캐시 무효화 완료', { tags: ['vendor-pool-list', 'vendor-pool-stats'] }); + // debugSuccess('Vendor Pool 캐시 무효화 완료', { tags: ['vendor-pool-list', 'vendor-pool-stats'] }); return transformedData; } catch (err) { - debugError('Vendor Pool 생성 실패', { error: err, inputData: data }); + // debugError('Vendor Pool 생성 실패', { error: err, inputData: data }); console.error("Error in createVendorPool:", err); // Unique 제약 조건 위반 감지 @@ -759,13 +759,13 @@ export async function createVendorPool(data: Omit<VendorPool, 'id' | 'registrati if (errorMessage.includes('unique_vendor_pool_combination') || errorMessage.includes('duplicate key value') || errorMessage.includes('violates unique constraint')) { - debugError('Unique 제약 조건 위반 감지', { - constructionSector: data.constructionSector, - htDivision: data.htDivision, - materialGroupCode: data.materialGroupCode, - vendorName: data.vendorName, - error: err - }); + // debugError('Unique 제약 조건 위반 감지', { + // constructionSector: data.constructionSector, + // htDivision: data.htDivision, + // materialGroupCode: data.materialGroupCode, + // vendorName: data.vendorName, + // error: err + // }); // Unique 제약 위반의 경우 특별한 에러 객체를 throw throw new Error('DUPLICATE_VENDOR_POOL'); } @@ -779,7 +779,7 @@ export async function createVendorPool(data: Omit<VendorPool, 'id' | 'registrati */ export async function updateVendorPool(id: number, data: Partial<VendorPool>): Promise<VendorPool | null> { try { - debugLog('Vendor Pool 업데이트 시작', { id, updateData: data }); + // debugLog('Vendor Pool 업데이트 시작', { id, updateData: data }); const currentTimestamp = new Date(); @@ -952,17 +952,17 @@ export async function updateVendorPool(id: number, data: Partial<VendorPool>): P offshoreTypeGom: updatedItem.offshoreTypeGom ?? false, }; - debugSuccess('Vendor Pool 업데이트 완료', { id, result: transformedData }); + // debugSuccess('Vendor Pool 업데이트 완료', { id, result: transformedData }); // 캐시 무효화 - 모든 Vendor Pool 관련 캐시를 갱신 revalidateTag('vendor-pool-list'); revalidateTag('vendor-pool-stats'); - debugSuccess('Vendor Pool 캐시 무효화 완료', { tags: ['vendor-pool-list', 'vendor-pool-stats'] }); + // debugSuccess('Vendor Pool 캐시 무효화 완료', { tags: ['vendor-pool-list', 'vendor-pool-stats'] }); return transformedData; } catch (err) { - debugError('Vendor Pool 업데이트 실패', { error: err, id, updateData: data }); + // debugError('Vendor Pool 업데이트 실패', { error: err, id, updateData: data }); console.error("Error in updateVendorPool:", err); // Unique 제약 조건 위반 감지 @@ -970,14 +970,14 @@ export async function updateVendorPool(id: number, data: Partial<VendorPool>): P if (errorMessage.includes('unique_vendor_pool_combination') || errorMessage.includes('duplicate key value') || errorMessage.includes('violates unique constraint')) { - debugError('Unique 제약 조건 위반 감지', { - id, - constructionSector: data.constructionSector, - htDivision: data.htDivision, - materialGroupCode: data.materialGroupCode, - vendorName: data.vendorName, - error: err - }); + // debugError('Unique 제약 조건 위반 감지', { + // id, + // constructionSector: data.constructionSector, + // htDivision: data.htDivision, + // materialGroupCode: data.materialGroupCode, + // vendorName: data.vendorName, + // error: err + // }); // Unique 제약 위반의 경우 특별한 에러 객체를 throw throw new Error('DUPLICATE_VENDOR_POOL'); } @@ -991,7 +991,7 @@ export async function updateVendorPool(id: number, data: Partial<VendorPool>): P */ export async function deleteVendorPool(id: number): Promise<boolean> { try { - debugLog('Vendor Pool 삭제 시작', { id }); + // debugLog('Vendor Pool 삭제 시작', { id }); // 데이터베이스에서 삭제 const result = await db @@ -1014,20 +1014,20 @@ export async function deleteVendorPool(id: number): Promise<boolean> { const isDeleted = checkDeleted.length === 0; if (isDeleted) { - debugSuccess('Vendor Pool 삭제 완료', { id }); + // debugSuccess('Vendor Pool 삭제 완료', { id }); // 캐시 무효화 - 모든 Vendor Pool 관련 캐시를 갱신 revalidateTag('vendor-pool-list'); revalidateTag('vendor-pool-stats'); - debugSuccess('Vendor Pool 캐시 무효화 완료', { tags: ['vendor-pool-list', 'vendor-pool-stats'] }); + // debugSuccess('Vendor Pool 캐시 무효화 완료', { tags: ['vendor-pool-list', 'vendor-pool-stats'] }); } else { - debugWarn('Vendor Pool 삭제 실패: 항목이 존재함', { id }); + // debugWarn('Vendor Pool 삭제 실패: 항목이 존재함', { id }); } return isDeleted; } catch (err) { - debugError('Vendor Pool 삭제 실패', { error: err, id }); + // debugError('Vendor Pool 삭제 실패', { error: err, id }); console.error("Error in deleteVendorPool:", err); return false; } |
