This repository was archived by the owner on Dec 8, 2022. It is now read-only.
forked from techx/quill
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUserService.js
More file actions
107 lines (86 loc) · 2.43 KB
/
UserService.js
File metadata and controls
107 lines (86 loc) · 2.43 KB
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
angular.module("reg").factory("UserService", [
"$http",
"Session",
function($http, Session) {
var users = "/api/users";
var base = users + "/";
return {
// ----------------------
// Basic Actions
// ----------------------
getCurrentUser: function() {
return Session.getUserId() ? $http.get(base + Session.getUserId()) : "";
},
get: function(id) {
return $http.get(base + id);
},
getByEmail: function(email) {
return $http.get(base + "email/" + email);
},
getAll: function() {
return $http.get(base);
},
getPage: function(page, size, text) {
return $http.get(
users +
"?" +
$.param({
text: text,
page: page ? page : 0,
size: size ? size : 50
})
);
},
updateProfile: function(id, profile) {
profile.name = profile.firstname + " " + profile.lastname;
return $http.put(base + id + "/profile", {
profile: profile
});
},
updateConfirmation: function(id, confirmation) {
return $http.put(base + id + "/confirm", {
confirmation: confirmation
});
},
declineAdmission: function(id) {
return $http.post(base + id + "/decline");
},
// -------------------------
// Admin Only
// -------------------------
getStats: function() {
return $http.get(base + "stats");
},
getQueue: function() {
return $http.get(base + "viewQueue");
},
addQueue: function(id) {
return $http.post(base + id + "/queue");
},
removeQueue: function(id) {
return $http.delete(base + id + "/queue");
},
admitQueue: function(id) {
return $http.post(base + "acceptQueue");
},
admitUser: function(id) {
return $http.post(base + id + "/admit");
},
checkIn: function(id) {
return $http.post(base + id + "/checkin");
},
checkOut: function(id) {
return $http.post(base + id + "/checkout");
},
markWaiverAsSigned: function(id) {
return $http.post(base + id + "/sign");
},
sendAdmittedEmail: function() {
return $http.post(base + "emailAdmitted");
},
sendWaiverEmail: function(id) {
return $http.post(base + id + "/sendwaiver");
}
};
}
]);