nazar-salary 3.4.0 → 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.
- package/index.d.ts +24 -0
- package/index.js +18 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -694,6 +694,26 @@ declare module 'nazar-salary' {
|
|
|
694
694
|
reassigned_at: number;
|
|
695
695
|
}
|
|
696
696
|
|
|
697
|
+
export interface ChangeStudentTeacherData {
|
|
698
|
+
new_teacher_id: number;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export interface ChangeStudentTeacherResponse {
|
|
702
|
+
student_id: number;
|
|
703
|
+
old_teacher: {
|
|
704
|
+
id: number | null;
|
|
705
|
+
name: string | null;
|
|
706
|
+
};
|
|
707
|
+
new_teacher: {
|
|
708
|
+
id: number;
|
|
709
|
+
name: string;
|
|
710
|
+
};
|
|
711
|
+
/** ID of the newly created student_history row (active course with the new teacher) */
|
|
712
|
+
new_history_id: number;
|
|
713
|
+
lesson_group_id: number | null;
|
|
714
|
+
changed_at: number;
|
|
715
|
+
}
|
|
716
|
+
|
|
697
717
|
export interface UpdateStudentProgressData {
|
|
698
718
|
/** Change in completed lessons (delta): positive to add, negative to correct */
|
|
699
719
|
new_completed_lessons: number;
|
|
@@ -1107,6 +1127,7 @@ declare module 'nazar-salary' {
|
|
|
1107
1127
|
teacher_name: string;
|
|
1108
1128
|
enrollment_months: number;
|
|
1109
1129
|
total_lessons: number;
|
|
1130
|
+
/** Lessons completed by THIS teacher in this segment (rows after a teacher change start from 0) */
|
|
1110
1131
|
completed_lessons: number;
|
|
1111
1132
|
main_course: string;
|
|
1112
1133
|
group_name: string;
|
|
@@ -1115,6 +1136,8 @@ declare module 'nazar-salary' {
|
|
|
1115
1136
|
rate_per_lesson: number;
|
|
1116
1137
|
lesson_group_id: number | null;
|
|
1117
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;
|
|
1118
1141
|
}
|
|
1119
1142
|
|
|
1120
1143
|
export interface PaymentInfo {
|
|
@@ -1663,6 +1686,7 @@ declare module 'nazar-salary' {
|
|
|
1663
1686
|
updateStudent(studentId: number, data: UpdateStudentData): Promise<UpdateStudentResponse>;
|
|
1664
1687
|
transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
|
|
1665
1688
|
changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
|
|
1689
|
+
changeStudentTeacher(studentId: number, data: ChangeStudentTeacherData): Promise<ChangeStudentTeacherResponse>;
|
|
1666
1690
|
updateStudentProgress(studentId: number, data: UpdateStudentProgressData): Promise<UpdateStudentProgressResponse>;
|
|
1667
1691
|
getStudentProgressHistory(studentId: number, params?: ProgressHistoryParams): Promise<ProgressHistoryResponse>;
|
|
1668
1692
|
stopStudent(studentId: number, data: StopStudentData): Promise<StopStudentResponse>;
|
package/index.js
CHANGED
|
@@ -603,6 +603,24 @@ class SalaryAPI {
|
|
|
603
603
|
);
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
+
/**
|
|
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).
|
|
611
|
+
* For group lessons, changes the teacher for the whole group.
|
|
612
|
+
* @param {number} studentId - Student ID
|
|
613
|
+
* @param {object} data - Change teacher data
|
|
614
|
+
* @param {number} data.new_teacher_id - New teacher ID
|
|
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}>}
|
|
616
|
+
*/
|
|
617
|
+
async changeStudentTeacher(studentId, data) {
|
|
618
|
+
return await this.client.patch(
|
|
619
|
+
`/api/v1/student/${studentId}/teacher`,
|
|
620
|
+
data,
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
|
|
606
624
|
/**
|
|
607
625
|
* Change student manager (Admin only)
|
|
608
626
|
* @param {number} studentId - Student ID
|