diff options
Diffstat (limited to 'types/enhanced-documents.d.ts')
| -rw-r--r-- | types/enhanced-documents.d.ts | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/types/enhanced-documents.d.ts b/types/enhanced-documents.d.ts new file mode 100644 index 00000000..99222db3 --- /dev/null +++ b/types/enhanced-documents.d.ts @@ -0,0 +1,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 +}
\ No newline at end of file |
