nazar-salary 2.3.2 → 2.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 +52 -0
  2. package/index.js +34 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -602,6 +602,56 @@ declare module 'nazar-salary' {
602
602
  reassigned_at: number;
603
603
  }
604
604
 
605
+ export interface UpdateStudentProgressData {
606
+ new_completed_lessons: number;
607
+ comment?: string;
608
+ }
609
+
610
+ export interface UpdateStudentProgressResponse {
611
+ status: string;
612
+ student: {
613
+ id: number;
614
+ completed_lessons: number;
615
+ total_lessons: number;
616
+ progress_percent: number;
617
+ };
618
+ students_in_group?: Array<{
619
+ id: number;
620
+ name: string;
621
+ completed_lessons: number;
622
+ }>;
623
+ teacher_payment_created?: {
624
+ id: number;
625
+ month_number: number;
626
+ amount: number;
627
+ status: string;
628
+ };
629
+ }
630
+
631
+ export type StopReason = 'student_quit' | 'moved_away' | 'health_issues' | 'financial' | 'other';
632
+
633
+ export interface StopStudentData {
634
+ reason: StopReason;
635
+ comment?: string;
636
+ }
637
+
638
+ export interface StopStudentResponse {
639
+ status: string;
640
+ student: {
641
+ id: number;
642
+ is_active: boolean;
643
+ finished_at: string;
644
+ stop_reason: StopReason;
645
+ completed_lessons: number;
646
+ };
647
+ teacher_payment_created?: {
648
+ id: number;
649
+ lessons_count: number;
650
+ amount: number;
651
+ status: string;
652
+ };
653
+ }
654
+
605
655
  export interface StudentBasicInfo {
606
656
  id: number;
607
657
  first_name: string;
@@ -834,6 +884,8 @@ declare module 'nazar-salary' {
834
884
  updateStudent(studentId: number, data: UpdateStudentData): Promise<UpdateStudentResponse>;
835
885
  transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
836
886
  changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
887
+ updateStudentProgress(studentId: number, data: UpdateStudentProgressData): Promise<UpdateStudentProgressResponse>;
888
+ stopStudent(studentId: number, data: StopStudentData): Promise<StopStudentResponse>;
837
889
  getStudent(studentId: number): Promise<StudentDetail>;
838
890
  searchStudents(params: SearchStudentsParams): Promise<SearchStudentsResponse>;
839
891
  getStudentsList(params?: StudentsListParams): Promise<StudentsListResponse>;
package/index.js CHANGED
@@ -274,7 +274,10 @@ class SalaryAPI {
274
274
  * @returns {Promise<{manager: object, total_students: number, current_page: number, total_pages: number, students: array}>}
275
275
  */
276
276
  async getManagerStudentsAdmin(managerId, params = {}) {
277
- return await this.client.get(`/api/v1/admin/manager/${managerId}/students`, { params });
277
+ return await this.client.get(
278
+ `/api/v1/admin/manager/${managerId}/students`,
279
+ { params },
280
+ );
278
281
  }
279
282
 
280
283
  // ===== TEACHER ENDPOINTS =====
@@ -502,6 +505,36 @@ class SalaryAPI {
502
505
  );
503
506
  }
504
507
 
508
+ /**
509
+ * Update student progress (Admin only)
510
+ * @param {number} studentId - Student ID
511
+ * @param {object} data - Progress data
512
+ * @param {number} data.new_completed_lessons - New completed lessons count
513
+ * @param {string} [data.comment] - Optional comment for logging
514
+ * @returns {Promise<{status: string, student: object, students_in_group?: array, teacher_payment_created?: object}>}
515
+ */
516
+ async updateStudentProgress(studentId, data) {
517
+ return await this.client.put(
518
+ `/api/v1/admin/progress/${studentId}/progress`,
519
+ data,
520
+ );
521
+ }
522
+
523
+ /**
524
+ * Stop student enrollment (Admin only)
525
+ * @param {number} studentId - Student ID
526
+ * @param {object} data - Stop data
527
+ * @param {string} data.reason - Reason for stopping (student_quit, moved_away, health_issues, financial, other)
528
+ * @param {string} [data.comment] - Optional comment
529
+ * @returns {Promise<{status: string, student: object, teacher_payment_created?: object}>}
530
+ */
531
+ async stopStudent(studentId, data) {
532
+ return await this.client.post(
533
+ `/api/v1/admin/progress/${studentId}/stop`,
534
+ data,
535
+ );
536
+ }
537
+
505
538
  /**
506
539
  * Get student by ID (requireAuth)
507
540
  * @param {number} studentId - Student ID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",