feat:更新依赖项的源地址,将所有依赖的镜像地址更改为官方的Yarn注册表地址,并在应用模块中引入新的Exercises模块。
This commit is contained in:
42
src/exercises/models/exercise.model.ts
Normal file
42
src/exercises/models/exercise.model.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from 'sequelize-typescript';
|
||||
import { ExerciseCategory } from './exercise-category.model';
|
||||
|
||||
@Table({
|
||||
tableName: 't_exercises',
|
||||
underscored: true,
|
||||
})
|
||||
export class Exercise extends Model {
|
||||
@Column({
|
||||
type: DataType.STRING,
|
||||
primaryKey: true,
|
||||
comment: '动作唯一键(英文/下划线)',
|
||||
})
|
||||
declare key: string;
|
||||
|
||||
@Column({ type: DataType.STRING, allowNull: false, comment: '名称(含中英文)' })
|
||||
declare name: string;
|
||||
|
||||
@Column({ type: DataType.STRING, allowNull: false, comment: '中文分类名(冗余,便于展示)' })
|
||||
declare categoryName: string;
|
||||
|
||||
@Column({ type: DataType.TEXT, allowNull: false, comment: '描述' })
|
||||
declare description: string;
|
||||
|
||||
@ForeignKey(() => ExerciseCategory)
|
||||
@Column({ type: DataType.STRING, allowNull: false, comment: '分类键' })
|
||||
declare categoryKey: string;
|
||||
|
||||
@BelongsTo(() => ExerciseCategory, { foreignKey: 'categoryKey', targetKey: 'key' })
|
||||
declare category: ExerciseCategory;
|
||||
|
||||
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0, comment: '排序(分类内)' })
|
||||
declare sortOrder: number;
|
||||
|
||||
@Column({ type: DataType.DATE, defaultValue: DataType.NOW })
|
||||
declare createdAt: Date;
|
||||
|
||||
@Column({ type: DataType.DATE, defaultValue: DataType.NOW })
|
||||
declare updatedAt: Date;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user