{"size": 903, "ext": "js", "max_stars_repo_path": "src/controllers/User/Followers/listFollowings.js", "max_stars_repo_name": "fairfield-programming/backend-server", "max_stars_repo_stars_event_min_datetime": "2021-12-21T18:04:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T08:43:51.000Z", "max_issues_repo_path": "src/controllers/User/Followers/listFollowings.js", "max_issues_repo_name": "fairfield-programming/backend-server", "max_issues_repo_issues_event_min_datetime": "2021-12-24T02:18:12.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T10:35:54.000Z", "max_forks_repo_path": "src/controllers/User/Followers/listFollowings.js", "max_forks_repo_name": "fairfield-programming/backend-server", "max_forks_repo_forks_event_min_datetime": "2021-12-24T23:17:23.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-25T12:33:28.000Z"}
{"max_stars_count": 24, "max_issues_count": 105, "max_forks_count": 22, "avg_line_length": 22.575, "max_line_length": 90, "alphanum_fraction": 0.5825027685}

/**
 * @module List Followers Controller
 * 
 * @param {Request} req - HTTP Request from the client
 * @param {Response} res - HTTP Response for the client
 * 
 * @description
 * This controller will allow the user to see the accounts that he is currently following,
 *  if all parameters are correct.
 * 
 * @todo
 * Nothing for now.
 */

module.exports.listFollowings = async (req, res) => {

    try {

        const userFollowingsList = await User.findOne({
            where: {
                id: req.user.id,
            },
            include: 'Followee',
        });

        if (!userFollowingsList) {
            return res.status(404).send({ msg: "User not found." });
        }

        return res.status(200).json(userFollowingsList.Followee);

    } catch (err) {
        console.log(err.message);
        return res.status(500).send({ msg: 'Error on listing followings.' });
    }


};
