2015-06-23 16:04:41 +00:00
|
|
|
|
2015-06-09 17:16:29 +00:00
|
|
|
var DEBUG = true;
|
2015-05-09 19:00:14 +00:00
|
|
|
|
|
|
|
var service = angular.module('seHub.services', []);
|
|
|
|
|
|
|
|
service.factory('apiService', ['$http', function($http) {
|
|
|
|
return {
|
|
|
|
getUserByToken: function(token){
|
2015-06-15 13:23:42 +00:00
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserByToken/" + token;
|
2015-05-09 19:00:14 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-10 10:36:31 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
getUserById: function(token, id){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + id;
|
2015-06-10 10:36:31 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-05-09 19:00:14 +00:00
|
|
|
};
|
2015-06-11 20:36:26 +00:00
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
getAllCampuses: function(token){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getAll/" + token;
|
2015-06-11 20:36:26 +00:00
|
|
|
req = {
|
2015-07-01 04:05:13 +00:00
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-11 20:36:26 +00:00
|
|
|
};
|
2015-06-16 20:29:34 +00:00
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
getCampusesByUser: function(token){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUser/" + token;
|
2015-06-16 20:29:34 +00:00
|
|
|
req = {
|
2015-07-01 04:05:13 +00:00
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-16 20:29:34 +00:00
|
|
|
};
|
2015-05-09 19:00:14 +00:00
|
|
|
return $http(req);
|
2015-06-22 10:06:56 +00:00
|
|
|
},
|
2015-06-29 10:06:13 +00:00
|
|
|
getAllCoursesByCampus: function(token, campusId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAllCoursesByCampus/" + token + '/' + campusId;
|
2015-06-23 16:04:41 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
2015-06-24 10:13:58 +00:00
|
|
|
url : url
|
2015-06-23 16:04:41 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-06-22 10:06:56 +00:00
|
|
|
getAllCourses: function(token){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token;
|
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-02 18:24:01 +00:00
|
|
|
getMessagesByGroupId: function(token, groupId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/messages/getMessagesByGroup/" + token + "/" + groupId;
|
2015-06-22 10:06:56 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-24 10:13:58 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-06-24 11:01:08 +00:00
|
|
|
getMessagesByCourseName: function(token, courseName){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getMessagesByCourseName/" + token + '/' + courseName;
|
2015-06-22 10:06:56 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-24 18:35:21 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-06-26 18:56:41 +00:00
|
|
|
getCoursesByUser: function(token, campusId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + campusId;
|
2015-06-24 18:35:21 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-06-26 18:56:41 +00:00
|
|
|
getProjectsByCourse: function(token, classId){
|
2015-06-29 14:57:32 +00:00
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsByCourse/" + token + "/" + classId;
|
2015-06-24 18:35:21 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-26 12:06:59 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-06-29 19:31:32 +00:00
|
|
|
getProjectsById: function(token, projectId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsById/" + token + "/" + projectId;
|
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-06-27 11:20:21 +00:00
|
|
|
getProjectsByUser: function(token){
|
2015-06-29 11:41:17 +00:00
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsByUser/" + token;
|
2015-06-27 11:20:21 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
getCampusesByUserId: function(token, id){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUserID/" + token + "/" + id;
|
2015-06-26 12:06:59 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
getCoursesByUserID: function(token, userId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + userId;
|
2015-06-26 12:06:59 +00:00
|
|
|
req = {
|
|
|
|
method : "GET",
|
|
|
|
url : url
|
2015-06-22 10:06:56 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
2015-06-27 09:45:44 +00:00
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
getAllFutureTasks: function(token, courseId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token + "/" + courseId;
|
2015-06-27 09:45:44 +00:00
|
|
|
req = {
|
2015-07-01 04:05:13 +00:00
|
|
|
method : "GET",
|
2015-06-27 09:45:44 +00:00
|
|
|
url : url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
|
|
|
createMessage: function(token, payLoad){
|
2015-06-30 23:35:23 +00:00
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/messages/create/" + token;
|
2015-06-27 09:45:44 +00:00
|
|
|
req = {
|
|
|
|
method : "POST",
|
|
|
|
url : url,
|
|
|
|
data: payLoad
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-06-29 11:41:17 +00:00
|
|
|
},
|
2015-07-02 18:24:01 +00:00
|
|
|
createProject: function(token, payLoad){
|
2015-06-29 11:41:17 +00:00
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/create/" + token;
|
|
|
|
req = {
|
|
|
|
method : "POST",
|
|
|
|
url : url,
|
|
|
|
data: payLoad
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-06-29 11:45:37 +00:00
|
|
|
},
|
2015-07-01 04:05:13 +00:00
|
|
|
sendValidationMail: function(token, email){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/validation/sendmail/" + token;
|
|
|
|
payload = {
|
|
|
|
email: email
|
|
|
|
};
|
|
|
|
req = {
|
|
|
|
method: "POST",
|
|
|
|
url: url,
|
|
|
|
data: payload
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
|
|
|
createCourse: function(token, payLoad){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token;
|
|
|
|
req = {
|
|
|
|
method : "POST",
|
|
|
|
url : url,
|
|
|
|
data: payLoad
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
|
|
|
joinCourse: function(token, courseId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/joinCourse/" + token + "/" + courseId;
|
|
|
|
req = {
|
|
|
|
method : "PUT",
|
2015-06-29 11:25:20 +00:00
|
|
|
url : url
|
2015-06-29 11:21:17 +00:00
|
|
|
};
|
|
|
|
return $http(req);
|
2015-07-01 04:05:13 +00:00
|
|
|
},
|
|
|
|
updateUser: function(token, payLoad){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token;
|
|
|
|
req = {
|
|
|
|
method: "PUT",
|
|
|
|
url: url,
|
|
|
|
data: payLoad
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-07-02 14:31:33 +00:00
|
|
|
},
|
2015-08-01 14:51:13 +00:00
|
|
|
joinProject: function(token, projectId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/joinProject/" + token + "/" + projectId;
|
|
|
|
req = {
|
|
|
|
method: "PUT",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-08-02 09:55:43 +00:00
|
|
|
removeProject: function(token, projectId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/deleteProject/" + token + "/" + projectId;
|
|
|
|
req = {
|
|
|
|
method: "DELETE",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-08-02 14:51:08 +00:00
|
|
|
removeUserFromProject: function(token, userId, projectId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/removeUserFromProject/" + token + "/" + userId + "/" + projectId;
|
|
|
|
req = {
|
|
|
|
method: "DELETE",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-08-02 10:45:42 +00:00
|
|
|
getAllFutureTasks: function(token){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token;
|
2015-08-02 09:55:43 +00:00
|
|
|
req = {
|
|
|
|
method: "GET",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
|
|
|
getAllUserTasks: function(token){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllUserTasks/" + token;
|
|
|
|
req = {
|
|
|
|
method: "GET",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
|
|
|
getAllTasksByCourse: function(token, courseId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllTasksByCourse/" + token + "/" + courseId;
|
|
|
|
req = {
|
|
|
|
method: "GET",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
|
|
|
getAllUserMessages: function(token){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/messages/getAllUserMessages/" + token;
|
|
|
|
req = {
|
|
|
|
method: "GET",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
},
|
2015-07-02 18:38:37 +00:00
|
|
|
getCourseById: function(token, id){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesById/" + token + "/" + id;
|
2015-07-02 14:31:33 +00:00
|
|
|
req = {
|
|
|
|
method: "GET",
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-08-02 10:44:15 +00:00
|
|
|
},
|
|
|
|
createTask: function(token, payload){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/create/" + token;
|
|
|
|
req = {
|
|
|
|
method: 'POST',
|
|
|
|
data: payload,
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-08-02 11:55:39 +00:00
|
|
|
},
|
|
|
|
getTaskById: function(token, taskId, ownerId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getTaskById/" + token + "/" + taskId + "/" + ownerId;
|
|
|
|
var req = {
|
|
|
|
method: 'GET',
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
|
|
|
|
2015-08-02 13:57:46 +00:00
|
|
|
},
|
|
|
|
submitTask: function(token, taskId, ownerId, payload){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/submitTask/" + token + '/' + taskId + '/' + ownerId;
|
|
|
|
req = {
|
|
|
|
method: 'POST',
|
|
|
|
data: payload,
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-08-02 16:53:35 +00:00
|
|
|
},
|
|
|
|
submitGrade: function(token, taskId, ownerId, grade){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/submitGrade/" + token + '/' + taskId + '/' + ownerId + '/' + grade;
|
|
|
|
req = {
|
|
|
|
method: 'POST',
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-08-02 19:34:05 +00:00
|
|
|
},
|
|
|
|
isTaskSubmitted: function(token, taskId, ownerId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/isTaskSubmitted/" + token + '/' + taskId + '/' + ownerId;
|
|
|
|
req = {
|
|
|
|
method: 'GET',
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-08-02 20:53:20 +00:00
|
|
|
},
|
|
|
|
getUsersStateByTask: function(token, taskId){
|
|
|
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getUsersStateByTask/" + token + '/' + taskId;
|
|
|
|
req = {
|
|
|
|
method: 'GET',
|
|
|
|
url: url
|
|
|
|
};
|
|
|
|
return $http(req);
|
2015-05-09 19:00:14 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}]);
|