37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Created by viktor.shevchenko on 7/10/2014.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
angular.module('myitsmApp')
|
|
.service('metadataService', ['$resource', function ($resource) {
|
|
var resource = $resource('/smartit/rest/v2/metadata/', {}, {
|
|
getMetadataByType: { method: 'GET', isArray: true }
|
|
//getKnowledgeMetaData: {url: 'mocks/ka-metadata.json',method: 'GET'}
|
|
}), resource2 = $resource('/smartit/rest/v2/metadata/person', {}, {
|
|
getPersonMetadata: { method: 'GET', isArray: true }
|
|
});
|
|
this.getMetadataByType = function (type) {
|
|
//if(type == 'knowledge'){
|
|
// return resource.getKnowledgeMetaData().$promise.then(function(result){
|
|
// return [new MetadataVO().build(result)];
|
|
// });
|
|
//}
|
|
return resource.getMetadataByType({ type: type }).$promise.then(function (result) {
|
|
return _.map(result[0].items[0], function (item) {
|
|
return new MetadataVO().build(item);
|
|
});
|
|
});
|
|
};
|
|
//person metadata call for creating a new customer
|
|
this.getPersonMetadata = function () {
|
|
return resource2.getPersonMetadata().$promise.then(function (result) {
|
|
return _.map(result[0].items, function (item) {
|
|
return new MetadataVO().build(item);
|
|
});
|
|
});
|
|
};
|
|
}]);
|
|
}());
|