"use strict"; /** * Created by Sun Chu on 9/17/2017. */ (function () { 'use strict'; angular.module('mcsmModule') .factory('mcsmModel', ['$log', '$q', 'mcsmService', function ($log, $q, mcsmService) { var mcsmModel = { manualAssociationSupportingSystemsByType: {} }; /** * Public functions */ /** * get list of supporting systems that allow manual association * * @param {String} type * @returns {*} */ mcsmModel.getManualAssociationSupportingSystems = function (type) { var cachedResponse = mcsmModel.manualAssociationSupportingSystemsByType[type]; if (cachedResponse) { return $q.when(cachedResponse); } else { return mcsmService.getManualAssociationSupportingSystems(type).then(function (response) { mcsmModel.manualAssociationSupportingSystemsByType[type] = response; return response; }); } }; mcsmModel.updateAssociation = function (type, displayId, vendorId) { return mcsmService.updateAssociation(type, displayId, vendorId); }; mcsmModel.removeAssociation = function (type, displayId, vendorTicketId, vendorId) { return mcsmService.removeAssociation(type, displayId, vendorTicketId, vendorId); }; return mcsmModel; }]); })();