nazar-salary 2.5.1 → 2.7.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.
- package/index.d.ts +35 -4
- package/index.js +20 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -472,15 +472,24 @@ declare module 'nazar-salary' {
|
|
|
472
472
|
transfer_date: number;
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
+
export interface LessonGroupStudent {
|
|
476
|
+
id: number;
|
|
477
|
+
name: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
475
480
|
export interface LessonGroup {
|
|
476
481
|
lesson_group_id: number;
|
|
477
482
|
lesson_group_name: string;
|
|
478
|
-
|
|
479
|
-
|
|
483
|
+
group_type: string;
|
|
484
|
+
teacher_name: string;
|
|
485
|
+
students: LessonGroupStudent[];
|
|
486
|
+
current_count: number;
|
|
487
|
+
max_count: number;
|
|
488
|
+
available: boolean;
|
|
480
489
|
}
|
|
481
490
|
|
|
482
491
|
export interface LessonGroupsResponse {
|
|
483
|
-
|
|
492
|
+
lesson_groups: LessonGroup[];
|
|
484
493
|
}
|
|
485
494
|
|
|
486
495
|
export interface StudentCourse {
|
|
@@ -948,6 +957,27 @@ declare module 'nazar-salary' {
|
|
|
948
957
|
students: StudentLiteItem[];
|
|
949
958
|
}
|
|
950
959
|
|
|
960
|
+
export interface DeletedPurchaseInfo {
|
|
961
|
+
id: number;
|
|
962
|
+
operation_number: string;
|
|
963
|
+
purchase_amount: number;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export interface RemainingPayment {
|
|
967
|
+
id: number;
|
|
968
|
+
operation_number: string;
|
|
969
|
+
purchase_amount: number;
|
|
970
|
+
prepayment: boolean;
|
|
971
|
+
is_verified: boolean;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
export interface DeleteStudentPurchaseResponse {
|
|
975
|
+
message: string;
|
|
976
|
+
deleted_purchase: DeletedPurchaseInfo;
|
|
977
|
+
remaining_payments: RemainingPayment[];
|
|
978
|
+
total_purchase_amount: number;
|
|
979
|
+
}
|
|
980
|
+
|
|
951
981
|
export default class SalaryAPI {
|
|
952
982
|
constructor(options?: SalaryAPIOptions);
|
|
953
983
|
|
|
@@ -1000,7 +1030,7 @@ declare module 'nazar-salary' {
|
|
|
1000
1030
|
|
|
1001
1031
|
// Student endpoints
|
|
1002
1032
|
createStudent(data: CreateStudentData): Promise<CreateStudentResponse>;
|
|
1003
|
-
getLessonGroups(): Promise<LessonGroupsResponse>;
|
|
1033
|
+
getLessonGroups(managerId?: number): Promise<LessonGroupsResponse>;
|
|
1004
1034
|
updateStudent(studentId: number, data: UpdateStudentData): Promise<UpdateStudentResponse>;
|
|
1005
1035
|
transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
|
|
1006
1036
|
changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
|
|
@@ -1012,6 +1042,7 @@ declare module 'nazar-salary' {
|
|
|
1012
1042
|
/** @deprecated Use getStudentsList instead */
|
|
1013
1043
|
getManagerStudents(managerId: number, params?: ManagerStudentsParams): Promise<ManagerStudentsResponse>;
|
|
1014
1044
|
getStudentsListLite(params?: StudentsListLiteParams): Promise<StudentsListLiteResponse>;
|
|
1045
|
+
deleteStudentPurchase(studentId: number, purchaseId: number): Promise<DeleteStudentPurchaseResponse>;
|
|
1015
1046
|
|
|
1016
1047
|
// Custom request
|
|
1017
1048
|
request(method: string, path: string, data?: any): Promise<any>;
|
package/index.js
CHANGED
|
@@ -495,10 +495,13 @@ class SalaryAPI {
|
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Get available lesson groups for duet/trio (requireAuth)
|
|
498
|
-
* @
|
|
498
|
+
* @param {number} [managerId] - Manager ID (required for admin users)
|
|
499
|
+
* @returns {Promise<{lesson_groups: Array<{lesson_group_id: number, lesson_group_name: string, group_type: string, teacher_name: string, students: Array, current_count: number, max_count: number, available: boolean}>}>}
|
|
499
500
|
*/
|
|
500
|
-
async getLessonGroups() {
|
|
501
|
-
|
|
501
|
+
async getLessonGroups(managerId) {
|
|
502
|
+
const params = {};
|
|
503
|
+
if (managerId !== undefined) params.manager_id = managerId;
|
|
504
|
+
return await this.client.get("/api/v1/student/lesson-groups", { params });
|
|
502
505
|
}
|
|
503
506
|
|
|
504
507
|
/**
|
|
@@ -652,6 +655,20 @@ class SalaryAPI {
|
|
|
652
655
|
return await this.client.get("/api/v1/student/list/lite", { params });
|
|
653
656
|
}
|
|
654
657
|
|
|
658
|
+
/**
|
|
659
|
+
* Delete student purchase/payment (requireAuth)
|
|
660
|
+
* Managers can only delete non-verified payments
|
|
661
|
+
* Admins can delete any payment
|
|
662
|
+
* @param {number} studentId - Student ID
|
|
663
|
+
* @param {number} purchaseId - Purchase ID to delete
|
|
664
|
+
* @returns {Promise<{message: string, deleted_purchase: object, remaining_payments: array, total_purchase_amount: number}>}
|
|
665
|
+
*/
|
|
666
|
+
async deleteStudentPurchase(studentId, purchaseId) {
|
|
667
|
+
return await this.client.delete(
|
|
668
|
+
`/api/v1/student/${studentId}/purchase/${purchaseId}`,
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
|
|
655
672
|
// ===== CUSTOM REQUEST =====
|
|
656
673
|
|
|
657
674
|
/**
|