From 53ad72732f781e6c6d5ddb3776ea47aec010af8e Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 4 Aug 2025 09:39:21 +0000 Subject: (최겸) PQ/실사 수정 및 개발 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pq/helper.ts | 190 +++++++++++++++++++++++++++---------------------------- 1 file changed, 95 insertions(+), 95 deletions(-) (limited to 'lib/pq/helper.ts') diff --git a/lib/pq/helper.ts b/lib/pq/helper.ts index 16aed0e4..efd50714 100644 --- a/lib/pq/helper.ts +++ b/lib/pq/helper.ts @@ -1,96 +1,96 @@ -import { - vendorPQSubmissions, - vendors, - projects, - users, - vendorInvestigations -} from "@/db/schema" -import { CustomColumnMapping } from "../filter-columns" - -/** - * Helper function to create custom column mapping for PQ submissions - */ -export function createPQFilterMapping(): CustomColumnMapping { - return { - // PQ 제출 관련 - pqNumber: { table: vendorPQSubmissions, column: "pqNumber" }, - status: { table: vendorPQSubmissions, column: "status" }, - type: { table: vendorPQSubmissions, column: "type" }, - createdAt: { table: vendorPQSubmissions, column: "createdAt" }, - updatedAt: { table: vendorPQSubmissions, column: "updatedAt" }, - submittedAt: { table: vendorPQSubmissions, column: "submittedAt" }, - approvedAt: { table: vendorPQSubmissions, column: "approvedAt" }, - rejectedAt: { table: vendorPQSubmissions, column: "rejectedAt" }, - - // 협력업체 관련 - vendorName: { table: vendors, column: "vendorName" }, - vendorCode: { table: vendors, column: "vendorCode" }, - taxId: { table: vendors, column: "taxId" }, - vendorStatus: { table: vendors, column: "status" }, - - // 프로젝트 관련 - projectName: { table: projects, column: "name" }, - projectCode: { table: projects, column: "code" }, - - // 요청자 관련 - requesterName: { table: users, column: "name" }, - requesterEmail: { table: users, column: "email" }, - - // 실사 관련 - evaluationResult: { table: vendorInvestigations, column: "evaluationResult" }, - evaluationType: { table: vendorInvestigations, column: "evaluationType" }, - investigationStatus: { table: vendorInvestigations, column: "investigationStatus" }, - investigationAddress: { table: vendorInvestigations, column: "investigationAddress" }, - qmManagerId: { table: vendorInvestigations, column: "qmManagerId" }, - } -} - -/** - * PQ 관련 조인 테이블들 - */ -export function getPQJoinedTables() { - return { - vendors, - projects, - users, - vendorInvestigations, - } -} - -/** - * 직접 컬럼 참조 방식의 매핑 (더 타입 안전) - */ -export function createPQDirectColumnMapping(): CustomColumnMapping { - return { - // PQ 제출 관련 - 직접 컬럼 참조 - pqNumber: vendorPQSubmissions.pqNumber, - status: vendorPQSubmissions.status, - type: vendorPQSubmissions.type, - createdAt: vendorPQSubmissions.createdAt, - updatedAt: vendorPQSubmissions.updatedAt, - submittedAt: vendorPQSubmissions.submittedAt, - approvedAt: vendorPQSubmissions.approvedAt, - rejectedAt: vendorPQSubmissions.rejectedAt, - - // 협력업체 관련 - vendorName: vendors.vendorName, - vendorCode: vendors.vendorCode, - taxId: vendors.taxId, - vendorStatus: vendors.status, - - // 프로젝트 관련 - projectName: projects.name, - projectCode: projects.code, - - // 요청자 관련 - requesterName: users.name, - requesterEmail: users.email, - - // 실사 관련 - evaluationResult: vendorInvestigations.evaluationResult, - evaluationType: vendorInvestigations.evaluationType, - investigationStatus: vendorInvestigations.investigationStatus, - investigationAddress: vendorInvestigations.investigationAddress, - qmManagerId: vendorInvestigations.qmManagerId, - } +import { + vendorPQSubmissions, + vendors, + projects, + users, + vendorInvestigations +} from "@/db/schema" +import { CustomColumnMapping } from "../filter-columns" + +/** + * Helper function to create custom column mapping for PQ submissions + */ +export function createPQFilterMapping(): CustomColumnMapping { + return { + // PQ 제출 관련 + pqNumber: { table: vendorPQSubmissions, column: "pqNumber" }, + status: { table: vendorPQSubmissions, column: "status" }, + type: { table: vendorPQSubmissions, column: "type" }, + createdAt: { table: vendorPQSubmissions, column: "createdAt" }, + updatedAt: { table: vendorPQSubmissions, column: "updatedAt" }, + submittedAt: { table: vendorPQSubmissions, column: "submittedAt" }, + approvedAt: { table: vendorPQSubmissions, column: "approvedAt" }, + rejectedAt: { table: vendorPQSubmissions, column: "rejectedAt" }, + + // 협력업체 관련 + vendorName: { table: vendors, column: "vendorName" }, + vendorCode: { table: vendors, column: "vendorCode" }, + taxId: { table: vendors, column: "taxId" }, + vendorStatus: { table: vendors, column: "status" }, + + // 프로젝트 관련 + projectName: { table: projects, column: "name" }, + projectCode: { table: projects, column: "code" }, + + // 요청자 관련 + requesterName: { table: users, column: "name" }, + requesterEmail: { table: users, column: "email" }, + + // 실사 관련 + evaluationResult: { table: vendorInvestigations, column: "evaluationResult" }, + evaluationType: { table: vendorInvestigations, column: "evaluationType" }, + investigationStatus: { table: vendorInvestigations, column: "investigationStatus" }, + investigationAddress: { table: vendorInvestigations, column: "investigationAddress" }, + qmManagerId: { table: vendorInvestigations, column: "qmManagerId" }, + } +} + +/** + * PQ 관련 조인 테이블들 + */ +export function getPQJoinedTables() { + return { + vendors, + projects, + users, + vendorInvestigations, + } +} + +/** + * 직접 컬럼 참조 방식의 매핑 (더 타입 안전) + */ +export function createPQDirectColumnMapping(): CustomColumnMapping { + return { + // PQ 제출 관련 - 직접 컬럼 참조 + pqNumber: vendorPQSubmissions.pqNumber, + status: vendorPQSubmissions.status, + type: vendorPQSubmissions.type, + createdAt: vendorPQSubmissions.createdAt, + updatedAt: vendorPQSubmissions.updatedAt, + submittedAt: vendorPQSubmissions.submittedAt, + approvedAt: vendorPQSubmissions.approvedAt, + rejectedAt: vendorPQSubmissions.rejectedAt, + + // 협력업체 관련 + vendorName: vendors.vendorName, + vendorCode: vendors.vendorCode, + taxId: vendors.taxId, + vendorStatus: vendors.status, + + // 프로젝트 관련 + projectName: projects.name, + projectCode: projects.code, + + // 요청자 관련 + requesterName: users.name, + requesterEmail: users.email, + + // 실사 관련 + evaluationResult: vendorInvestigations.evaluationResult, + evaluationType: vendorInvestigations.evaluationType, + investigationStatus: vendorInvestigations.investigationStatus, + investigationAddress: vendorInvestigations.investigationAddress, + qmManagerId: vendorInvestigations.qmManagerId, + } } \ No newline at end of file -- cgit v1.2.3