@itutoring/itutoring_application_js_api 1.6.7 → 1.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apiController.js +10 -2
- package/modules/Models.js +238 -0
- package/modules/TableExplorer.js +198 -0
- package/package.json +1 -1
package/apiController.js
CHANGED
|
@@ -13,6 +13,7 @@ class APIController
|
|
|
13
13
|
static UserSource = null;
|
|
14
14
|
|
|
15
15
|
static onErrorReceived = null
|
|
16
|
+
static onConfimationReceived = null;
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* R_KEY MUST be loaded before calling this method!
|
|
@@ -78,6 +79,13 @@ class APIController
|
|
|
78
79
|
{
|
|
79
80
|
window.location.href = json.url;
|
|
80
81
|
}
|
|
82
|
+
if (json.data['conf_request'] !== undefined)
|
|
83
|
+
{
|
|
84
|
+
if (APIController.onConfimationReceived !== null && APIController.onConfimationReceived !== undefined)
|
|
85
|
+
{
|
|
86
|
+
APIController.onConfimationReceived(json.data['conf_request']);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
81
89
|
return (json.data);
|
|
82
90
|
}
|
|
83
91
|
if (json.code === 400)
|
|
@@ -112,9 +120,9 @@ class APIController
|
|
|
112
120
|
*/
|
|
113
121
|
static async Get(module, method, data, useCache = false, cacheSuffix = "")
|
|
114
122
|
{
|
|
115
|
-
if (useCache && APICache.IsCached(module + method))
|
|
123
|
+
if (useCache && APICache.IsCached(module + method + cacheSuffix))
|
|
116
124
|
{
|
|
117
|
-
return APICache.Retrive(module + method);
|
|
125
|
+
return APICache.Retrive(module + method + cacheSuffix);
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
await APIController.GetLocalRKey();
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import APIController from "../apiController";
|
|
2
|
+
|
|
3
|
+
class Models
|
|
4
|
+
{
|
|
5
|
+
static #MODULE = 'Models';
|
|
6
|
+
|
|
7
|
+
static #SET_EVENT = 'SetEvent';
|
|
8
|
+
static #GET_EVENT = 'GetEvent';
|
|
9
|
+
static #DELETE_EVENT = 'DeleteEvent';
|
|
10
|
+
static #SET_INQUIRY = 'SetInquiry';
|
|
11
|
+
static #GET_INQUIRY = 'GetInquiry';
|
|
12
|
+
static #DELETE_INQUIRY = 'DeleteInquiry';
|
|
13
|
+
static #SET_OFFER = 'SetOffer';
|
|
14
|
+
static #GET_OFFER = 'GetOffer';
|
|
15
|
+
static #DELETE_OFFER = 'DeleteOffer';
|
|
16
|
+
static #SET_CUSTOMER = 'SetCustomer';
|
|
17
|
+
static #GET_CUSTOMER = 'GetCustomer';
|
|
18
|
+
static #DELETE_CUSTOMER = 'DeleteCustomer';
|
|
19
|
+
static #SET_STUDENT = 'SetStudent';
|
|
20
|
+
static #GET_STUDENT = 'GetStudent';
|
|
21
|
+
static #DELETE_STUDENT = 'DeleteStudent';
|
|
22
|
+
static #SET_LECTURE = 'SetLecture';
|
|
23
|
+
static #GET_LECTURE = 'GetLecture';
|
|
24
|
+
static #DELETE_LECTURE = 'DeleteLecture';
|
|
25
|
+
static #SET_LECTURE_ATTENDANCE = 'SetLectureAttendance';
|
|
26
|
+
static #GET_LECTURE_ATTENDANCE = 'GetLectureAttendance';
|
|
27
|
+
static #DELETE_LECTURE_ATTENDANCE = 'DeleteLectureAttendance';
|
|
28
|
+
static #GET_OFFERS_FOR_INQUIRY = 'GetOffersForInquiry';
|
|
29
|
+
static #GET_STUDENTS_FOR_CUSTOMER = 'GetStudentsForCustomer';
|
|
30
|
+
static #GET_LECTURES_FOR_EVENT = 'GetLecturesForEvent';
|
|
31
|
+
static #GET_ATTENDANCE_FOR_LECTURE = 'GetAttendanceForLecture';
|
|
32
|
+
|
|
33
|
+
static async setEvent(event)
|
|
34
|
+
{
|
|
35
|
+
await APIController.Post(this.#MODULE, this.#SET_EVENT, {
|
|
36
|
+
'event': JSON.stringify(event),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static async getEvent(id)
|
|
41
|
+
{
|
|
42
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_EVENT, {
|
|
43
|
+
'id': id,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static async deleteEvent(id, toTrash = true)
|
|
50
|
+
{
|
|
51
|
+
await APIController.Post(this.#MODULE, this.#DELETE_EVENT, {
|
|
52
|
+
'id': id,
|
|
53
|
+
'toTrash': toTrash,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static async setInquiry(inquiry)
|
|
58
|
+
{
|
|
59
|
+
await APIController.Post(this.#MODULE, this.#SET_INQUIRY, {
|
|
60
|
+
'inquiry': JSON.stringify(inquiry),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static async getInquiry(id)
|
|
65
|
+
{
|
|
66
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_INQUIRY, {
|
|
67
|
+
'id': id,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return data;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static async deleteInquiry(id, toTrash = true)
|
|
74
|
+
{
|
|
75
|
+
await APIController.Post(this.#MODULE, this.#DELETE_INQUIRY, {
|
|
76
|
+
'id': id,
|
|
77
|
+
'toTrash': toTrash,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static async setOffer(offer)
|
|
82
|
+
{
|
|
83
|
+
await APIController.Post(this.#MODULE, this.#SET_OFFER, {
|
|
84
|
+
'offer': JSON.stringify(offer),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static async getOffer(id)
|
|
89
|
+
{
|
|
90
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_OFFER, {
|
|
91
|
+
'id': id,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return data;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static async deleteOffer(id, toTrash = true)
|
|
98
|
+
{
|
|
99
|
+
await APIController.Post(this.#MODULE, this.#DELETE_OFFER, {
|
|
100
|
+
'id': id,
|
|
101
|
+
'toTrash': toTrash,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static async setCustomer(customer)
|
|
106
|
+
{
|
|
107
|
+
await APIController.Post(this.#MODULE, this.#SET_CUSTOMER, {
|
|
108
|
+
'customer': JSON.stringify(customer),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static async getCustomer(id)
|
|
113
|
+
{
|
|
114
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_CUSTOMER, {
|
|
115
|
+
'id': id,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return data;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static async deleteCustomer(id, toTrash = true)
|
|
122
|
+
{
|
|
123
|
+
await APIController.Post(this.#MODULE, this.#DELETE_CUSTOMER, {
|
|
124
|
+
'id': id,
|
|
125
|
+
'toTrash': toTrash,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static async setStudent(student)
|
|
130
|
+
{
|
|
131
|
+
await APIController.Post(this.#MODULE, this.#SET_STUDENT, {
|
|
132
|
+
'student': JSON.stringify(student),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
static async getStudent(id)
|
|
137
|
+
{
|
|
138
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_STUDENT, {
|
|
139
|
+
'id': id,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
return data;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static async deleteStudent(id, toTrash = true)
|
|
146
|
+
{
|
|
147
|
+
await APIController.Post(this.#MODULE, this.#DELETE_STUDENT, {
|
|
148
|
+
'id': id,
|
|
149
|
+
'toTrash': toTrash,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static async setLecture(lecture)
|
|
154
|
+
{
|
|
155
|
+
await APIController.Post(this.#MODULE, this.#SET_LECTURE, {
|
|
156
|
+
'lecture': JSON.stringify(lecture),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static async getLecture(id)
|
|
161
|
+
{
|
|
162
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_LECTURE, {
|
|
163
|
+
'id': id,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return data;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static async deleteLecture(id, toTrash = true)
|
|
170
|
+
{
|
|
171
|
+
await APIController.Post(this.#MODULE, this.#DELETE_LECTURE, {
|
|
172
|
+
'id': id,
|
|
173
|
+
'toTrash': toTrash,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static async setLectureAttendance(attendance)
|
|
178
|
+
{
|
|
179
|
+
await APIController.Post(this.#MODULE, this.#SET_LECTURE_ATTENDANCE, {
|
|
180
|
+
'attendance': JSON.stringify(attendance),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static async getLectureAttendance(id)
|
|
185
|
+
{
|
|
186
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_LECTURE_ATTENDANCE, {
|
|
187
|
+
'id': id,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
return data;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
static async deleteLectureAttendance(id, toTrash = true)
|
|
194
|
+
{
|
|
195
|
+
await APIController.Post(this.#MODULE, this.#DELETE_LECTURE_ATTENDANCE, {
|
|
196
|
+
'id': id,
|
|
197
|
+
'toTrash': toTrash,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
static async getOffersForInquiry(inquiryId)
|
|
202
|
+
{
|
|
203
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_OFFERS_FOR_INQUIRY, {
|
|
204
|
+
'inquiryId': inquiryId,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
return data;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static async getStudentsForCustomer(customerId)
|
|
211
|
+
{
|
|
212
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_STUDENTS_FOR_CUSTOMER, {
|
|
213
|
+
'customerId': customerId,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
return data;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
static async getLecturesForEvent(eventId)
|
|
220
|
+
{
|
|
221
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_LECTURES_FOR_EVENT, {
|
|
222
|
+
'eventId': eventId,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return data;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
static async getAttendanceForLecture(lectureId)
|
|
229
|
+
{
|
|
230
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_ATTENDANCE_FOR_LECTURE, {
|
|
231
|
+
'lectureId': lectureId,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
return data;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export default Models;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import APIController from "../apiController";
|
|
2
|
+
|
|
3
|
+
class TableExplorer
|
|
4
|
+
{
|
|
5
|
+
static #MODULE = "TableExplorer";
|
|
6
|
+
|
|
7
|
+
static #CREATE_INQUIRY_EXPLORER = "CreateInquiryExplorer";
|
|
8
|
+
static #CREATE_EVENT_EXPLORER = "CreateEventExplorer";
|
|
9
|
+
static #CREATE_OFFER_EXPLORER = "CreateOfferExplorer";
|
|
10
|
+
static #CREATE_CUSTUMER_EXPLORER = "CreateCustumerExplorer";
|
|
11
|
+
static #CREATE_LECTURE_EXPLORER = "CreateLectureExplorer";
|
|
12
|
+
static #CREATE_LECTURE_ATTENDANCE_EXPLORER = "CreateLectureAttendanceExplorer";
|
|
13
|
+
static #CREATE_STUDENT_EXPLORER = "CreateStudentExplorer";
|
|
14
|
+
|
|
15
|
+
static #CHECK_EXPLORER = "CheckExplorer";
|
|
16
|
+
static #GET_MAX_PAGES = "GetMaxPages";
|
|
17
|
+
static #SET_PAGE_SIZE = "SetPageSize";
|
|
18
|
+
static #GET_PAGE_SIZE = "GetPageSize";
|
|
19
|
+
static #GET_CURRENT_PAGE_INDEX = "GetCurrentPageIndex";
|
|
20
|
+
static #GET_CURRENT_PAGE = "GetCurrentPage";
|
|
21
|
+
static #GET_PAGE = "GetPage";
|
|
22
|
+
static #GET_NEXT_PAGE = "GetNextPage";
|
|
23
|
+
static #GET_PREVIOUS_PAGE = "GetPreviousPage";
|
|
24
|
+
static #GET_FILTERED_RESULTS = "GetFilteredResults";
|
|
25
|
+
static #SEARCH = "Search";
|
|
26
|
+
static #ADD_FILTER = "AddFilter";
|
|
27
|
+
static #RESET_FILTER = "ResetFilter";
|
|
28
|
+
|
|
29
|
+
static async createInquiryExplorer()
|
|
30
|
+
{
|
|
31
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_INQUIRY_EXPLORER);
|
|
32
|
+
|
|
33
|
+
return data['token'];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static async createEventExplorer()
|
|
37
|
+
{
|
|
38
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_EVENT_EXPLORER);
|
|
39
|
+
|
|
40
|
+
return data['token'];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static async createOfferExplorer()
|
|
44
|
+
{
|
|
45
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_OFFER_EXPLORER);
|
|
46
|
+
|
|
47
|
+
return data['token'];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static async createCustumerExplorer()
|
|
51
|
+
{
|
|
52
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_CUSTUMER_EXPLORER);
|
|
53
|
+
|
|
54
|
+
return data['token'];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static async createLectureExplorer()
|
|
58
|
+
{
|
|
59
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_LECTURE_EXPLORER);
|
|
60
|
+
|
|
61
|
+
return data['token'];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static async createLectureAttendanceExplorer()
|
|
65
|
+
{
|
|
66
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_LECTURE_ATTENDANCE_EXPLORER);
|
|
67
|
+
|
|
68
|
+
return data['token'];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static async createStudentExplorer()
|
|
72
|
+
{
|
|
73
|
+
var data = await APIController.Get(this.#MODULE, this.#CREATE_STUDENT_EXPLORER);
|
|
74
|
+
|
|
75
|
+
return data['token'];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static async checkExplorer(token)
|
|
79
|
+
{
|
|
80
|
+
var data = await APIController.Get(this.#MODULE, this.#CHECK_EXPLORER, {
|
|
81
|
+
'token': token,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return data;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static async getMaxPages(token)
|
|
88
|
+
{
|
|
89
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_MAX_PAGES, {
|
|
90
|
+
'token': token,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return data;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static async setPageSize(token, pageSize)
|
|
97
|
+
{
|
|
98
|
+
await APIController.Post(this.#MODULE, this.#SET_PAGE_SIZE, {
|
|
99
|
+
'token': token,
|
|
100
|
+
'pageSize': pageSize,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static async getPageSize(token)
|
|
105
|
+
{
|
|
106
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_PAGE_SIZE, {
|
|
107
|
+
'token': token,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return data;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static async getCurrentPageIndex(token)
|
|
114
|
+
{
|
|
115
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_CURRENT_PAGE_INDEX, {
|
|
116
|
+
'token': token,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return data;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static async getCurrentPage(token)
|
|
123
|
+
{
|
|
124
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_CURRENT_PAGE, {
|
|
125
|
+
'token': token,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static async getPage(token, pageIndex)
|
|
132
|
+
{
|
|
133
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_PAGE, {
|
|
134
|
+
'token': token,
|
|
135
|
+
'pageIndex': pageIndex,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return data;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static async getNextPage(token)
|
|
142
|
+
{
|
|
143
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_NEXT_PAGE, {
|
|
144
|
+
'token': token,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return data;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static async getPreviousPage(token)
|
|
151
|
+
{
|
|
152
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_PREVIOUS_PAGE, {
|
|
153
|
+
'token': token,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return data;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static async getFilteredResults(token, filters)
|
|
160
|
+
{
|
|
161
|
+
var data = await APIController.Get(this.#MODULE, this.#GET_FILTERED_RESULTS, {
|
|
162
|
+
'token': token,
|
|
163
|
+
'filters': JSON.stringify(filters),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return data;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static async search(token, searchPhrase, base64encoded = true)
|
|
170
|
+
{
|
|
171
|
+
var data = await APIController.Get(this.#MODULE, this.#SEARCH, {
|
|
172
|
+
'token': token,
|
|
173
|
+
'searchPhrase': searchPhrase,
|
|
174
|
+
'base64encoded': base64encoded,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return data;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
static async addFilter(token, filter, filterValue, filterOperation)
|
|
181
|
+
{
|
|
182
|
+
await APIController.Post(this.#MODULE, this.#ADD_FILTER, {
|
|
183
|
+
'token': token,
|
|
184
|
+
'filter': filter,
|
|
185
|
+
'filterValue': filterValue,
|
|
186
|
+
'filterOperation': filterOperation,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
static async resetFilter(token)
|
|
191
|
+
{
|
|
192
|
+
await APIController.Post(this.#MODULE, this.#RESET_FILTER, {
|
|
193
|
+
'token': token,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default TableExplorer;
|