nazar-salary 3.3.6 → 3.4.0

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 +38 -0
  2. package/index.js +19 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -695,6 +695,7 @@ declare module 'nazar-salary' {
695
695
  }
696
696
 
697
697
  export interface UpdateStudentProgressData {
698
+ /** Change in completed lessons (delta): positive to add, negative to correct */
698
699
  new_completed_lessons: number;
699
700
  comment?: string;
700
701
  }
@@ -720,6 +721,38 @@ declare module 'nazar-salary' {
720
721
  };
721
722
  }
722
723
 
724
+ export interface ProgressHistoryParams {
725
+ limit?: number;
726
+ offset?: number;
727
+ }
728
+
729
+ export interface ProgressHistoryEntry {
730
+ id: number;
731
+ student_history_id: number;
732
+ previous_completed: number;
733
+ new_completed: number;
734
+ delta: number;
735
+ update_source: 'manual' | 'stop' | 'resume' | string;
736
+ comment: string | null;
737
+ updated_at: number;
738
+ updated_by: number;
739
+ updated_by_name: string | null;
740
+ main_course: string;
741
+ total_lessons: number;
742
+ }
743
+
744
+ export interface ProgressHistoryResponse {
745
+ status: string;
746
+ student: {
747
+ id: number;
748
+ name: string;
749
+ };
750
+ total: number;
751
+ limit: number;
752
+ offset: number;
753
+ history: ProgressHistoryEntry[];
754
+ }
755
+
723
756
  export type StopReason = 'student_quit' | 'moved_away' | 'health_issues' | 'financial' | 'other' | 'refund';
724
757
 
725
758
  export interface StopStudentData {
@@ -1631,6 +1664,7 @@ declare module 'nazar-salary' {
1631
1664
  transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
1632
1665
  changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
1633
1666
  updateStudentProgress(studentId: number, data: UpdateStudentProgressData): Promise<UpdateStudentProgressResponse>;
1667
+ getStudentProgressHistory(studentId: number, params?: ProgressHistoryParams): Promise<ProgressHistoryResponse>;
1634
1668
  stopStudent(studentId: number, data: StopStudentData): Promise<StopStudentResponse>;
1635
1669
  resumeStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
1636
1670
  resumeMyStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
@@ -1704,6 +1738,8 @@ declare module 'nazar-salary' {
1704
1738
  teacher_id: number;
1705
1739
  purchase_amount: number;
1706
1740
  operation_number: string;
1741
+ /** Unix timestamp (ms) — дата покупки; её месяц определяет месяц зарплаты менеджера */
1742
+ created_at: number;
1707
1743
  }
1708
1744
 
1709
1745
  export interface ExtendCourseResponse {
@@ -1733,6 +1769,8 @@ declare module 'nazar-salary' {
1733
1769
  prepayment: boolean;
1734
1770
  /** Admin only */
1735
1771
  manager_id?: number;
1772
+ /** Unix timestamp (ms) — дата покупки; её месяц определяет месяц зарплаты менеджера */
1773
+ created_at: number;
1736
1774
  }
1737
1775
 
1738
1776
  export interface ResaleCourseResponse {
package/index.js CHANGED
@@ -621,7 +621,7 @@ class SalaryAPI {
621
621
  * Update student progress (Admin only)
622
622
  * @param {number} studentId - Student ID
623
623
  * @param {object} data - Progress data
624
- * @param {number} data.new_completed_lessons - New completed lessons count
624
+ * @param {number} data.new_completed_lessons - Change in completed lessons (delta): positive to add, negative to correct
625
625
  * @param {string} [data.comment] - Optional comment for logging
626
626
  * @returns {Promise<{status: string, student: object, students_in_group?: array, teacher_payment_created?: object}>}
627
627
  */
@@ -632,6 +632,22 @@ class SalaryAPI {
632
632
  );
633
633
  }
634
634
 
635
+ /**
636
+ * Get student progress change history (Admin only)
637
+ * Append-only log of every completed-lessons change (add/correction/stop/resume).
638
+ * @param {number} studentId - Student ID
639
+ * @param {object} [params] - Pagination
640
+ * @param {number} [params.limit] - Max rows (default 100, max 500)
641
+ * @param {number} [params.offset] - Offset (default 0)
642
+ * @returns {Promise<{status: string, student: object, total: number, limit: number, offset: number, history: Array<object>}>}
643
+ */
644
+ async getStudentProgressHistory(studentId, params = {}) {
645
+ return await this.client.get(
646
+ `/api/v1/admin/progress/${studentId}/history`,
647
+ { params },
648
+ );
649
+ }
650
+
635
651
  /**
636
652
  * Get admin dashboard summary (Admin only)
637
653
  * @param {string} [month] - Month in MM.YYYY format (e.g. "04.2026"). Defaults to current month.
@@ -1034,6 +1050,7 @@ class SalaryAPI {
1034
1050
  * @param {number} data.teacher_id - Teacher ID
1035
1051
  * @param {number} data.purchase_amount - Payment amount
1036
1052
  * @param {string} data.operation_number - Unique operation number
1053
+ * @param {number} data.created_at - Unix timestamp (ms) — дата покупки; её месяц определяет, в какой месяц попадёт зарплата менеджера
1037
1054
  * @returns {Promise<ExtendCourseResponse>}
1038
1055
  */
1039
1056
  async extendStudentCourse(studentId, data) {
@@ -1055,6 +1072,7 @@ class SalaryAPI {
1055
1072
  * @param {string} data.operation_number - Unique operation number
1056
1073
  * @param {boolean} data.prepayment - Is prepayment
1057
1074
  * @param {number} [data.manager_id] - Manager ID (Admin only)
1075
+ * @param {number} data.created_at - Unix timestamp (ms) — дата покупки; её месяц определяет, в какой месяц попадёт зарплата менеджера
1058
1076
  * @returns {Promise<ResaleCourseResponse>}
1059
1077
  */
1060
1078
  async resaleStudentCourse(studentId, data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "3.3.6",
3
+ "version": "3.4.0",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",