nazar-salary 3.4.1 → 3.4.3

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.
Files changed (3) hide show
  1. package/index.d.ts +5 -0
  2. package/index.js +5 -3
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -708,6 +708,8 @@ declare module 'nazar-salary' {
708
708
  id: number;
709
709
  name: string;
710
710
  };
711
+ /** ID of the newly created student_history row (active course with the new teacher) */
712
+ new_history_id: number;
711
713
  lesson_group_id: number | null;
712
714
  changed_at: number;
713
715
  }
@@ -1125,6 +1127,7 @@ declare module 'nazar-salary' {
1125
1127
  teacher_name: string;
1126
1128
  enrollment_months: number;
1127
1129
  total_lessons: number;
1130
+ /** Lessons completed by THIS teacher in this segment (rows after a teacher change start from 0) */
1128
1131
  completed_lessons: number;
1129
1132
  main_course: string;
1130
1133
  group_name: string;
@@ -1133,6 +1136,8 @@ declare module 'nazar-salary' {
1133
1136
  rate_per_lesson: number;
1134
1137
  lesson_group_id: number | null;
1135
1138
  created_at: number;
1139
+ /** Why this course row was closed: 'teacher_change' marks a teacher handoff; null for the active row */
1140
+ stop_reason: string | null;
1136
1141
  }
1137
1142
 
1138
1143
  export interface PaymentInfo {
package/index.js CHANGED
@@ -604,13 +604,15 @@ class SalaryAPI {
604
604
  }
605
605
 
606
606
  /**
607
- * Change student's teacher only (requireAuth: admin or owner).
608
- * Keeps the current course as-is does NOT recalculate lessons or create a new course.
607
+ * Change student's teacher (requireAuth: admin or owner).
608
+ * Closes the current course row and opens a new active row with the same total_lessons
609
+ * and carried-over progress, but the new teacher — so the previous teacher stays visible
610
+ * in the course history. Does NOT recalculate lessons (unlike transfer).
609
611
  * For group lessons, changes the teacher for the whole group.
610
612
  * @param {number} studentId - Student ID
611
613
  * @param {object} data - Change teacher data
612
614
  * @param {number} data.new_teacher_id - New teacher ID
613
- * @returns {Promise<{student_id: number, old_teacher: {id: number|null, name: string|null}, new_teacher: {id: number, name: string}, lesson_group_id: number|null, changed_at: number}>}
615
+ * @returns {Promise<{student_id: number, old_teacher: {id: number|null, name: string|null}, new_teacher: {id: number, name: string}, new_history_id: number, lesson_group_id: number|null, changed_at: number}>}
614
616
  */
615
617
  async changeStudentTeacher(studentId, data) {
616
618
  return await this.client.patch(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",