feat: 新增通用导入中心

This commit is contained in:
2026-08-05 17:11:39 +08:00
parent e9c8a1085d
commit 0c94ca54df
20 changed files with 3355 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import { Column, CreateDateColumn, Entity, Index, PrimaryColumn, UpdateDateColumn } from 'typeorm';
import type { ImportRunSource, ImportRunStatus, ImportStepKey } from '../imports.types';
@Entity('import_runs')
@Index('idx_import_runs_user_created', ['userId', 'createdAt'])
export class ImportRun {
@PrimaryColumn({ type: 'varchar', length: 36 })
id: string;
@Column({ name: 'user_id', type: 'integer' })
userId: number;
@Column({ name: 'conversation_id', type: 'integer', nullable: true })
conversationId: number | null;
@Column({ type: 'varchar', length: 10, default: 'manual' })
source: ImportRunSource;
@Column({ name: 'file_name', type: 'varchar', length: 255 })
fileName: string;
/** Serialized sheet data — parsed rows are kept here for v1. */
@Column({ name: 'sheets_json', type: 'text' })
sheetsJson: string;
@Column({ type: 'varchar', length: 20, default: 'preparing' })
status: ImportRunStatus;
@Column({ name: 'current_step_key', type: 'varchar', length: 20, nullable: true })
currentStepKey: ImportStepKey | null;
@Column({ type: 'varchar', length: 500, nullable: true })
error: string | null;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at' })
updatedAt: Date;
}