all files / js/administration/ administration.service.js

53.97% Statements 34/63
100% Branches 0/0
13.79% Functions 4/29
53.97% Lines 34/63
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128                                                                                                                                                                                           
/**
 * Created by cklimkowsky on 2/27/15.
 */
angular
    .module('coopEval')
    .service('administrationService', administrationService);
 
function administrationService($http) {
 
    var urlBase = 'services/UserService';
 
    this.getAdmins = function () {
        return $http.get(urlBase + '/getAdminUsers')
    };
 
    this.addAdmin = function (adminUser) {
        return $http.put(urlBase + '/addAdminUser', adminUser)
    };
 
    this.removeAdminUser = function (adminId) {
        return $http.delete(urlBase + '/deleteAdminUser?adminId=' + adminId)
    };
 
    this.getDeptUsers = function (departmentId) {
        return $http.get(urlBase + '/getDepartmentUsers?departmentId=' + departmentId)
    };
 
    this.addDeptUser = function (departmentId, deptUser) {
        return $http.post(urlBase + '/addDepartmentUser?departmentId='+ departmentId, deptUser)
    };
 
    this.removeDeptUser = function (departmentId, deptUserId) {
        return $http.delete(urlBase + '/deleteDepartmentUser?departmentId='+ departmentId + '&deptUserID=' + deptUserId)
    };
 
    this.getColleges = function () {
        return $http.get('services/CollegeService/getAllColleges')
    };
 
    this.getDepartments = function (collegeId) {
        return $http.get('services/CollegeService/getAllDepartments?collegeId=' + collegeId)
    };
 
    this.addCollege = function (college) {
        return $http.put('services/CollegeService/addCollege', college)
    };
 
    this.removeCollege = function (id) {
        return $http.delete('services/CollegeService/deleteCollege?collegeId=' + id)
    };
 
    this.addDepartment = function (department) {
        return $http.put('services/CollegeService/addDepartment', department)
    };
 
    this.removeDepartment = function (id) {
        return $http.delete('services/CollegeService/deleteDepartment?departmentId=' + id)
    };
 
    this.getStudentForms = function () {
        console.log('HERE');
        return $http.get('services/FormService/getStudentForms');
    };
 
    this.getEmployerForms = function () {
        console.log('HERE');
        return $http.get('services/FormService/getEmployerForms');
    };
 
    this.getForm = function (formName) {
        var encodedFormName = formName.replace(' ', '%20');
        return $http.get('services/FormService/getForm?name=' + encodedFormName)
    };
 
    this.getEmptyQuestionGroup = function () {
        return $http.get('services/FormService/getEmptyFormQuestionGroup')
    };
 
    this.getEmptyQuestion = function () {
        return $http.get('services/FormService/getEmptyFormQuestion')
    };
 
    this.addQuestionGroup = function (questionGroup) {
        return $http.put('services/FormService/addFormQuestionGroup', questionGroup)
    };
 
    this.addQuestion = function (question) {
        return $http.put('services/FormService/addFormQuestion', question)
    };
 
    this.deleteQuestionGroup = function (questionGroupOrder) {
        return $http.delete('services/FormService/deleteFormQuestionGroup?questionGroupOrder=' + questionGroupOrder)
    };
 
    this.deleteQuestion = function (questionOrder) {
        return $http.delete('services/FormService/deleteFormQuestion?questionOrder=' + questionOrder)
    };
 
    this.saveForm = function (form) {
        console.log(form);
        return $http.put('services/FormService/saveForm', form)
    };
 
    this.getAllQuestionCategories = function () {
        return $http.get('services/FormService/getAllQuestionCategories')
    };
 
    this.getAllQuestionTypes = function () {
        return $http.get('services/FormService/getAllQuestionTypes')
    };
 
    this.createForm = function (form) {
        return $http.put('services/FormService/createForm', form)
    };
 
    this.deleteForm = function (formId) {
        return $http.delete('services/FormService/deleteForm?formId=' + formId)
    };
 
    this.assignForm = function (form) {
        return $http.put('services/FormService/assignForm', form)
    };
 
    this.getFutureTerms = function () {
        return $http.get('services/CollegeService/getFutureTerms')
    };
}