2021-03-03 15:18:51 +03:00
|
|
|
module.exports = {
|
|
|
|
members: {
|
|
|
|
currentCountQuery: async (db) => {
|
|
|
|
let result = await db.knex('members').count('id', {as: 'count'}).first();
|
|
|
|
return result.count;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
staff: {
|
|
|
|
currentCountQuery: async (db) => {
|
|
|
|
let result = await db.knex('users')
|
2021-03-04 16:31:41 +03:00
|
|
|
.select('users.id')
|
2021-03-03 15:18:51 +03:00
|
|
|
.leftJoin('roles_users', 'users.id', 'roles_users.user_id')
|
|
|
|
.leftJoin('roles', 'roles_users.role_id', 'roles.id')
|
2021-03-04 16:31:41 +03:00
|
|
|
.whereNot('roles.name', 'Contributor').andWhereNot('users.status', 'inactive').union([
|
|
|
|
db.knex('invites')
|
|
|
|
.select('invites.id')
|
|
|
|
.leftJoin('roles', 'invites.role_id', 'roles.id')
|
|
|
|
.whereNot('roles.name', 'Contributor')
|
|
|
|
]);
|
2021-03-03 15:18:51 +03:00
|
|
|
|
2021-03-04 16:31:41 +03:00
|
|
|
return result.length;
|
2021-03-03 15:18:51 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
custom_integrations: {
|
|
|
|
currentCountQuery: async (db) => {
|
|
|
|
let result = await db.knex('integrations').count('id', {as: 'count'}).whereNotIn('type', ['internal', 'builtin']).first();
|
|
|
|
return result.count;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
custom_themes: {}
|
|
|
|
};
|