You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
365 B

  1. 'use strict'
  2. /**
  3. * Associate DB Model relations
  4. */
  5. module.exports = db => {
  6. db.User.belongsToMany(db.Group, { through: 'userGroups' })
  7. db.Group.hasMany(db.Right, { as: 'groupRights' })
  8. db.Document.hasMany(db.Tag, { as: 'documentTags' })
  9. db.File.belongsTo(db.Folder)
  10. db.Comment.belongsTo(db.Document)
  11. db.Comment.belongsTo(db.User, { as: 'author' })
  12. }