- static loadById (id: number) {
- const options = {
- include: [ { model: AccountModel, required: true } ]
+ static listEmailsWithRight (right: UserRight) {
+ const roles = Object.keys(USER_ROLE_LABELS)
+ .map(k => parseInt(k, 10) as UserRole)
+ .filter(role => hasUserRight(role, right))
+
+ console.log(roles)
+
+ const query = {
+ attribute: [ 'email' ],
+ where: {
+ role: {
+ [Sequelize.Op.in]: roles
+ }
+ }