不要怂,就是干,撸起袖子干!

Commit ab05d295 by harimohanraj89

added @name to hooks so every hook has a name

1 parent 2538d1c0
Showing with 22 additions and 0 deletions
...@@ -179,24 +179,28 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -179,24 +179,28 @@ Hooks.hasHooks = Hooks.hasHook;
* A hook that is run before validation * A hook that is run before validation
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options, callback(err) * @param {Function} fn A callback function that is called with instance, options, callback(err)
* @name beforeValidate
*/ */
/** /**
* A hook that is run after validation * A hook that is run after validation
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options, callback(err) * @param {Function} fn A callback function that is called with instance, options, callback(err)
* @name afterValidate
*/ */
/** /**
* A hook that is run before creating a single instance * A hook that is run before creating a single instance
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options, callback(err) * @param {Function} fn A callback function that is called with attributes, options, callback(err)
* @name beforeCreate
*/ */
/** /**
* A hook that is run after creating a single instance * A hook that is run after creating a single instance
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options, callback(err) * @param {Function} fn A callback function that is called with attributes, options, callback(err)
* @name afterCreate
*/ */
/** /**
...@@ -204,6 +208,7 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -204,6 +208,7 @@ Hooks.hasHooks = Hooks.hasHook;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options, callback(err) * @param {Function} fn A callback function that is called with instance, options, callback(err)
* *
* @name beforeDestroy
* @alias beforeDelete * @alias beforeDelete
*/ */
...@@ -212,6 +217,7 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -212,6 +217,7 @@ Hooks.hasHooks = Hooks.hasHook;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options, callback(err) * @param {Function} fn A callback function that is called with instance, options, callback(err)
* *
* @name afterDestroy
* @alias afterDelete * @alias afterDelete
*/ */
...@@ -219,24 +225,28 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -219,24 +225,28 @@ Hooks.hasHooks = Hooks.hasHook;
* A hook that is run before updating a single instance * A hook that is run before updating a single instance
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options, callback(err) * @param {Function} fn A callback function that is called with instance, options, callback(err)
* @name beforeUpdate
*/ */
/** /**
* A hook that is run after updating a single instance * A hook that is run after updating a single instance
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options, callback(err) * @param {Function} fn A callback function that is called with instance, options, callback(err)
* @name afterUpdate
*/ */
/** /**
* A hook that is run before creating instances in bulk * A hook that is run before creating instances in bulk
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instances, options, callback(err) * @param {Function} fn A callback function that is called with instances, options, callback(err)
* @name beforeBulkCreate
*/ */
/** /**
* A hook that is run after creating instances in bulk * A hook that is run after creating instances in bulk
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instances, options, callback(err) * @param {Function} fn A callback function that is called with instances, options, callback(err)
* @name afterBulkCreate
*/ */
/** /**
...@@ -244,6 +254,7 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -244,6 +254,7 @@ Hooks.hasHooks = Hooks.hasHook;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* *
* @name beforeBulkDestroy
* @alias beforeBulkDelete * @alias beforeBulkDelete
*/ */
...@@ -252,6 +263,7 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -252,6 +263,7 @@ Hooks.hasHooks = Hooks.hasHook;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* *
* @name afterBulkDestroy
* @alias afterBulkDelete * @alias afterBulkDelete
*/ */
...@@ -259,60 +271,70 @@ Hooks.hasHooks = Hooks.hasHook; ...@@ -259,60 +271,70 @@ Hooks.hasHooks = Hooks.hasHook;
* A hook that is run after updating instances in bulk * A hook that is run after updating instances in bulk
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* @name beforeBulkUpdate
*/ */
/** /**
* A hook that is run after updating instances in bulk * A hook that is run after updating instances in bulk
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* @name afterBulkUpdate
*/ */
/** /**
* A hook that is run before a find (select) query * A hook that is run before a find (select) query
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* @name beforeFind
*/ */
/** /**
* A hook that is run before a find (select) query, after any { include: {all: ...} } options are expanded * A hook that is run before a find (select) query, after any { include: {all: ...} } options are expanded
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* @name beforeFindAfterExpandIncludeAll
*/ */
/** /**
* A hook that is run before a find (select) query, after all option parsing is complete * A hook that is run before a find (select) query, after all option parsing is complete
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options, callback(err) * @param {Function} fn A callback function that is called with options, callback(err)
* @name beforeFindAfterOptions
*/ */
/** /**
* A hook that is run after a find (select) query * A hook that is run after a find (select) query
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance(s), options, callback(err) * @param {Function} fn A callback function that is called with instance(s), options, callback(err)
* @name afterFind
*/ */
/** /**
* A hook that is run before a define call * A hook that is run before a define call
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options, callback(err) * @param {Function} fn A callback function that is called with attributes, options, callback(err)
* @name beforeDefine
*/ */
/** /**
* A hook that is run after a define call * A hook that is run after a define call
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with factory, callback(err) * @param {Function} fn A callback function that is called with factory, callback(err)
* @name afterDefine
*/ */
/** /**
* A hook that is run before Sequelize() call * A hook that is run before Sequelize() call
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with config, options, callback(err) * @param {Function} fn A callback function that is called with config, options, callback(err)
* @name beforeInit
*/ */
/** /**
* A hook that is run after Sequelize() call * A hook that is run after Sequelize() call
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with sequelize, callback(err) * @param {Function} fn A callback function that is called with sequelize, callback(err)
* @name afterInit
*/ */
module.exports = { module.exports = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!