Ghost/ghost/limit-service/lib/config.js
Hannah Wolfe 2163ec6057 Changed casing of limit names + fixed handling
refs: https://github.com/TryGhost/Team/issues/510

- Ghost config always uses camelcase. This was incorrectly implemented with snake case originally
- Swap to use camelCase by default, which is desirable, but support both
- It's really easy to support both in the loader and isLimited check, so we do this to stop ourselves tripping on this later
2021-03-04 20:39:09 +00:00

32 lines
1.1 KiB
JavaScript

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')
.select('users.id')
.leftJoin('roles_users', 'users.id', 'roles_users.user_id')
.leftJoin('roles', 'roles_users.role_id', 'roles.id')
.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')
]);
return result.length;
}
},
customIntegrations: {
currentCountQuery: async (db) => {
let result = await db.knex('integrations').count('id', {as: 'count'}).whereNotIn('type', ['internal', 'builtin']).first();
return result.count;
}
},
customThemes: {}
};