{"size": 555, "ext": "js", "max_stars_repo_path": "src/services/gift.js", "max_stars_repo_name": "ajibs/gift-recommender-service", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/services/gift.js", "max_issues_repo_name": "ajibs/gift-recommender-service", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/services/gift.js", "max_forks_repo_name": "ajibs/gift-recommender-service", "max_forks_repo_forks_event_min_datetime": "2021-04-15T08:46:02.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-15T08:46:02.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 29.2105263158, "max_line_length": 94, "alphanum_fraction": 0.6396396396}
const logger = require('src/lib/logger');
const Gift = require('src/models/gift');
const Utils = require('src/lib/utils');
const shuffleArray = Utils.shuffleArray;

const giftService = (giftIdeaId, reqId) => {
    logger.info(`Request ID : ${reqId} - fetching purchase links under an idea from service`);

    return new Gift().fetchGiftsUnderAnIdea(giftIdeaId)
        .then(response => {
            if (response) return shuffleArray(response);
        })
        .catch(error => {
            throw error;
        });
};

module.exports = giftService;
