OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/assets/javascripts/angular/services/project-service.js

39 lines
1.0 KiB

angular.module('openproject.services')
.service('ProjectService', ['$http', 'PathHelper', 'FiltersHelper', function($http, PathHelper, FiltersHelper) {
var ProjectService = {
getProject: function(projectIdentifier) {
var url = PathHelper.apiV3ProjectPath(projectIdentifier);
return $http.get(url).then(function(response) {
return response.data.project;
});
},
getProjects: function() {
var url = PathHelper.apiV3ProjectsPath();
return ProjectService.doQuery(url)
.then(function(projects){
return FiltersHelper.assignAncestorLevels(projects);
});
},
getSubProjects: function(projectIdentifier) {
var url = PathHelper.apiProjectSubProjectsPath(projectIdentifier);
return ProjectService.doQuery(url);
},
doQuery: function(url, params) {
return $http.get(url, { params: params })
.then(function(response){
return response.data.projects;
});
},
};
return ProjectService;
}]);