@apantle/awsome-factory-associator
Version:
Provides a syntax to define factories with any kind of association.
23 lines (20 loc) • 362 B
JavaScript
/**
* Salesman.js
*
* @description ::Represents a Salesman
*/
const { DataTypes } = require('sequelize');
module.exports = {
attributes: {
name: {
type: DataTypes.STRING
}
},
associations: () => {
Salesman.belongsToMany(Store, {
as: 'StoreHired',
through: 'SalesmanStore',
foreignKey: 'salesman_id'
});
}
};