0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added JSDoc with types to the Limit base constructor

no issue

- Improved type checking a little
This commit is contained in:
Naz 2021-10-26 10:51:25 +04:00
parent bd4204dbc5
commit 10e9c30b15

View file

@ -5,6 +5,15 @@ const {lastPeriodStart, SUPPORTED_INTERVALS} = require('./date-utils');
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
class Limit {
/**
*
* @param {Object} options
* @param {String} options.name - name of the limit
* @param {String} options.error - error message to use when limit is reached
* @param {String} options.helpLink - URL to the resource explaining how the limit works
* @param {Object} options.db - instance of knex db connection that currentCountQuery can use to run state check through
* @param {Object} options.errors - instance of errors compatible with Ghost-Ignition's errors (https://github.com/TryGhost/Ignition#errors)
*/
constructor({name, error, helpLink, db, errors}) {
this.name = name;
this.error = error;
@ -36,6 +45,7 @@ class MaxLimit extends Limit {
* @param {Object} options.config - limit configuration
* @param {Number} options.config.max - maximum limit the limit would check against
* @param {Function} options.config.currentCountQuery - query checking the state that would be compared against the limit
* @param {String} [options.config.error] - error message to use when limit is reached
* @param {String} options.helpLink - URL to the resource explaining how the limit works
* @param {Object} options.db - instance of knex db connection that currentCountQuery can use to run state check through
* @param {Object} options.errors - instance of errors compatible with Ghost-Ignition's errors (https://github.com/TryGhost/Ignition#errors)