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)
This commit is contained in:
37
src/modules/wechat-game/entities/level.entity.ts
Normal file
37
src/modules/wechat-game/entities/level.entity.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user