synt_backend
Version:
Synt light-weight node backend service
31 lines (30 loc) • 765 B
JavaScript
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class Supplier 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) {
// define association here
Supplier.belongsToMany(models.ReportType, {
through: "ReportTypeSupplier",
});
Supplier.belongsTo(models.Company);
Supplier.belongsTo(models.VME);
Supplier.hasMany(models.SupplierFile);
}
}
Supplier.init(
{
alias: DataTypes.STRING,
},
{
sequelize,
modelName: "Supplier",
}
);
return Supplier;
};
;