Files
MemeMind-Server/src/modules/wechat-game/entities/level.entity.ts
richarjiang 46368b8c89 feat(wechat-game): add level list API endpoints
Add CRUD endpoints for game levels with level field in response:
- GET /v1/wechat-game/levels - list all levels ordered by sort_order
- GET /v1/wechat-game/levels/:id - get single level by ID

New files:
- Level entity mapping to levels table
- LevelRepository with ordered query support
- LevelResponseDto with level field (1-based index from sort_order)
2026-03-15 15:52:51 +08:00

38 lines
822 B
TypeScript

import {
Entity,
PrimaryColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
} from 'typeorm';
@Entity('levels')
export class Level {
@PrimaryColumn({ type: 'varchar', length: 191 })
id: string;
@Column({ type: 'varchar', length: 191, name: 'image_url' })
imageUrl: string;
@Column({ type: 'varchar', length: 191 })
answer: string;
@Column({ type: 'varchar', length: 191, nullable: true })
hint1: string | null;
@Column({ type: 'varchar', length: 191, nullable: true })
hint2: string | null;
@Column({ type: 'varchar', length: 191, nullable: true })
hint3: string | null;
@Column({ type: 'int', name: 'sort_order', default: 0 })
sortOrder: number;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at' })
updatedAt: Date;
}