summaryrefslogtreecommitdiff
path: root/config/vendorInvestigationsColumnsConfig.ts
diff options
context:
space:
mode:
Diffstat (limited to 'config/vendorInvestigationsColumnsConfig.ts')
-rw-r--r--config/vendorInvestigationsColumnsConfig.ts300
1 files changed, 187 insertions, 113 deletions
diff --git a/config/vendorInvestigationsColumnsConfig.ts b/config/vendorInvestigationsColumnsConfig.ts
index 14fe77c1..edddbacb 100644
--- a/config/vendorInvestigationsColumnsConfig.ts
+++ b/config/vendorInvestigationsColumnsConfig.ts
@@ -1,125 +1,199 @@
-import { vendorInvestigationsView } from "@/db/schema/vendors"
-
/**
- * Drizzle will infer `contacts` and `possibleItems` as a JSON string or `unknown`.
- * We override those with arrays that have the structure we built in the view.
+ * Base type for vendor investigations view (simplified - investigation focused)
*/
-export type ContactItem = {
- id: number
- contactName: string
- contactEmail: string
- contactPhone: string | null
- contactPosition: string | null
- isPrimary: boolean
- createdAt: Date
- updatedAt: Date
-}
-
-export type PossibleItem = {
- id: number
+export type VendorInvestigationsViewRaw = {
+ // Investigation fields
+ investigationId: number
vendorId: number
- itemCode: string
- itemName: string
+ pqSubmissionId: number | null
+ requesterId: number | null
+ qmManagerId: number | null
+ investigationStatus: "PLANNED" | "IN_PROGRESS" | "COMPLETED" | "CANCELED"
+ evaluationType: "SITE_AUDIT" | "QM_SELF_AUDIT" | null
+ investigationAddress: string | null
+ investigationMethod: string | null
+ scheduledStartAt: Date | null
+ scheduledEndAt: Date | null
+ forecastedAt: Date | null
+ requestedAt: Date | null
+ confirmedAt: Date | null
+ completedAt: Date | null
+ evaluationScore: number | null
+ evaluationResult: "APPROVED" | "SUPPLEMENT" | "REJECTED" | null
+ investigationNotes: string | null
createdAt: Date
updatedAt: Date
-}
-// Drizzle-based type for the rest of the columns
-type VendorInvestigationsViewRaw = typeof vendorInvestigationsView.$inferSelect
+ // Essential vendor fields only
+ vendorName: string
+ vendorCode: string
+
+
+ hasAttachments: boolean
+
+ requesterName: string | null
+ requesterEmail: string | null
+ qmManagerName: string | null
+ qmManagerEmail: string | null
+}
/**
- * Combine the Drizzle-inferred type with typed arrays
+ * Main type for the table (adds id for backward compatibility)
*/
-export interface VendorInvestigationsViewWithContacts
- extends Omit<
- VendorInvestigationsViewRaw,
- "contacts" | "possibleItems"
- > {
- contacts: ContactItem[]
- possibleItems: PossibleItem[]
+export interface VendorInvestigationsViewWithContacts extends VendorInvestigationsViewRaw {
+ // Add id field for backward compatibility (maps to investigationId)
+ id: number
}
+// Column configuration type
export interface VendorInvestigationsColumnConfig {
- id: keyof VendorInvestigationsViewWithContacts
- label: string
- group?: string
- excelHeader?: string
- type?: string
- }
-
- // Example column config for vendorInvestigationsView
- export const vendorInvestigationsColumnsConfig: VendorInvestigationsColumnConfig[] = [
- {
- id: "investigationId",
- label: "Investigation ID",
- excelHeader: "Investigation ID",
- group: "Investigation",
- },
- {
- id: "investigationStatus",
- label: "Status",
- excelHeader: "Status",
- group: "Investigation",
- },
- {
- id: "scheduledStartAt",
- label: "Scheduled Start",
- excelHeader: "Scheduled Start",
- group: "Investigation",
- },
- {
- id: "scheduledEndAt",
- label: "Scheduled End",
- excelHeader: "Scheduled End",
- group: "Investigation",
- },
- {
- id: "completedAt",
- label: "Completed At",
- excelHeader: "Completed At",
- group: "Investigation",
- },
- {
- id: "investigationNotes",
- label: "Notes",
- excelHeader: "Investigation Notes",
- group: "Investigation",
- },
- {
- id: "vendorName",
- label: "Vendor Name",
- excelHeader: "Vendor Name",
- group: "Vendor Info",
- },
- {
- id: "vendorCode",
- label: "Vendor Code",
- excelHeader: "Vendor Code",
- group: "Vendor Info",
- },
- {
- id: "vendorEmail",
- label: "Email",
- excelHeader: "Email",
- group: "Vendor Info",
- },
- {
- id: "vendorPhone",
- label: "Phone",
- excelHeader: "Phone",
- group: "Vendor Info",
- },
- // ... add more as needed ...
- {
- id: "investigationCreatedAt",
- label: "Created At",
- excelHeader: "Created At",
- // group: "Metadata",
- },
- {
- id: "investigationUpdatedAt",
- label: "Updated At",
- excelHeader: "Updated At",
- // group: "Metadata",
- },
- ] \ No newline at end of file
+ id: keyof VendorInvestigationsViewWithContacts
+ label: string
+ group?: string
+ excelHeader?: string
+ type?: string
+}
+
+// Simplified column configuration focusing on investigation data
+export const vendorInvestigationsColumnsConfig: VendorInvestigationsColumnConfig[] = [
+ // Investigation Basic Info
+ {
+ id: "investigationStatus",
+ label: "실사 상태",
+ excelHeader: "실사 상태",
+ // group: "Investigation",
+ },
+ {
+ id: "vendorCode",
+ label: "협력사",
+ excelHeader: "협력사",
+ group: "협력업체",
+ },
+
+ {
+ id: "vendorName",
+ label: "협력사명",
+ excelHeader: "협력사명",
+ group: "Vendor",
+ },
+
+ {
+ id: "requesterName",
+ label: "의뢰자",
+ excelHeader: "의뢰자",
+ group: "실사",
+ },
+
+ {
+ id: "evaluationType",
+ label: "평가 유형",
+ excelHeader: "평가 유형",
+ group: "실사",
+ },
+
+
+ {
+ id: "investigationAddress",
+ label: "실사 주소",
+ excelHeader: "실사 주소",
+ group: "실사",
+ },
+ {
+ id: "investigationMethod",
+ label: "실사방법",
+ excelHeader: "실사방법",
+ group: "실사",
+ },
+ {
+ id: "investigationNotes",
+ label: "QM 의견",
+ excelHeader: "QM 의견",
+ group: "실사",
+ },
+ {
+ id: "qmManagerName",
+ label: "QM 담당자",
+ excelHeader: "QM 담당자",
+ group: "실사",
+ },
+ {
+ id: "evaluationScore",
+ label: "평가점수",
+ excelHeader: "평가점수",
+ group: "실사",
+ },
+ {
+ id: "evaluationResult",
+ label: "평가 결과",
+ excelHeader: "평가 결과",
+ group: "실사",
+ },
+ {
+ id: "hasAttachments",
+ label: "첨부파일",
+ excelHeader: "첨부파일",
+ group: "실사",
+ },
+
+ // Schedule Group
+ {
+ id: "requestedAt",
+ label: "실사 의뢰일",
+ excelHeader: "실사 의뢰일",
+ group: "일정",
+ },
+ {
+ id: "forecastedAt",
+ label: "실사 예정일",
+ excelHeader: "실사 예정일",
+ group: "일정",
+ },
+
+ {
+ id: "confirmedAt",
+ label: "실사 확정일",
+ excelHeader: "실사 확정일",
+ group: "일정",
+ },
+ {
+ id: "completedAt",
+ label: "실제 실사일",
+ excelHeader: "실제 실사일",
+ group: "일정",
+ },
+ // {
+ // id: "createdAt",
+ // label: "Created At",
+ // excelHeader: "Created At",
+ // },
+ // {
+ // id: "updatedAt",
+ // label: "Updated At",
+ // excelHeader: "Updated At",
+ // },
+ // Essential Vendor Info (minimal)
+
+
+ // References Group
+ // {
+ // id: "pqSubmissionId",
+ // label: "PQ Submission",
+ // excelHeader: "PQ Submission ID",
+ // group: "References",
+ // },
+ // {
+ // id: "requesterId",
+ // label: "Requester",
+ // excelHeader: "Requester ID",
+ // group: "References",
+ // },
+ // {
+ // id: "qmManagerId",
+ // label: "QM Manager",
+ // excelHeader: "QM Manager ID",
+ // group: "References",
+ // },
+
+ // Metadata (ungrouped)
+
+] \ No newline at end of file