Added currentCountQuery for emails limit

refs https://github.com/TryGhost/Team/issues/588

- This is a basic implementation which needs a review. Implemented it to fix failing tests in main
- Start date is expected to come formatted for DB's needs
This commit is contained in:
Naz 2021-05-06 17:37:50 +04:00
parent 0d242b96ef
commit ebfad4bea4

View File

@ -9,7 +9,16 @@ module.exports = {
return result.count;
}
},
emails: {},
emails: {
currentCountQuery: async (db, startDate) => {
let result = await db.knex('emails')
.count('id', {as: 'count'})
.where('created_at', '>=', startDate)
.first();
return result.count;
}
},
staff: {
currentCountQuery: async (db) => {
let result = await db.knex('users')