feat(migration): ADR-028 migration architecture refactor
- เพิ่ม 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)
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
} from '../common/constants/queue.constants';
|
||||
import { OllamaService } from './services/ollama.service';
|
||||
import { AiQdrantService } from './qdrant.service';
|
||||
import { ImportTransaction } from '../migration/entities/import-transaction.entity';
|
||||
|
||||
const DEFAULT_REDIS_TOKEN = 'default_IORedisModuleConnectionToken';
|
||||
|
||||
@@ -117,8 +118,6 @@ describe('AiService', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks();
|
||||
|
||||
// ตั้งค่า default return values
|
||||
mockMigrationLogRepo.create.mockReturnValue({
|
||||
publicId: '019505a1-7c3e-7000-8000-abc123def456',
|
||||
sourceFile: 'test-file-uuid',
|
||||
@@ -131,7 +130,6 @@ describe('AiService', () => {
|
||||
mockAuditLogRepo.save.mockResolvedValue({});
|
||||
mockMainAuditLogRepo.create.mockReturnValue({});
|
||||
mockMainAuditLogRepo.save.mockResolvedValue({});
|
||||
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [
|
||||
AiService,
|
||||
@@ -144,6 +142,10 @@ describe('AiService', () => {
|
||||
provide: getRepositoryToken(AuditLog),
|
||||
useValue: mockMainAuditLogRepo,
|
||||
},
|
||||
{
|
||||
provide: getRepositoryToken(ImportTransaction),
|
||||
useValue: { findOne: jest.fn(), create: jest.fn(), save: jest.fn() },
|
||||
},
|
||||
{ provide: getQueueToken(QUEUE_AI_REALTIME), useValue: mockQueue },
|
||||
{ provide: getQueueToken(QUEUE_AI_BATCH), useValue: mockQueue },
|
||||
{ provide: ConfigService, useValue: mockConfigService },
|
||||
@@ -154,7 +156,6 @@ describe('AiService', () => {
|
||||
{ provide: DEFAULT_REDIS_TOKEN, useValue: mockRedis },
|
||||
],
|
||||
}).compile();
|
||||
|
||||
service = module.get<AiService>(AiService);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user