Fixed uses ov currentCountQuery

no issue

- The currentCountQuery method takes in  no parameters!
This commit is contained in:
Naz 2021-10-26 11:15:15 +04:00
parent d6d88d4f70
commit aef6c19933

View File

@ -102,7 +102,7 @@ class MaxLimit extends Limit {
* @param {Number} [options.addedCount] - number of items to add to the currentCount during the check * @param {Number} [options.addedCount] - number of items to add to the currentCount during the check
*/ */
async errorIfWouldGoOverLimit({max, addedCount = 1} = {}) { async errorIfWouldGoOverLimit({max, addedCount = 1} = {}) {
let currentCount = await this.currentCountQuery(this.db); let currentCount = await this.currentCountQuery();
if ((currentCount + addedCount) > (max || this.max)) { if ((currentCount + addedCount) > (max || this.max)) {
throw this.generateError(currentCount); throw this.generateError(currentCount);
@ -116,7 +116,7 @@ class MaxLimit extends Limit {
* @param {Number} [options.max] - overrides configured default max value to perform checks against * @param {Number} [options.max] - overrides configured default max value to perform checks against
*/ */
async errorIfIsOverLimit({max} = {}) { async errorIfIsOverLimit({max} = {}) {
let currentCount = await this.currentCountQuery(this.db); let currentCount = await this.currentCountQuery();
if (currentCount > (max || this.max)) { if (currentCount > (max || this.max)) {
throw this.generateError(currentCount); throw this.generateError(currentCount);
@ -207,7 +207,7 @@ class MaxPeriodicLimit extends Limit {
* @param {Number} [options.addedCount] - number of items to add to the currentCount during the check * @param {Number} [options.addedCount] - number of items to add to the currentCount during the check
*/ */
async errorIfWouldGoOverLimit({max, addedCount = 1} = {}) { async errorIfWouldGoOverLimit({max, addedCount = 1} = {}) {
let currentCount = await this.currentCountQuery(this.db); let currentCount = await this.currentCountQuery();
if ((currentCount + addedCount) > (max || this.maxPeriodic)) { if ((currentCount + addedCount) > (max || this.maxPeriodic)) {
throw this.generateError(currentCount); throw this.generateError(currentCount);
@ -221,7 +221,7 @@ class MaxPeriodicLimit extends Limit {
* @param {Number} [options.max] - overrides configured default maxPeriodic value to perform checks against * @param {Number} [options.max] - overrides configured default maxPeriodic value to perform checks against
*/ */
async errorIfIsOverLimit({max} = {}) { async errorIfIsOverLimit({max} = {}) {
let currentCount = await this.currentCountQuery(this.db); let currentCount = await this.currentCountQuery();
if (currentCount > (max || this.maxPeriodic)) { if (currentCount > (max || this.maxPeriodic)) {
throw this.generateError(currentCount); throw this.generateError(currentCount);