a2973be208
- เพิ่ม POST /api/ai/jobs + GET /api/ai/jobs/:jobId endpoints (FR-001, FR-002) - เพิ่ม BullMQ Worker MigrateDocumentWorker + OCR auto-detect (FR-003, FR-004) - เพิ่ม cleanup-temp-files + expire-pending-reviews workers (FR-005, FR-005a/b) - สร้าง SQL deltas: tags, correspondence_tags, alter migration_review_queue (FR-006, ADR-009) - เพิ่ม MigrationReviewService.commitRecord() + SELECT FOR UPDATE (FR-007, FR-007a) - เพิ่ม CASL permission migration.commit + MigrationReviewController (FR-007) - สร้าง TagsModule + TagsService + TagsController (US3) - สร้าง Migration Review Queue frontend page + ReviewQueueTable (US2) - อัปเดต n8n guide: deterministic Idempotency-Key + token pre-flight (FR-001a, FR-010a/b) - สร้าง spec.md, plan.md, tasks.md, data-model.md, contracts/, quickstart.md - สร้าง ADR-028 document + validation-report.md (PASS 32/32 tasks, 173/173 tests)
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
// File: types/migration.ts
|
|
// Change Log:
|
|
// - 2026-05-22: Initial creation and update for ADR-019 compatibility and added subject fields
|
|
|
|
export enum MigrationReviewStatus {
|
|
PENDING = 'PENDING',
|
|
APPROVED = 'APPROVED',
|
|
REJECTED = 'REJECTED',
|
|
IMPORTED = 'IMPORTED',
|
|
}
|
|
|
|
export interface MigrationReviewQueueItem {
|
|
publicId: string; // ADR-019: public identifier
|
|
id?: number; // Internal INT (excluded from API)
|
|
documentNumber: string;
|
|
title?: string;
|
|
originalTitle?: string;
|
|
subject?: string;
|
|
originalSubject?: string;
|
|
body?: string;
|
|
aiSuggestedCategory?: string;
|
|
aiConfidence?: number;
|
|
aiIssues?: Record<string, unknown>[];
|
|
reviewReason?: string;
|
|
status: MigrationReviewStatus;
|
|
reviewedBy?: string;
|
|
reviewedAt?: string;
|
|
createdAt: string;
|
|
projectId?: number | string; // ADR-019: Accept UUID
|
|
senderOrganizationId?: number | string; // ADR-019: Accept UUID
|
|
receiverOrganizationId?: number | string; // ADR-019: Accept UUID
|
|
receivedDate?: string;
|
|
issuedDate?: string;
|
|
remarks?: string;
|
|
aiSummary?: string;
|
|
extractedTags?: Record<string, unknown>[];
|
|
tempAttachmentId?: number | string; // ADR-019: Accept UUID
|
|
}
|
|
|
|
export interface CommitBatchItemDto {
|
|
queueId: number;
|
|
dto: Record<string, unknown>;
|
|
}
|
|
|
|
export interface CommitBatchDto {
|
|
items: CommitBatchItemDto[];
|
|
batchId: string;
|
|
}
|
|
|
|
export enum MigrationErrorType {
|
|
FILE_NOT_FOUND = 'FILE_NOT_FOUND',
|
|
AI_PARSE_ERROR = 'AI_PARSE_ERROR',
|
|
API_ERROR = 'API_ERROR',
|
|
DB_ERROR = 'DB_ERROR',
|
|
SECURITY = 'SECURITY',
|
|
UNKNOWN = 'UNKNOWN',
|
|
}
|
|
|
|
export interface MigrationErrorItem {
|
|
publicId: string; // ADR-019: public identifier
|
|
id?: number; // Internal INT (excluded from API)
|
|
batchId?: string;
|
|
documentNumber?: string;
|
|
errorType?: MigrationErrorType;
|
|
errorMessage?: string;
|
|
rawAiResponse?: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface PaginatedResponse<T> {
|
|
items: T[];
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
totalPages: number;
|
|
}
|