sails-hook-blacksails
Version:
A Sails Micro-app architecture framework
40 lines • 809 B
JavaScript
module.exports = {
attributes: {},
associations() {
User.belongsToMany(Role, {
through: 'UserRole',
foreignKey: {
name: 'UserId',
as: 'Users',
},
});
Role.belongsToMany(User, {
through: 'UserRole',
foreignKey: {
name: 'RoleId',
as: 'Roles',
},
});
},
options: {
"paranoid": false,
"timestamps": true,
classMethods: {
...sails.config.models.classMethod['UserRole'],
associations() {
return {
"belongsTo": [],
"hasMany": [],
"hasOne": [],
"belongsToMany": []
};
},
},
instanceMethods: {
...sails.config.models.instanceMethod['UserRole'],
},
hooks: {
...sails.config.models.hook['UserRole'],
},
},
};