{"size": 1028, "ext": "js", "max_stars_repo_path": "src/db/models/unit_measurement.js", "max_stars_repo_name": "genjerdotcom/IMIN-Typescript-ExpressJS", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/db/models/unit_measurement.js", "max_issues_repo_name": "genjerdotcom/IMIN-Typescript-ExpressJS", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/db/models/unit_measurement.js", "max_forks_repo_name": "genjerdotcom/IMIN-Typescript-ExpressJS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.0526315789, "max_line_length": 90, "alphanum_fraction": 0.6313229572}
'use strict';

const { Model } = require('sequelize');

module.exports = (sequelize, DataTypes) => {
  class unit_measurement extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      unit_measurement.belongsTo(models.user,{as: '_created_by',foreignKey: 'created_by'})
      unit_measurement.belongsTo(models.user,{as: '_updated_by',foreignKey: 'updated_by'})
    }
  };
  unit_measurement.init({
      name: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true
      },
      abreviation: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true
      },
      precision: DataTypes.DECIMAL,
      created_by: DataTypes.INTEGER,
      updated_by: DataTypes.INTEGER
    },{
      sequelize,
      modelName: 'unit_measurement',
      underscored: true,
    }
  );
  return unit_measurement;
};