diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-28 00:34:39 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-28 00:34:39 +0000 |
| commit | c2aa314651219686f78700e87135485a8be91264 (patch) | |
| tree | 0b7e240d2432863754cfed47ff4020d7edc0c5be /types | |
| parent | b7f5af1f4b6691052bb3e77968a478ff27696095 (diff) | |
(대표님) 커스텀 훅, ATOM 상태관리, 타입 정의 커밋
Diffstat (limited to 'types')
| -rw-r--r-- | types/enhanced-documents.d.ts | 107 | ||||
| -rw-r--r-- | types/table.d.ts | 2 |
2 files changed, 108 insertions, 1 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 diff --git a/types/table.d.ts b/types/table.d.ts index 5d617159..f98d4c99 100644 --- a/types/table.d.ts +++ b/types/table.d.ts @@ -54,7 +54,7 @@ export type Filter<TData> = Prettify< export interface DataTableRowAction<TData> { row: Row<TData> - type: "addInfo"| "view-series"|"log"| "tbeResult" | "requestInfo"| "esign-detail"| "responseDetail"|"signature"|"update" | "delete" | "user" | "pemission" | "invite" | "items" | "attachment" |"comments" | "open" | "select" | "files" + type: "schedule"| "view"| "upload" | "addInfo"| "view-series"|"log"| "tbeResult" | "requestInfo"| "esign-detail"| "responseDetail"|"signature"|"update" | "delete" | "user" | "pemission" | "invite" | "items" | "attachment" |"comments" | "open" | "select" | "files" } export interface QueryBuilderOpts { |
