feat: 新增通用导入中心
This commit is contained in:
40
apps/server/src/imports/entities/import-run.entity.ts
Normal file
40
apps/server/src/imports/entities/import-run.entity.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user