import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm'; @Entity('player_task_progress') @Index('uq_player_task_progress_task_cycle', ['user_id', 'task_id', 'cycle_key'], { unique: true }) @Index('idx_player_task_progress_user_cycle', ['user_id', 'cycle_key']) export class PlayerTaskProgress { @PrimaryGeneratedColumn({ type: 'bigint', comment: '主键ID' }) id: bigint; @Column({ type: 'bigint', nullable: false, comment: '关联users.id' }) user_id: bigint; @Column({ type: 'varchar', length: 80, nullable: false, comment: '静态任务ID' }) task_id: string; @Column({ type: 'varchar', length: 32, nullable: false, comment: '任务周期键' }) cycle_key: string; @Column({ type: 'int', nullable: false, default: 0, comment: '当前进度' }) progress: number; @Column({ type: 'json', nullable: false, comment: '去重活动目标等状态' }) activity_state: Record; @Column({ type: 'timestamp', nullable: true, comment: '完成时间' }) completed_at: Date | null; @Column({ type: 'timestamp', nullable: true, comment: '领奖时间' }) claimed_at: Date | null; @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', comment: '创建时间' }) created_at: Date; @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' }) updated_at: Date; }