feat:更新依赖项的源地址,将所有依赖的镜像地址更改为官方的Yarn注册表地址,并在应用模块中引入新的Exercises模块。
This commit is contained in:
41
src/exercises/models/exercise-category.model.ts
Normal file
41
src/exercises/models/exercise-category.model.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Column, DataType, HasMany, Model, Table } from 'sequelize-typescript';
|
||||
import { Exercise } from './exercise.model';
|
||||
|
||||
@Table({
|
||||
tableName: 't_exercise_categories',
|
||||
underscored: true,
|
||||
})
|
||||
export class ExerciseCategory 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.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '排序(升序)',
|
||||
})
|
||||
declare sortOrder: number;
|
||||
|
||||
@HasMany(() => Exercise, { foreignKey: 'categoryKey', sourceKey: 'key' })
|
||||
declare exercises: Exercise[];
|
||||
|
||||
@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