49 lines
1.1 KiB
TypeScript
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;
|
|
}
|