oa-jira
Version:
Octet Agile's JIRA connectivity project.
18 lines (14 loc) • 645 B
JavaScript
const jira = require('../../jira');
const Resolution = require('../classes/resolution.class');
exports.create = ({ id, description, name } = {}) => {
return Resolution.create({ id, description, name });
};
exports.resolve = resolution => Resolution.resolve(resolution);
exports.getById = ({ connection, id, cache }) => {
if (cache.resolutions.has(id)) return cache.resolutions.get(id);
return jira
.getResolutionById(connection, id)
.then(data => (data ? Resolution.create(data) : Promise.resolve()))
.then(resolution => cache.resolutions.set(id, resolution))
.catch(error => Promise.reject(error));
};