andela/codepirates-ah-backend

View on GitHub
src/services/notification.service.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function notifyViaEmailAndPush has 44 lines of code (exceeds 25 allowed). Consider refactoring.
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 },
Severity: Minor
Found in src/services/notification.service.js - About 1 hr to fix

    Function notifyUsersWhoFavorited has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    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);
    
    
    Severity: Minor
    Found in src/services/notification.service.js - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status