MCPcopy Create free account

hub / github.com/EQuimper/nodejs-api-boilerplate / functions

Functions36 in github.com/EQuimper/nodejs-api-boilerplate

↓ 24 callersMethodgenerate
* Create a user * * @public * @param {Object} attrs of user * @returns {Object} a fake user
__mocks__/factories/user.factory.js:17
↓ 7 callersFunctionfilteredBody
(body, whitelist)
src/utils/filteredBody.js:10
↓ 1 callersFunctiondeleteUserSeed
()
src/seeds/user.seed.js:21
↓ 1 callersFunctionenvConfig
(env)
src/config/constants.js:34
↓ 1 callersMethodmakePretty
* Make error pretty * * @static * @param {Array} errors - Array of error Object * @returns {Object} - errors - Pretty Object transform
src/services/error.js:53
↓ 1 callersFunctionuserSeed
(count)
src/seeds/user.seed.js:5
Function_hashPassword
* Hash the user password * * @private * @param {String} password - user password choose * @returns {String} password - hash password
src/models/user.model.js:131
FunctionauthenticateUser
* Authenticate the user * * @public * @param {String} password - provided by the user * @returns {Boolean} isMatch - password match
src/models/user.model.js:121
FunctionclearAll
(req, res, next)
src/controllers/seed.controller.js:43
FunctionclearSeedUsers
(req, res, next)
src/controllers/seed.controller.js:24
Methodconstructor
(message, status, isPublic)
src/services/error.js:7
Methodconstructor
* Creates an API error. * * @param {String} message - Error message. * @param {Number} status - HTTP status code of error. * @param {Boole
src/services/error.js:31
Functioncreate
(req, res, next)
src/controllers/post.controller.js:220
Functioncreate
(req, res, next)
src/controllers/user.controller.js:60
FunctioncreatePost
* Create a post * * @public * @param {Object} args - Object contains title and text * @param {String} authorId - the author id * @retur
src/models/post.model.js:61
FunctioncreateToken
* Generate a jwt token for authentication * * @public * @returns {String} token - JWT token
src/models/user.model.js:141
FunctiondecFavoriteCount
(postId)
src/models/post.model.js:86
FunctiondeletePost
(req, res, next)
src/controllers/post.controller.js:263
FunctionfavoritePost
(req, res, next)
src/controllers/post.controller.js:371
Methodgenerate
* Create a post * * @public * @param {Object} attrs of post * @returns {Object} a fake post
__mocks__/factories/post.factory.js:17
MethodgenerateList
* Return a list * * @public * @param {Number} count * @param {Object} If add more attributes * @returns {Array} List
__mocks__/factories/base.factory.js:14
FunctiongetById
(req, res, next)
src/controllers/post.controller.js:162
FunctiongetList
(req, res, next)
src/controllers/post.controller.js:91
FunctionincFavoriteCount
(postId)
src/models/post.model.js:82
FunctionisPostIsFavorite
* Check if post is favorite by current user. * * @param {String} postId - _id of the post * @returns {Boolean} isFavorite - post is fav
src/models/user.model.js:106
Functionlist
* If you call list() with zero arguments, the destructuring fails, * because you can’t match an object pattern against undefined. * That can be
src/models/post.model.js:74
FunctionlogErrorService
(err, req, res, next)
src/services/log.js:16
Functionlogin
(req, res, next)
src/controllers/authentication.controller.js:50
Functionposts
* Favorite a post or unfavorite if already here * * @param {String} postId - _id of the post like * @returns {Promise}
src/models/user.model.js:84
FunctionseedUsers
(req, res, next)
src/controllers/seed.controller.js:11
Functionslugify
* Slug the title and add this to the slug prop
src/models/post.model.js:95
FunctiontoAuthJSON
* Parse the user object in data we wanted to send when is auth * * @public * @returns {Object} User - ready for auth
src/models/user.model.js:156
FunctiontoJSON
* Parse the user object in data we wanted to send * * @public * @returns {Object} User - ready for populate
src/models/user.model.js:169
FunctiontoJSON
* Parse the post in format we want to send. * * @public * @returns {Post} Post Object
src/models/post.model.js:104
FunctionupdatePost
(req, res, next)
src/controllers/post.controller.js:323
Functionvalidator
(email)
src/models/user.model.js:19