players.ts 3.2 KB
module.exports = function(sequelize:any, DataTypes:any) {
  return sequelize.define('players', {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "球员ID"
    },
    coach_id: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "教练ID (球员转为教练后的对应ID)"
    },
    country_id: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "国家ID"
    },
    logo: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "球员Logo"
    },
    market_value: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "市值"
    },
    market_value_currency: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "市值单位"
    },
    ability: {
      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: "粤语名称"
    },
    national_logo: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "球员Logo (国家队,可判断球队是国家队时使用)"
    },
    nationality: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "国籍"
    },
    position: {
      type: DataTypes.STRING(10),
      allowNull: true,
      comment: "擅长位置,F-前锋、M-中场、D-后卫、G-守门员、其他为未知"
    },
    preferred_foot: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "惯用脚,0-未知、1-左脚、2-右脚、3-左右脚"
    },
    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: "粤语简称"
    },
    suffix: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "球员u系列"
    },
    age: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "年龄"
    },
    birthday: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "生日 (0-未知)"
    },
    characteristics: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "技术特点"
    },
    contract_until: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "合同截止时间"
    },
    height: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "身高"
    },
    positions: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "详细位置"
    },
    weight: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "体重"
    },
    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
    }
  });
};