SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/knowledge-team/knowledge-team-service.js

77 lines
3.0 KiB
JavaScript

"use strict";
(function () {
'use strict';
angular.module('knowledgeTeamModule')
.service('knowledgeTeamService', ['$resource', function ($resource) {
var resource = $resource('/smartit/rest/person/:id', {}, {
getKnowledgeTeamList: {
method: 'GET',
url: '/smartit/rest/kcsliveview/team',
isArray: true
},
getPerson: {
method: 'GET',
//url: '/smartit/rest/person/supportgrouppersons?companyName=:companyName&thumbnail=:thumbnail',
url: 'mocks/knowledge-team.json',
isArray: true
},
getKnowledgeCandidates: {
method: 'GET',
url: '/smartit/rest/person/supportgrouppersons',
isArray: true
},
addCoachee: {
url: '/smartit/rest/kcsliveview/add/coachee',
method: 'POST',
isArray: true
},
removeCoachee: {
url: '/smartit/rest/kcsliveview/delete/coachee',
method: 'POST',
isArray: true
},
getReportsList: {
url: '/smartit/rest/reporting/kcsreports',
method: 'GET',
isArray: true
},
getReportURL: {
url: '/smartit/rest/reporting/kcsreport/:id',
method: 'GET',
isArray: false
}
});
this.getKnowledgeTeamList = function () {
return resource.getKnowledgeTeamList().$promise.then(function (result) {
return result;
});
};
this.getListOfPersons = function (searchText, company) {
var inputParams = {
personText: searchText,
chunkInfo: { startIndex: 0, chunkSize: 20 },
thumbnail: true,
role: 'kcsmember',
companyName: company
};
return resource.getKnowledgeCandidates(inputParams).$promise;
};
this.addCoachee = function (personList) {
return resource.addCoachee({}, personList).$promise;
};
this.removeCoachee = function (personList) {
return resource.removeCoachee({}, personList).$promise;
};
this.getReportsList = function () {
return resource.getReportsList().$promise.then(function (result) {
return result;
});
};
this.getReportURL = function (id) {
return resource.getReportURL({ id: id }).$promise.then(function (result) {
return result;
});
};
}]);
})();