Files
MemeMind-Server/src/modules/share/entities/share-level-progress.entity.ts
2026-04-19 13:27:10 +08:00

49 lines
1.1 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
ManyToOne,
JoinColumn,
Index,
Unique,
} from 'typeorm';
import { ShareParticipant } from './share-participant.entity';
import { Level } from '../../wechat-game/entities/level.entity';
@Entity('share_level_progress')
@Unique('uq_participant_level', ['participantId', 'levelId'])
export class ShareLevelProgress {
@PrimaryGeneratedColumn('uuid')
id!: string;
@Index('idx_slp_participant_id')
@Column({ type: 'char', length: 36, name: 'participant_id' })
participantId!: string;
@ManyToOne(() => ShareParticipant)
@JoinColumn({ name: 'participant_id' })
participant!: ShareParticipant;
@Index('idx_slp_level_id')
@Column({ type: 'char', length: 191, name: 'level_id' })
levelId!: string;
@ManyToOne(() => Level)
@JoinColumn({ name: 'level_id' })
level!: Level;
@Column({ type: 'tinyint', width: 1, default: 0 })
passed!: boolean;
@Column({ type: 'int', default: 0, name: 'time_spent' })
timeSpent!: number;
@Column({
type: 'timestamp',
name: 'completed_at',
nullable: true,
default: null,
})
completedAt!: Date | null;
}