blob: 99222db32c82350be6d799e85800552282067bd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// types/enhanced-documents.ts
import { type InferSelectModel } from "drizzle-orm"
import { documents, issueStages, revisions, documentAttachments, enhancedDocumentsView } from "@/db/schema/vendorDocu"
// DB 스키마에서 추출한 기본 타입들
export type Document = InferSelectModel<typeof documents>
export type IssueStage = InferSelectModel<typeof issueStages>
export type Revision = InferSelectModel<typeof revisions>
export type DocumentAttachment = InferSelectModel<typeof documentAttachments>
export type EnhancedDocument = InferSelectModel<typeof enhancedDocumentsView>
// 확장된 스테이지 타입 (리비전과 첨부파일 포함)
export type StageWithRevisions = IssueStage & {
revisions: Array<Revision & {
attachments: DocumentAttachment[]
}>
}
// 완전한 문서 타입 (모든 관련 데이터 포함)
export type FullDocument = Document & {
stages: StageWithRevisions[]
currentStage?: IssueStage
latestRevision?: Revision
}
// 컴포넌트에서 사용할 확장된 문서 타입 (EnhancedDocument와 호환)
export type EnhancedDocumentWithStages = EnhancedDocument & {
// EnhancedDocument가 이미 documentId를 가지고 있는지 확인
documentId: number
allStages?: Array<{
id: number
stageName: string
stageStatus: string
stageOrder: number
planDate: string | null
actualDate: string | null
assigneeName: string | null
priority: string
}>
}
// 서버 액션용 입력 타입들
export type CreateDocumentInput = {
contractId: number
docNumber: string
title: string
pic?: string
issuedDate?: string
}
export type UpdateDocumentInput = Partial<CreateDocumentInput> & {
id: number
}
export type CreateStageInput = {
documentId: number
stageName: string
planDate?: string
stageOrder?: number
priority?: 'HIGH' | 'MEDIUM' | 'LOW'
assigneeId?: number
assigneeName?: string
description?: string
reminderDays?: number
}
export type UpdateStageInput = Partial<CreateStageInput> & {
id: number
}
export type CreateRevisionInput = {
issueStageId: number
revision: string
uploaderType: 'vendor' | 'client' | 'contractor'
uploaderId?: number
uploaderName: string
comment?: string
attachments?: Array<{
fileName: string
filePath: string
fileType?: string
fileSize: number
}>
}
export type UpdateRevisionStatusInput = {
id: number
revisionStatus: 'SUBMITTED' | 'UNDER_REVIEW' | 'APPROVED' | 'REJECTED' | 'SUPERSEDED'
reviewerId?: number
reviewerName?: string
reviewComments?: string
}
// API 응답 타입들
export type ApiResponse<T> = {
success: boolean
data?: T
error?: string
message?: string
}
export type PaginatedResponse<T> = {
data: T[]
total: number
pageCount: number
currentPage: number
}
|