webuntis-client 1.0.3 → 1.0.5
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/README.md +18 -0
- package/dist/WebUntis.d.ts +34 -5
- package/dist/WebUntis.d.ts.map +1 -1
- package/dist/WebUntis.js +57 -11
- package/dist/clients/Api.d.ts +11 -2
- package/dist/clients/Api.d.ts.map +1 -1
- package/dist/clients/Api.js +17 -3
- package/dist/services/Absences.d.ts +19 -0
- package/dist/services/Absences.d.ts.map +1 -0
- package/dist/services/Absences.js +35 -0
- package/dist/services/AppData.d.ts +5 -1
- package/dist/services/AppData.d.ts.map +1 -1
- package/dist/services/AppData.js +8 -1
- package/dist/services/Homeworks.d.ts +18 -0
- package/dist/services/Homeworks.d.ts.map +1 -0
- package/dist/services/Homeworks.js +29 -0
- package/dist/services/Timetable.d.ts +10 -10
- package/dist/services/Timetable.d.ts.map +1 -1
- package/dist/services/Timetable.js +27 -20
- package/dist/types/absences.d.ts +40 -0
- package/dist/types/absences.d.ts.map +1 -0
- package/dist/types/absences.js +1 -0
- package/dist/types/homework.d.ts +34 -0
- package/dist/types/homework.d.ts.map +1 -0
- package/dist/types/homework.js +1 -0
- package/dist/types/timetable.d.ts +96 -33
- package/dist/types/timetable.d.ts.map +1 -1
- package/dist/utils/date.d.ts +8 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,24 @@ const end = new Date("2027");
|
|
|
42
42
|
await client.getOwnTimetable(start, end);
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### Homeworks and Lessons
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const start = new Date("2026");
|
|
49
|
+
const end = new Date("2027");
|
|
50
|
+
|
|
51
|
+
await client.getHomeworksLessons(start, end);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Absences
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
const start = new Date("2026");
|
|
58
|
+
const end = new Date("2027");
|
|
59
|
+
|
|
60
|
+
await client.getAbsences(start, end);
|
|
61
|
+
```
|
|
62
|
+
|
|
45
63
|
### App data
|
|
46
64
|
|
|
47
65
|
```typescript
|
package/dist/WebUntis.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Credentials } from
|
|
1
|
+
import { Credentials } from './Credentials';
|
|
2
|
+
import { AbsencesStudentsData } from './types/absences';
|
|
2
3
|
import { AppData, CurrentSchoolYear, Holiday, OneDriveData, Tenant, User } from './types/app-data';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { HomeworksLessonsData } from './types/homework';
|
|
5
|
+
import { Profile } from './types/profile';
|
|
6
|
+
import { SessionInfo } from './types/session';
|
|
7
|
+
import { ClassTimetableResponse, OwnTimetableResponse } from './types/timetable';
|
|
6
8
|
export declare class WebUntisClient {
|
|
7
9
|
private readonly _httpClient;
|
|
8
10
|
private readonly _apiClient;
|
|
@@ -11,7 +13,9 @@ export declare class WebUntisClient {
|
|
|
11
13
|
private readonly _tokenManager;
|
|
12
14
|
private readonly _appDataService;
|
|
13
15
|
private readonly _profileService;
|
|
16
|
+
private readonly _homeworksService;
|
|
14
17
|
private readonly _timetableService;
|
|
18
|
+
private readonly _absencesService;
|
|
15
19
|
constructor(credentials: Credentials);
|
|
16
20
|
/**
|
|
17
21
|
* Login to WebUntis
|
|
@@ -65,6 +69,10 @@ export declare class WebUntisClient {
|
|
|
65
69
|
* Get user information from cache
|
|
66
70
|
*/
|
|
67
71
|
getUser(): User;
|
|
72
|
+
/**
|
|
73
|
+
* Get student id from cache
|
|
74
|
+
*/
|
|
75
|
+
getStudentId(): string;
|
|
68
76
|
/**
|
|
69
77
|
* Get user permissions from cache
|
|
70
78
|
*/
|
|
@@ -99,7 +107,28 @@ export declare class WebUntisClient {
|
|
|
99
107
|
* @param start - Start date
|
|
100
108
|
* @param end - End date
|
|
101
109
|
*/
|
|
102
|
-
getOwnTimetable(start: Date, end: Date): Promise<
|
|
110
|
+
getOwnTimetable(start: Date, end: Date): Promise<OwnTimetableResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* Get class timetable for date range
|
|
113
|
+
*
|
|
114
|
+
* @param start - Start date
|
|
115
|
+
* @param end - End date
|
|
116
|
+
*/
|
|
117
|
+
getClassTimetable(start: Date, end: Date): Promise<ClassTimetableResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Get homeworks and lessons for date range
|
|
120
|
+
*
|
|
121
|
+
* @param start - Start date
|
|
122
|
+
* @param end - End date
|
|
123
|
+
*/
|
|
124
|
+
getHomeworksLessons(start: Date, end: Date): Promise<HomeworksLessonsData>;
|
|
125
|
+
/**
|
|
126
|
+
* Get absences for date range
|
|
127
|
+
*
|
|
128
|
+
* @param start - Start date
|
|
129
|
+
* @param end - End date
|
|
130
|
+
*/
|
|
131
|
+
getAbsences(start: Date, end: Date): Promise<AbsencesStudentsData>;
|
|
103
132
|
/**
|
|
104
133
|
* Ensure user is authenticated
|
|
105
134
|
*/
|
package/dist/WebUntis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebUntis.d.ts","sourceRoot":"","sources":["../src/WebUntis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"WebUntis.d.ts","sourceRoot":"","sources":["../src/WebUntis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,E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;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE;IAIvB;;OAEG;IACH,cAAc,IAAI,OAAO,EAAE;IAI3B;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACH,WAAW,IAAI,OAAO,EAAE;IAQxB;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IASpC;;;;;OAKG;IACG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAK5E;;;;;OAKG;IACG,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAShF;;;;;OAKG;IACG,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAShF;;;;;OAKG;IACG,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IASxE;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAS/B"}
|
package/dist/WebUntis.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ApiClient } from
|
|
2
|
-
import { HttpClient } from
|
|
3
|
-
import { JsonRpcClient } from
|
|
4
|
-
import { ValidationError } from
|
|
5
|
-
import { AuthenticationManager } from
|
|
6
|
-
import { TokenManager } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { ApiClient } from './clients/Api';
|
|
2
|
+
import { HttpClient } from './clients/Http';
|
|
3
|
+
import { JsonRpcClient } from './clients/JsonRpc';
|
|
4
|
+
import { ValidationError } from './errors/Validation';
|
|
5
|
+
import { AuthenticationManager } from './managers/Authentication';
|
|
6
|
+
import { TokenManager } from './managers/Token';
|
|
7
|
+
import { AbsencesService } from './services/Absences';
|
|
8
|
+
import { AppDataService } from './services/AppData';
|
|
9
|
+
import { HomeworksService } from './services/Homeworks';
|
|
10
|
+
import { ProfileService } from './services/Profile';
|
|
11
|
+
import { TimetableService } from './services/Timetable';
|
|
10
12
|
export class WebUntisClient {
|
|
11
13
|
// Clients
|
|
12
14
|
_httpClient;
|
|
@@ -18,7 +20,9 @@ export class WebUntisClient {
|
|
|
18
20
|
// Services
|
|
19
21
|
_appDataService;
|
|
20
22
|
_profileService;
|
|
23
|
+
_homeworksService;
|
|
21
24
|
_timetableService;
|
|
25
|
+
_absencesService;
|
|
22
26
|
constructor(credentials) {
|
|
23
27
|
const { identity, url } = credentials;
|
|
24
28
|
// Clients
|
|
@@ -32,7 +36,9 @@ export class WebUntisClient {
|
|
|
32
36
|
// Services
|
|
33
37
|
this._appDataService = new AppDataService(this._apiClient);
|
|
34
38
|
this._profileService = new ProfileService(this._apiClient);
|
|
35
|
-
this.
|
|
39
|
+
this._homeworksService = new HomeworksService(this._apiClient);
|
|
40
|
+
this._timetableService = new TimetableService(this._apiClient, () => this._authManager.getSession());
|
|
41
|
+
this._absencesService = new AbsencesService(this._apiClient, () => this.getStudentId());
|
|
36
42
|
}
|
|
37
43
|
//#region Authentication
|
|
38
44
|
/**
|
|
@@ -121,6 +127,12 @@ export class WebUntisClient {
|
|
|
121
127
|
getUser() {
|
|
122
128
|
return this._appDataService.getUser();
|
|
123
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Get student id from cache
|
|
132
|
+
*/
|
|
133
|
+
getStudentId() {
|
|
134
|
+
return this._appDataService.getStudentId();
|
|
135
|
+
}
|
|
124
136
|
/**
|
|
125
137
|
* Get user permissions from cache
|
|
126
138
|
*/
|
|
@@ -167,7 +179,7 @@ export class WebUntisClient {
|
|
|
167
179
|
return await this._profileService.getProfile();
|
|
168
180
|
}
|
|
169
181
|
//#endregion
|
|
170
|
-
//#region
|
|
182
|
+
//#region Timetable
|
|
171
183
|
/**
|
|
172
184
|
* Get own timetable for date range
|
|
173
185
|
*
|
|
@@ -178,6 +190,40 @@ export class WebUntisClient {
|
|
|
178
190
|
this._ensureAuthenticated();
|
|
179
191
|
return await this._timetableService.getOwnTimetable(start, end);
|
|
180
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Get class timetable for date range
|
|
195
|
+
*
|
|
196
|
+
* @param start - Start date
|
|
197
|
+
* @param end - End date
|
|
198
|
+
*/
|
|
199
|
+
async getClassTimetable(start, end) {
|
|
200
|
+
this._ensureAuthenticated();
|
|
201
|
+
return await this._timetableService.getClassTimetable(start, end);
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region Homeworks and Lessons
|
|
205
|
+
/**
|
|
206
|
+
* Get homeworks and lessons for date range
|
|
207
|
+
*
|
|
208
|
+
* @param start - Start date
|
|
209
|
+
* @param end - End date
|
|
210
|
+
*/
|
|
211
|
+
async getHomeworksLessons(start, end) {
|
|
212
|
+
this._ensureAuthenticated();
|
|
213
|
+
return await this._homeworksService.getHomeworksLessons(start, end);
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region Absences
|
|
217
|
+
/**
|
|
218
|
+
* Get absences for date range
|
|
219
|
+
*
|
|
220
|
+
* @param start - Start date
|
|
221
|
+
* @param end - End date
|
|
222
|
+
*/
|
|
223
|
+
async getAbsences(start, end) {
|
|
224
|
+
this._ensureAuthenticated();
|
|
225
|
+
return await this._absencesService.getAbsences(start, end);
|
|
226
|
+
}
|
|
181
227
|
//#endregion
|
|
182
228
|
//#region Helpers
|
|
183
229
|
/**
|
package/dist/clients/Api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AbsencesStudentsResponse } from '../types/absences';
|
|
1
2
|
import { AppData } from '../types/app-data';
|
|
3
|
+
import { HomeworksLessonsResponse } from '../types/homework';
|
|
2
4
|
import { ProfileResponse } from '../types/profile';
|
|
3
|
-
import { TimetableResponse } from '../types/timetable';
|
|
4
5
|
import { HttpClient } from './Http';
|
|
5
6
|
/**
|
|
6
7
|
* Client for WebUntis REST API endpoints
|
|
@@ -23,6 +24,14 @@ export declare class ApiClient {
|
|
|
23
24
|
/**
|
|
24
25
|
* Fetch timetable entries
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
fetchTimetable<T>(params: URLSearchParams): Promise<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetch homeworks and lessons
|
|
30
|
+
*/
|
|
31
|
+
fetchHomeworksLessons(params: URLSearchParams): Promise<HomeworksLessonsResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch absences
|
|
34
|
+
*/
|
|
35
|
+
fetchAbsences(params: URLSearchParams): Promise<AbsencesStudentsResponse>;
|
|
27
36
|
}
|
|
28
37
|
//# sourceMappingURL=Api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../src/clients/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../src/clients/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;GAEG;AACH,qBAAa,SAAS;IAEd,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAJhB,WAAW,EAAE,UAAU,EACvB,WAAW,EAAE,MAAM,MAAM,EACzB,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAChC,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,EACjC,gBAAgB,EAAE,MAAM,MAAM;IAInD;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAmBtC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,eAAe,CAAC;IAS9C;;OAEG;IACG,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IAqB5D;;OAEG;IACG,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;IASvF;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAQlF"}
|
package/dist/clients/Api.js
CHANGED
|
@@ -27,7 +27,7 @@ export class ApiClient {
|
|
|
27
27
|
return this._httpClient.get('/WebUntis/api/rest/view/v1/app/data', {
|
|
28
28
|
Authorization: `Bearer ${token}`,
|
|
29
29
|
'tenant-id': tenantId,
|
|
30
|
-
Cookie: cookies
|
|
30
|
+
Cookie: cookies
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -40,7 +40,7 @@ export class ApiClient {
|
|
|
40
40
|
/**
|
|
41
41
|
* Fetch timetable entries
|
|
42
42
|
*/
|
|
43
|
-
async
|
|
43
|
+
async fetchTimetable(params) {
|
|
44
44
|
const token = await this._getToken();
|
|
45
45
|
const tenantId = this._getTenantId();
|
|
46
46
|
const cookies = this._getCookies();
|
|
@@ -52,7 +52,21 @@ export class ApiClient {
|
|
|
52
52
|
Authorization: `Bearer ${token}`,
|
|
53
53
|
'tenant-id': tenantId,
|
|
54
54
|
'x-webuntis-api-school-year-id': schoolYearId,
|
|
55
|
-
Cookie: cookies
|
|
55
|
+
Cookie: cookies
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Fetch homeworks and lessons
|
|
60
|
+
*/
|
|
61
|
+
async fetchHomeworksLessons(params) {
|
|
62
|
+
const cookies = this._getCookies();
|
|
63
|
+
return await this._httpClient.get(`/WebUntis/api/homeworks/lessons?${params}`, { Cookie: cookies });
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Fetch absences
|
|
67
|
+
*/
|
|
68
|
+
async fetchAbsences(params) {
|
|
69
|
+
const cookies = this._getCookies();
|
|
70
|
+
return await this._httpClient.get(`/WebUntis/api/classreg/absences/students?${params}`, { Cookie: cookies });
|
|
71
|
+
}
|
|
58
72
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApiClient } from '../clients/Api';
|
|
2
|
+
import { AbsencesStudentsData } from '../types/absences';
|
|
3
|
+
/**
|
|
4
|
+
* Service for managing absences
|
|
5
|
+
*/
|
|
6
|
+
export declare class AbsencesService {
|
|
7
|
+
private readonly _apiClient;
|
|
8
|
+
private readonly _getStudentId;
|
|
9
|
+
constructor(_apiClient: ApiClient, _getStudentId: () => string);
|
|
10
|
+
/**
|
|
11
|
+
* Get absences
|
|
12
|
+
*/
|
|
13
|
+
getAbsences(start: Date, end: Date): Promise<AbsencesStudentsData>;
|
|
14
|
+
/**
|
|
15
|
+
* Build query parameters for absences request
|
|
16
|
+
*/
|
|
17
|
+
private _buildAbsencesParams;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Absences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Absences.d.ts","sourceRoot":"","sources":["../../src/services/Absences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,qBAAa,eAAe;IAEpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;gBADb,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,MAAM,MAAM;IAIhD;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAMxE;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAgB/B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UtilsDate } from '../utils/date';
|
|
2
|
+
/**
|
|
3
|
+
* Service for managing absences
|
|
4
|
+
*/
|
|
5
|
+
export class AbsencesService {
|
|
6
|
+
_apiClient;
|
|
7
|
+
_getStudentId;
|
|
8
|
+
constructor(_apiClient, _getStudentId) {
|
|
9
|
+
this._apiClient = _apiClient;
|
|
10
|
+
this._getStudentId = _getStudentId;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get absences
|
|
14
|
+
*/
|
|
15
|
+
async getAbsences(start, end) {
|
|
16
|
+
const params = this._buildAbsencesParams(start, end);
|
|
17
|
+
const response = await this._apiClient.fetchAbsences(params);
|
|
18
|
+
return response.data;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build query parameters for absences request
|
|
22
|
+
*/
|
|
23
|
+
_buildAbsencesParams(start, end) {
|
|
24
|
+
const startDate = UtilsDate.formatDate(start, 'YYYYMMDD');
|
|
25
|
+
const endDate = UtilsDate.formatDate(end, 'YYYYMMDD');
|
|
26
|
+
const studentId = this._getStudentId();
|
|
27
|
+
const excuseStatusId = '-1';
|
|
28
|
+
return new URLSearchParams({
|
|
29
|
+
startDate: startDate,
|
|
30
|
+
endDate: endDate,
|
|
31
|
+
studentId: studentId,
|
|
32
|
+
excuseStatusId: excuseStatusId
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiClient } from
|
|
1
|
+
import { ApiClient } from '../clients/Api';
|
|
2
2
|
import { AppData, CurrentSchoolYear, Holiday, OneDriveData, Tenant, User } from '../types/app-data';
|
|
3
3
|
/**
|
|
4
4
|
* Service for fetching app data
|
|
@@ -47,6 +47,10 @@ export declare class AppDataService {
|
|
|
47
47
|
* Get user information from cache
|
|
48
48
|
*/
|
|
49
49
|
getUser(): User;
|
|
50
|
+
/**
|
|
51
|
+
* Get student id from cache
|
|
52
|
+
*/
|
|
53
|
+
getStudentId(): string;
|
|
50
54
|
/**
|
|
51
55
|
* Get user permissions from cache
|
|
52
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppData.d.ts","sourceRoot":"","sources":["../../src/services/AppData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpG;;GAEG;AACH,qBAAa,cAAc;IAInB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH/B,OAAO,CAAC,KAAK,CAAwB;gBAGhB,UAAU,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"AppData.d.ts","sourceRoot":"","sources":["../../src/services/AppData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpG;;GAEG;AACH,qBAAa,cAAc;IAInB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH/B,OAAO,CAAC,KAAK,CAAwB;gBAGhB,UAAU,EAAE,SAAS;IAI1C;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC;;OAEG;IACH,UAAU,IAAI,IAAI;IAMlB;;OAEG;IACH,oBAAoB,IAAI,iBAAiB;IAKzC;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAKhC;;OAEG;IACH,cAAc,IAAI,OAAO,EAAE;IAK3B;;OAEG;IACH,YAAY,IAAI,OAAO;IAKvB;;OAEG;IACH,eAAe,IAAI,YAAY;IAK/B;;OAEG;IACH,SAAS,IAAI,MAAM;IAKnB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAKnB;;OAEG;IACH,OAAO,IAAI,IAAI;IAKf;;OAEG;IACH,YAAY,IAAI,MAAM;IAKtB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAK1B;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE;IAKvB;;OAEG;IACH,cAAc,IAAI,OAAO,EAAE;IAK3B;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAK9B;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAK7B;;OAEG;IACH,WAAW,IAAI,OAAO,EAAE;IASxB,OAAO,CAAC,cAAc;CAOzB"}
|
package/dist/services/AppData.js
CHANGED
|
@@ -78,6 +78,13 @@ export class AppDataService {
|
|
|
78
78
|
this._ensureHasData();
|
|
79
79
|
return this._data.user;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Get student id from cache
|
|
83
|
+
*/
|
|
84
|
+
getStudentId() {
|
|
85
|
+
this._ensureHasData();
|
|
86
|
+
return this._data.user.person.id.toString();
|
|
87
|
+
}
|
|
81
88
|
/**
|
|
82
89
|
* Get user permissions from cache
|
|
83
90
|
*/
|
|
@@ -124,7 +131,7 @@ export class AppDataService {
|
|
|
124
131
|
//#region Helpers
|
|
125
132
|
_ensureHasData() {
|
|
126
133
|
if (this._data === null) {
|
|
127
|
-
throw new ValidationError(
|
|
134
|
+
throw new ValidationError('Data was not found. Please call getAppData() first.');
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
137
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiClient } from '../clients/Api';
|
|
2
|
+
import { HomeworksLessonsData } from '../types/homework';
|
|
3
|
+
/**
|
|
4
|
+
* Service for managing homeworks
|
|
5
|
+
*/
|
|
6
|
+
export declare class HomeworksService {
|
|
7
|
+
private readonly _apiClient;
|
|
8
|
+
constructor(_apiClient: ApiClient);
|
|
9
|
+
/**
|
|
10
|
+
* Get homeworks and lessons
|
|
11
|
+
*/
|
|
12
|
+
getHomeworksLessons(start: Date, end: Date): Promise<HomeworksLessonsData>;
|
|
13
|
+
/**
|
|
14
|
+
* Build query parameters for homeworks and lessons request
|
|
15
|
+
*/
|
|
16
|
+
private _buildHomeworksLessonsParams;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=Homeworks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Homeworks.d.ts","sourceRoot":"","sources":["../../src/services/Homeworks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,SAAS;IAElD;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAMhF;;OAEG;IACH,OAAO,CAAC,4BAA4B;CAYvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UtilsDate } from '../utils/date';
|
|
2
|
+
/**
|
|
3
|
+
* Service for managing homeworks
|
|
4
|
+
*/
|
|
5
|
+
export class HomeworksService {
|
|
6
|
+
_apiClient;
|
|
7
|
+
constructor(_apiClient) {
|
|
8
|
+
this._apiClient = _apiClient;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get homeworks and lessons
|
|
12
|
+
*/
|
|
13
|
+
async getHomeworksLessons(start, end) {
|
|
14
|
+
const params = this._buildHomeworksLessonsParams(start, end);
|
|
15
|
+
const response = await this._apiClient.fetchHomeworksLessons(params);
|
|
16
|
+
return response.data;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build query parameters for homeworks and lessons request
|
|
20
|
+
*/
|
|
21
|
+
_buildHomeworksLessonsParams(start, end) {
|
|
22
|
+
const startDate = UtilsDate.formatDate(start, "YYYYMMDD");
|
|
23
|
+
const endDate = UtilsDate.formatDate(end, "YYYYMMDD");
|
|
24
|
+
return new URLSearchParams({
|
|
25
|
+
startDate: startDate,
|
|
26
|
+
endDate: endDate,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { ApiClient } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ApiClient } from '../clients/Api';
|
|
2
|
+
import { SessionInfo } from '../types/session';
|
|
3
|
+
import { ClassTimetableResponse, OwnTimetableResponse } from '../types/timetable';
|
|
4
4
|
/**
|
|
5
5
|
* Service for fetching timetable data
|
|
6
6
|
*/
|
|
7
7
|
export declare class TimetableService {
|
|
8
8
|
private readonly _apiClient;
|
|
9
|
-
private readonly
|
|
10
|
-
constructor(_apiClient: ApiClient,
|
|
9
|
+
private readonly _getSession;
|
|
10
|
+
constructor(_apiClient: ApiClient, _getSession: () => SessionInfo | null);
|
|
11
|
+
/**
|
|
12
|
+
* Get own timetable for date range
|
|
13
|
+
*/
|
|
14
|
+
getOwnTimetable(start: Date, end: Date): Promise<OwnTimetableResponse>;
|
|
11
15
|
/**
|
|
12
16
|
* Get timetable for date range
|
|
13
17
|
*/
|
|
14
|
-
|
|
18
|
+
getClassTimetable(start: Date, end: Date): Promise<ClassTimetableResponse>;
|
|
15
19
|
/**
|
|
16
20
|
* Build query parameters for timetable request
|
|
17
21
|
*/
|
|
18
22
|
private _buildTimetableParams;
|
|
19
|
-
/**
|
|
20
|
-
* Format date to YYYY-MM-DD
|
|
21
|
-
*/
|
|
22
|
-
private _formatDate;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=Timetable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timetable.d.ts","sourceRoot":"","sources":["../../src/services/Timetable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Timetable.d.ts","sourceRoot":"","sources":["../../src/services/Timetable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGlF;;GAEG;AACH,qBAAa,gBAAgB;IAErB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,UAAU,EAAE,SAAS,EACrB,WAAW,EAAE,MAAM,WAAW,GAAG,IAAI;IAI1D;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAY5E;;OAEG;IACG,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAYhF;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAqBhC"}
|
|
@@ -1,46 +1,53 @@
|
|
|
1
|
-
import { AuthenticationError } from
|
|
1
|
+
import { AuthenticationError } from '../errors/Authentication';
|
|
2
|
+
import { UtilsDate } from '../utils/date';
|
|
2
3
|
/**
|
|
3
4
|
* Service for fetching timetable data
|
|
4
5
|
*/
|
|
5
6
|
export class TimetableService {
|
|
6
7
|
_apiClient;
|
|
7
|
-
|
|
8
|
-
constructor(_apiClient,
|
|
8
|
+
_getSession;
|
|
9
|
+
constructor(_apiClient, _getSession) {
|
|
9
10
|
this._apiClient = _apiClient;
|
|
10
|
-
this.
|
|
11
|
+
this._getSession = _getSession;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
* Get timetable for date range
|
|
14
|
+
* Get own timetable for date range
|
|
14
15
|
*/
|
|
15
16
|
async getOwnTimetable(start, end) {
|
|
16
|
-
const session = this.
|
|
17
|
+
const session = this._getSession();
|
|
17
18
|
if (!session?.personId) {
|
|
18
19
|
throw new AuthenticationError('No active session or person ID');
|
|
19
20
|
}
|
|
20
|
-
const params = this._buildTimetableParams(start, end, session.personId);
|
|
21
|
-
return await this._apiClient.
|
|
21
|
+
const params = this._buildTimetableParams(start, end, 'STUDENT', session.personId);
|
|
22
|
+
return await this._apiClient.fetchTimetable(params);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get timetable for date range
|
|
26
|
+
*/
|
|
27
|
+
async getClassTimetable(start, end) {
|
|
28
|
+
const session = this._getSession();
|
|
29
|
+
if (!session?.klasseId) {
|
|
30
|
+
throw new AuthenticationError('No active session or person ID');
|
|
31
|
+
}
|
|
32
|
+
const params = this._buildTimetableParams(start, end, 'CLASS', session.klasseId);
|
|
33
|
+
return await this._apiClient.fetchTimetable(params);
|
|
22
34
|
}
|
|
23
35
|
/**
|
|
24
36
|
* Build query parameters for timetable request
|
|
25
37
|
*/
|
|
26
|
-
_buildTimetableParams(start, end, personId) {
|
|
27
|
-
const startDate =
|
|
28
|
-
const endDate =
|
|
38
|
+
_buildTimetableParams(start, end, resourceType, personId) {
|
|
39
|
+
const startDate = UtilsDate.formatDate(start);
|
|
40
|
+
const endDate = UtilsDate.formatDate(end);
|
|
41
|
+
const timetableType = resourceType === 'STUDENT' ? 'MY_TIMETABLE' : 'STANDARD';
|
|
29
42
|
return new URLSearchParams({
|
|
30
43
|
start: startDate,
|
|
31
44
|
end: endDate,
|
|
32
45
|
format: '4',
|
|
33
|
-
resourceType:
|
|
46
|
+
resourceType: resourceType,
|
|
34
47
|
resources: personId.toString(),
|
|
35
48
|
periodTypes: '',
|
|
36
|
-
timetableType:
|
|
37
|
-
layout: 'START_TIME'
|
|
49
|
+
timetableType: timetableType,
|
|
50
|
+
layout: 'START_TIME'
|
|
38
51
|
});
|
|
39
52
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Format date to YYYY-MM-DD
|
|
42
|
-
*/
|
|
43
|
-
_formatDate(date) {
|
|
44
|
-
return date.toISOString().split('T')[0];
|
|
45
|
-
}
|
|
46
53
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface Excuse {
|
|
2
|
+
id: number;
|
|
3
|
+
text: string;
|
|
4
|
+
excuseDate: number;
|
|
5
|
+
excuseStatus: string;
|
|
6
|
+
isExcused: boolean;
|
|
7
|
+
userId: number;
|
|
8
|
+
username: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Absence {
|
|
11
|
+
id: number;
|
|
12
|
+
startDate: number;
|
|
13
|
+
endDate: number;
|
|
14
|
+
startTime: number;
|
|
15
|
+
endTime: number;
|
|
16
|
+
createDate: number;
|
|
17
|
+
lastUpdate: number;
|
|
18
|
+
createdUser: string;
|
|
19
|
+
updatedUser: string;
|
|
20
|
+
reasonId: number;
|
|
21
|
+
reason: string;
|
|
22
|
+
text: string;
|
|
23
|
+
interruptions: unknown[];
|
|
24
|
+
canEdit: boolean;
|
|
25
|
+
studentName: string;
|
|
26
|
+
excuseStatus: string | null;
|
|
27
|
+
isExcused: boolean;
|
|
28
|
+
excuse: Excuse;
|
|
29
|
+
}
|
|
30
|
+
export interface AbsencesStudentsData {
|
|
31
|
+
absences: Absence[];
|
|
32
|
+
absenceReasons: unknown[];
|
|
33
|
+
excuseStatuses: unknown | null;
|
|
34
|
+
showAbsenceReasonChange: boolean;
|
|
35
|
+
showCreateAbsence: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface AbsencesStudentsResponse {
|
|
38
|
+
data: AbsencesStudentsData;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=absences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absences.d.ts","sourceRoot":"","sources":["../../src/types/absences.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,uBAAuB,EAAE,OAAO,CAAC;IACjC,iBAAiB,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,oBAAoB,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface HomeworkRecord {
|
|
2
|
+
homeworkId: number;
|
|
3
|
+
teacherId: number;
|
|
4
|
+
elementIds: number[];
|
|
5
|
+
}
|
|
6
|
+
export interface Homework {
|
|
7
|
+
id: number;
|
|
8
|
+
lessonId: number;
|
|
9
|
+
date: number;
|
|
10
|
+
dueDate: number;
|
|
11
|
+
text: string;
|
|
12
|
+
remark: string;
|
|
13
|
+
completed: boolean;
|
|
14
|
+
attachments: unknown[];
|
|
15
|
+
}
|
|
16
|
+
export interface Teacher {
|
|
17
|
+
id: number;
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Lesson {
|
|
21
|
+
id: number;
|
|
22
|
+
subject: string;
|
|
23
|
+
lessonType: string;
|
|
24
|
+
}
|
|
25
|
+
export interface HomeworksLessonsData {
|
|
26
|
+
records: HomeworkRecord[];
|
|
27
|
+
homeworks: Homework[];
|
|
28
|
+
teachers: Teacher[];
|
|
29
|
+
lessons: Lesson[];
|
|
30
|
+
}
|
|
31
|
+
export interface HomeworksLessonsResponse {
|
|
32
|
+
data: HomeworksLessonsData;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=homework.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homework.d.ts","sourceRoot":"","sources":["../../src/types/homework.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,oBAAoB,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
errors: unknown[];
|
|
5
|
-
}
|
|
6
|
-
export interface Day {
|
|
7
|
-
date: string;
|
|
8
|
-
resourceType: string;
|
|
9
|
-
resource: Resource;
|
|
10
|
-
status: string;
|
|
11
|
-
dayEntries: unknown[];
|
|
12
|
-
gridEntries: GridEntry[];
|
|
13
|
-
backEntries: BackEntry[];
|
|
1
|
+
export interface Duration {
|
|
2
|
+
start: string;
|
|
3
|
+
end: string;
|
|
14
4
|
}
|
|
15
5
|
export interface Resource {
|
|
16
6
|
id: number;
|
|
@@ -18,7 +8,23 @@ export interface Resource {
|
|
|
18
8
|
longName: string;
|
|
19
9
|
displayName: string;
|
|
20
10
|
}
|
|
21
|
-
export interface
|
|
11
|
+
export interface PositionData {
|
|
12
|
+
type: string;
|
|
13
|
+
status: string;
|
|
14
|
+
shortName: string;
|
|
15
|
+
longName: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
displayNameLabel: string;
|
|
18
|
+
}
|
|
19
|
+
export interface Text {
|
|
20
|
+
type: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}
|
|
23
|
+
export interface OwnPosition {
|
|
24
|
+
current: PositionData;
|
|
25
|
+
removed: unknown | null;
|
|
26
|
+
}
|
|
27
|
+
export interface OwnGridEntry {
|
|
22
28
|
ids: number[];
|
|
23
29
|
duration: Duration;
|
|
24
30
|
type: string;
|
|
@@ -31,13 +37,13 @@ export interface GridEntry {
|
|
|
31
37
|
color: string;
|
|
32
38
|
notesAll: string;
|
|
33
39
|
icons: string[];
|
|
34
|
-
position1:
|
|
35
|
-
position2:
|
|
36
|
-
position3:
|
|
37
|
-
position4:
|
|
38
|
-
position5:
|
|
39
|
-
position6:
|
|
40
|
-
position7:
|
|
40
|
+
position1: OwnPosition[];
|
|
41
|
+
position2: OwnPosition[];
|
|
42
|
+
position3: OwnPosition[];
|
|
43
|
+
position4: OwnPosition[] | null;
|
|
44
|
+
position5: OwnPosition[] | null;
|
|
45
|
+
position6: OwnPosition[];
|
|
46
|
+
position7: OwnPosition[];
|
|
41
47
|
texts: Text[];
|
|
42
48
|
lessonText: string;
|
|
43
49
|
lessonInfo: string | null;
|
|
@@ -47,7 +53,7 @@ export interface GridEntry {
|
|
|
47
53
|
durationTotal: unknown | null;
|
|
48
54
|
link: unknown | null;
|
|
49
55
|
}
|
|
50
|
-
export interface
|
|
56
|
+
export interface OwnBackEntry {
|
|
51
57
|
id: number;
|
|
52
58
|
type: string;
|
|
53
59
|
status: string;
|
|
@@ -63,24 +69,81 @@ export interface BackEntry {
|
|
|
63
69
|
longName: string;
|
|
64
70
|
notesAll: unknown | null;
|
|
65
71
|
}
|
|
66
|
-
export interface
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
export interface OwnDay {
|
|
73
|
+
date: string;
|
|
74
|
+
resourceType: string;
|
|
75
|
+
resource: Resource;
|
|
76
|
+
status: string;
|
|
77
|
+
dayEntries: unknown[];
|
|
78
|
+
gridEntries: OwnGridEntry[];
|
|
79
|
+
backEntries: OwnBackEntry[];
|
|
69
80
|
}
|
|
70
|
-
export interface
|
|
81
|
+
export interface OwnTimetableResponse {
|
|
82
|
+
format: number;
|
|
83
|
+
days: OwnDay[];
|
|
84
|
+
errors: unknown[];
|
|
85
|
+
}
|
|
86
|
+
export interface ClassPosition {
|
|
71
87
|
current: PositionData;
|
|
72
|
-
removed:
|
|
88
|
+
removed: null;
|
|
73
89
|
}
|
|
74
|
-
export interface
|
|
90
|
+
export interface ClassGridEntry {
|
|
91
|
+
ids: number[];
|
|
92
|
+
duration: Duration;
|
|
93
|
+
type: string;
|
|
94
|
+
status: string;
|
|
95
|
+
statusDetail: string | null;
|
|
96
|
+
name: string | null;
|
|
97
|
+
layoutStartPosition: number;
|
|
98
|
+
layoutWidth: number;
|
|
99
|
+
layoutGroup: number;
|
|
100
|
+
color: string;
|
|
101
|
+
notesAll: string;
|
|
102
|
+
icons: string[];
|
|
103
|
+
position1: ClassPosition[];
|
|
104
|
+
position2: ClassPosition[];
|
|
105
|
+
position3: ClassPosition[];
|
|
106
|
+
position4: ClassPosition[] | null;
|
|
107
|
+
position5: ClassPosition[] | null;
|
|
108
|
+
position6: ClassPosition[];
|
|
109
|
+
position7: ClassPosition[];
|
|
110
|
+
texts: Text[];
|
|
111
|
+
lessonText: string;
|
|
112
|
+
lessonInfo: string | null;
|
|
113
|
+
substitutionText: string;
|
|
114
|
+
userName: string | null;
|
|
115
|
+
moved: null;
|
|
116
|
+
durationTotal: null;
|
|
117
|
+
link: null;
|
|
118
|
+
}
|
|
119
|
+
export interface ClassBackEntry {
|
|
120
|
+
id: number;
|
|
75
121
|
type: string;
|
|
76
122
|
status: string;
|
|
123
|
+
statusDetail: string;
|
|
124
|
+
duration: Duration;
|
|
125
|
+
isFullDay: boolean;
|
|
126
|
+
durationTotal: Duration;
|
|
127
|
+
layoutStartPosition: number;
|
|
128
|
+
layoutWidth: number;
|
|
129
|
+
color: string;
|
|
130
|
+
resource: null;
|
|
77
131
|
shortName: string;
|
|
78
132
|
longName: string;
|
|
79
|
-
|
|
80
|
-
displayNameLabel: string;
|
|
133
|
+
notesAll: null;
|
|
81
134
|
}
|
|
82
|
-
export interface
|
|
83
|
-
|
|
84
|
-
|
|
135
|
+
export interface ClassDay {
|
|
136
|
+
date: string;
|
|
137
|
+
resourceType: string;
|
|
138
|
+
resource: Resource;
|
|
139
|
+
status: string;
|
|
140
|
+
dayEntries: unknown[];
|
|
141
|
+
gridEntries: ClassGridEntry[];
|
|
142
|
+
backEntries: ClassBackEntry[];
|
|
143
|
+
}
|
|
144
|
+
export interface ClassTimetableResponse {
|
|
145
|
+
format: number;
|
|
146
|
+
days: ClassDay[];
|
|
147
|
+
errors: unknown[];
|
|
85
148
|
}
|
|
86
149
|
//# sourceMappingURL=timetable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/types/timetable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/types/timetable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,IAAI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AQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,MAAM,EAAE,OAAO,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,UAAU,CAAC;AAE/C,qBAAa,SAAS;IAClB;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,MAAqB,GAAG,MAAM;CASvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class UtilsDate {
|
|
2
|
+
/**
|
|
3
|
+
* Format date to YYYY-MM-DD or YYYYMMDD
|
|
4
|
+
*/
|
|
5
|
+
static formatDate(date, format = "YYYY-MM-DD") {
|
|
6
|
+
const isoDate = date.toISOString().split('T')[0];
|
|
7
|
+
if (format === "YYYYMMDD") {
|
|
8
|
+
return isoDate.replace(/-/g, '');
|
|
9
|
+
}
|
|
10
|
+
return isoDate;
|
|
11
|
+
}
|
|
12
|
+
}
|