62 lines
2.3 KiB
JavaScript
62 lines
2.3 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Created by Sun Chu on 9/17/2017.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
angular.module('mcsmModule').service('mcsmService', ['$resource', function ($resource) {
|
|
var resource = $resource('/smartit/rest/mcsm', {}, {
|
|
getManualAssociationSupportingSystems: {
|
|
url: '/smartit/rest/mcsm/vendordevops?type=:type',
|
|
method: 'GET',
|
|
isArray: true
|
|
},
|
|
updateAssociation: {
|
|
url: '/smartit/rest/mcsm/devops/:type/:displayId/vendor/:vendorId',
|
|
method: 'GET',
|
|
isArray: false
|
|
},
|
|
removeAssociation: {
|
|
url: '/smartit/rest/mcsm/devops/:type/:displayId/vendorticketid/:vendorTicketId?vendorId=:vendorId',
|
|
method: 'DELETE',
|
|
isArray: false
|
|
}
|
|
});
|
|
/**
|
|
* Public functions
|
|
*/
|
|
/**
|
|
* get list of supporting systems that allow manual association
|
|
*
|
|
* @param {Object} type
|
|
* @returns {*}
|
|
*/
|
|
this.getManualAssociationSupportingSystems = function (type) {
|
|
return resource.getManualAssociationSupportingSystems({
|
|
type: type
|
|
}).$promise.then(function (response) {
|
|
return _.isArray(response) ? response : [];
|
|
});
|
|
};
|
|
this.updateAssociation = function (type, displayId, vendorId) {
|
|
return resource.updateAssociation({
|
|
type: type,
|
|
displayId: displayId,
|
|
vendorId: vendorId
|
|
}).$promise.then(function (response) {
|
|
return response && response.tickets || [];
|
|
});
|
|
};
|
|
this.removeAssociation = function (type, displayId, vendorTicketId, vendorId) {
|
|
return resource.removeAssociation({
|
|
type: type,
|
|
displayId: displayId,
|
|
vendorTicketId: vendorTicketId,
|
|
vendorId: vendorId
|
|
}).$promise.then(function (response) {
|
|
return response && response.tickets || [];
|
|
});
|
|
};
|
|
}]);
|
|
})();
|