nazar-salary 3.3.6 → 3.4.1
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 +57 -0
- package/index.js +35 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -694,7 +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
|
+
lesson_group_id: number | null;
|
|
712
|
+
changed_at: number;
|
|
713
|
+
}
|
|
714
|
+
|
|
697
715
|
export interface UpdateStudentProgressData {
|
|
716
|
+
/** Change in completed lessons (delta): positive to add, negative to correct */
|
|
698
717
|
new_completed_lessons: number;
|
|
699
718
|
comment?: string;
|
|
700
719
|
}
|
|
@@ -720,6 +739,38 @@ declare module 'nazar-salary' {
|
|
|
720
739
|
};
|
|
721
740
|
}
|
|
722
741
|
|
|
742
|
+
export interface ProgressHistoryParams {
|
|
743
|
+
limit?: number;
|
|
744
|
+
offset?: number;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
export interface ProgressHistoryEntry {
|
|
748
|
+
id: number;
|
|
749
|
+
student_history_id: number;
|
|
750
|
+
previous_completed: number;
|
|
751
|
+
new_completed: number;
|
|
752
|
+
delta: number;
|
|
753
|
+
update_source: 'manual' | 'stop' | 'resume' | string;
|
|
754
|
+
comment: string | null;
|
|
755
|
+
updated_at: number;
|
|
756
|
+
updated_by: number;
|
|
757
|
+
updated_by_name: string | null;
|
|
758
|
+
main_course: string;
|
|
759
|
+
total_lessons: number;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
export interface ProgressHistoryResponse {
|
|
763
|
+
status: string;
|
|
764
|
+
student: {
|
|
765
|
+
id: number;
|
|
766
|
+
name: string;
|
|
767
|
+
};
|
|
768
|
+
total: number;
|
|
769
|
+
limit: number;
|
|
770
|
+
offset: number;
|
|
771
|
+
history: ProgressHistoryEntry[];
|
|
772
|
+
}
|
|
773
|
+
|
|
723
774
|
export type StopReason = 'student_quit' | 'moved_away' | 'health_issues' | 'financial' | 'other' | 'refund';
|
|
724
775
|
|
|
725
776
|
export interface StopStudentData {
|
|
@@ -1630,7 +1681,9 @@ declare module 'nazar-salary' {
|
|
|
1630
1681
|
updateStudent(studentId: number, data: UpdateStudentData): Promise<UpdateStudentResponse>;
|
|
1631
1682
|
transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
|
|
1632
1683
|
changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
|
|
1684
|
+
changeStudentTeacher(studentId: number, data: ChangeStudentTeacherData): Promise<ChangeStudentTeacherResponse>;
|
|
1633
1685
|
updateStudentProgress(studentId: number, data: UpdateStudentProgressData): Promise<UpdateStudentProgressResponse>;
|
|
1686
|
+
getStudentProgressHistory(studentId: number, params?: ProgressHistoryParams): Promise<ProgressHistoryResponse>;
|
|
1634
1687
|
stopStudent(studentId: number, data: StopStudentData): Promise<StopStudentResponse>;
|
|
1635
1688
|
resumeStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
|
|
1636
1689
|
resumeMyStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
|
|
@@ -1704,6 +1757,8 @@ declare module 'nazar-salary' {
|
|
|
1704
1757
|
teacher_id: number;
|
|
1705
1758
|
purchase_amount: number;
|
|
1706
1759
|
operation_number: string;
|
|
1760
|
+
/** Unix timestamp (ms) — дата покупки; её месяц определяет месяц зарплаты менеджера */
|
|
1761
|
+
created_at: number;
|
|
1707
1762
|
}
|
|
1708
1763
|
|
|
1709
1764
|
export interface ExtendCourseResponse {
|
|
@@ -1733,6 +1788,8 @@ declare module 'nazar-salary' {
|
|
|
1733
1788
|
prepayment: boolean;
|
|
1734
1789
|
/** Admin only */
|
|
1735
1790
|
manager_id?: number;
|
|
1791
|
+
/** Unix timestamp (ms) — дата покупки; её месяц определяет месяц зарплаты менеджера */
|
|
1792
|
+
created_at: number;
|
|
1736
1793
|
}
|
|
1737
1794
|
|
|
1738
1795
|
export interface ResaleCourseResponse {
|
package/index.js
CHANGED
|
@@ -603,6 +603,22 @@ class SalaryAPI {
|
|
|
603
603
|
);
|
|
604
604
|
}
|
|
605
605
|
|
|
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.
|
|
609
|
+
* For group lessons, changes the teacher for the whole group.
|
|
610
|
+
* @param {number} studentId - Student ID
|
|
611
|
+
* @param {object} data - Change teacher data
|
|
612
|
+
* @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}>}
|
|
614
|
+
*/
|
|
615
|
+
async changeStudentTeacher(studentId, data) {
|
|
616
|
+
return await this.client.patch(
|
|
617
|
+
`/api/v1/student/${studentId}/teacher`,
|
|
618
|
+
data,
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
|
|
606
622
|
/**
|
|
607
623
|
* Change student manager (Admin only)
|
|
608
624
|
* @param {number} studentId - Student ID
|
|
@@ -621,7 +637,7 @@ class SalaryAPI {
|
|
|
621
637
|
* Update student progress (Admin only)
|
|
622
638
|
* @param {number} studentId - Student ID
|
|
623
639
|
* @param {object} data - Progress data
|
|
624
|
-
* @param {number} data.new_completed_lessons -
|
|
640
|
+
* @param {number} data.new_completed_lessons - Change in completed lessons (delta): positive to add, negative to correct
|
|
625
641
|
* @param {string} [data.comment] - Optional comment for logging
|
|
626
642
|
* @returns {Promise<{status: string, student: object, students_in_group?: array, teacher_payment_created?: object}>}
|
|
627
643
|
*/
|
|
@@ -632,6 +648,22 @@ class SalaryAPI {
|
|
|
632
648
|
);
|
|
633
649
|
}
|
|
634
650
|
|
|
651
|
+
/**
|
|
652
|
+
* Get student progress change history (Admin only)
|
|
653
|
+
* Append-only log of every completed-lessons change (add/correction/stop/resume).
|
|
654
|
+
* @param {number} studentId - Student ID
|
|
655
|
+
* @param {object} [params] - Pagination
|
|
656
|
+
* @param {number} [params.limit] - Max rows (default 100, max 500)
|
|
657
|
+
* @param {number} [params.offset] - Offset (default 0)
|
|
658
|
+
* @returns {Promise<{status: string, student: object, total: number, limit: number, offset: number, history: Array<object>}>}
|
|
659
|
+
*/
|
|
660
|
+
async getStudentProgressHistory(studentId, params = {}) {
|
|
661
|
+
return await this.client.get(
|
|
662
|
+
`/api/v1/admin/progress/${studentId}/history`,
|
|
663
|
+
{ params },
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
|
|
635
667
|
/**
|
|
636
668
|
* Get admin dashboard summary (Admin only)
|
|
637
669
|
* @param {string} [month] - Month in MM.YYYY format (e.g. "04.2026"). Defaults to current month.
|
|
@@ -1034,6 +1066,7 @@ class SalaryAPI {
|
|
|
1034
1066
|
* @param {number} data.teacher_id - Teacher ID
|
|
1035
1067
|
* @param {number} data.purchase_amount - Payment amount
|
|
1036
1068
|
* @param {string} data.operation_number - Unique operation number
|
|
1069
|
+
* @param {number} data.created_at - Unix timestamp (ms) — дата покупки; её месяц определяет, в какой месяц попадёт зарплата менеджера
|
|
1037
1070
|
* @returns {Promise<ExtendCourseResponse>}
|
|
1038
1071
|
*/
|
|
1039
1072
|
async extendStudentCourse(studentId, data) {
|
|
@@ -1055,6 +1088,7 @@ class SalaryAPI {
|
|
|
1055
1088
|
* @param {string} data.operation_number - Unique operation number
|
|
1056
1089
|
* @param {boolean} data.prepayment - Is prepayment
|
|
1057
1090
|
* @param {number} [data.manager_id] - Manager ID (Admin only)
|
|
1091
|
+
* @param {number} data.created_at - Unix timestamp (ms) — дата покупки; её месяц определяет, в какой месяц попадёт зарплата менеджера
|
|
1058
1092
|
* @returns {Promise<ResaleCourseResponse>}
|
|
1059
1093
|
*/
|
|
1060
1094
|
async resaleStudentCourse(studentId, data) {
|