competitions.ts 2.6 KB
module.exports = function (sequelize: any, DataTypes: any) {
  return sequelize.define('competitions', {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "赛事ID"
    },
    category_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "分类ID"
    },
    country_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "国家ID"
    },
    divisions: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "赛事层级"
    },
    host: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "东道主"
    },
    logo: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "赛事Logo"
    },
    most_titles: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "夺冠最多球队"
    },
    name_en: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "英文名称"
    },
    name_zh: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "中文名称"
    },
    name_zht: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "粤语名称"
    },
    newcomers: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "晋级淘汰球队"
    },
    primary_color: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "主颜色"
    },
    secondary_color: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "次颜色"
    },
    short_name_en: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "英文简称"
    },
    short_name_zh: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "中文简称"
    },
    short_name_zht: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "粤语简称"
    },
    title_holder: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "卫冕冠军"
    },
    type: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "赛事类型,0-未知、1-联赛、2-杯赛、3-友谊赛"
    },
    updated_at: {
      type: DataTypes.BIGINT,
      allowNull: true,
      get(){
        return moment(this.getDataValue('updated_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
    created_at: {
      type: DataTypes.DATE,
      allowNull: true
    },
    best_players: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "最佳球员"
    },
    best_teams: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "最佳球队"
    },
  });
};