src/services/notification.service.js
Function notifyViaEmailAndPush
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async notifyViaEmailAndPush(req, res, slug) {
try {
const followedUser = await models.user.findOne({ where: { email: req.auth.email } });
const myFollowers = await models.Follow.findAll({
where: { followedUserId: followedUser.id },
Function notifyUsersWhoFavorited
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async notifyUsersWhoFavorited(req, res, articleId, slug) {
try {
// returns an array of userIDs have favorited the article commented on
const arrayOfUserIDs = await models.Favorites.findAll({ where: { articleId } }).map(item => item.dataValues.userId);