@insignia-education/api-sdk-js 0.25.13 → 0.25.15
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/package.json +1 -1
- package/src/api/v1/Courses.js +5 -0
- package/src/api/v1/Sales.js +18 -0
package/package.json
CHANGED
package/src/api/v1/Courses.js
CHANGED
|
@@ -53,9 +53,14 @@ export default class Courses {
|
|
|
53
53
|
get: (id = null) => id ? this.#client.get(`${base}/${id}`) : this.#client.get(base),
|
|
54
54
|
/** Public dates list with enrollment counts, for the public course page. */
|
|
55
55
|
getPublic: () => this.#client.get(`${base}/public`),
|
|
56
|
+
/** `data` may carry `children`: [{course_id, starts_at, ends_at}] — the reviewed follow-up dates (see childrenPreview()), created in the same call, linked to this date via parent_course_date_id, copying its teacher/config set/min+max students (no Telegram). */
|
|
56
57
|
create: (data) => this.#client.put(base, data),
|
|
57
58
|
edit: (id, data) => this.#client.patch(`${base}/${id}`, data),
|
|
58
59
|
delete: (id) => this.#client.del(`${base}/${id}`),
|
|
60
|
+
/** Read-only plan of the dates of every course that follows this one (courses.prerequisite chain): [{course_id, course_title, previous_course_id, starts_at, ends_at, existing_child_id}]. Each course lasts as long as the first date and starts the Monday after a week off. Nothing is saved. `parentId` marks courses that already have a child under that date. */
|
|
61
|
+
childrenPreview: ({ starts_at, ends_at, parent_id = null }) => this.#client.post(`${base}/children-preview`, { starts_at, ends_at, parent_id }),
|
|
62
|
+
/** Creates the reviewed follow-up dates ([{course_id, starts_at, ends_at}]) under an already-saved date; courses that already have a child of it are skipped. */
|
|
63
|
+
createChildren: (id, children) => this.#client.post(`${base}/${id}/children`, { children }),
|
|
59
64
|
/** Soft-deleted dates for this course, most recently deleted first — the "Deleted" tab, for undoing a mistaken delete(). */
|
|
60
65
|
trashed: () => this.#client.get(`${base}/trashed`),
|
|
61
66
|
/** Undoes delete() — brings a soft-deleted date back into the normal list. */
|
package/src/api/v1/Sales.js
CHANGED
|
@@ -26,4 +26,22 @@ export default class Sales {
|
|
|
26
26
|
|
|
27
27
|
/** Course dates starting within the current calendar week (Mon–Sun). */
|
|
28
28
|
coursesStartingThisWeek() { return this.#client.get('/sales/courses/starting-this-week'); }
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Read-only course-date views for the Sales "Course dates" tab — same payloads as the matching
|
|
32
|
+
* Employee.dashboard() methods, minus every write action (ranking, attendance, grading, teacher changes).
|
|
33
|
+
*/
|
|
34
|
+
courseDates() {
|
|
35
|
+
const base = '/sales/course-dates';
|
|
36
|
+
return {
|
|
37
|
+
/** All sessions of a course date, each with its student roster ({id, name, email, username, present}). */
|
|
38
|
+
sessions: (courseDateId) => this.#client.get(`${base}/${courseDateId}/sessions`),
|
|
39
|
+
/** Ranked roster ({id, name, email, username, rank}). */
|
|
40
|
+
students: (courseDateId) => this.#client.get(`${base}/${courseDateId}/students`),
|
|
41
|
+
/** Per-student progress keyed by student id (quiz_progress, level_exams, next_course). */
|
|
42
|
+
studentOverviews: (courseDateId) => this.#client.get(`${base}/${courseDateId}/students/overview`),
|
|
43
|
+
/** One enrolled student's quiz attempts in the course date's course. */
|
|
44
|
+
studentQuizzes: (courseDateId, studentId) => this.#client.get(`${base}/${courseDateId}/students/${studentId}/quizzes`),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
29
47
|
}
|