nazar-salary 3.3.1 → 3.3.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 +104 -0
- package/index.js +53 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1242,6 +1242,8 @@ declare module 'nazar-salary' {
|
|
|
1242
1242
|
created_from?: string;
|
|
1243
1243
|
created_to?: string;
|
|
1244
1244
|
main_course?: string;
|
|
1245
|
+
/** If true, returns students who have finished the course (is_active=FALSE) */
|
|
1246
|
+
is_finished?: boolean;
|
|
1245
1247
|
page?: number;
|
|
1246
1248
|
limit?: number;
|
|
1247
1249
|
}
|
|
@@ -1633,10 +1635,112 @@ declare module 'nazar-salary' {
|
|
|
1633
1635
|
*/
|
|
1634
1636
|
exportStudentsByManager(managerId: number, month?: string): Promise<ArrayBuffer>;
|
|
1635
1637
|
|
|
1638
|
+
// ===== RESALE ENDPOINTS =====
|
|
1639
|
+
|
|
1640
|
+
/** Extend active student course. TASK-001-1 */
|
|
1641
|
+
extendStudentCourse(studentId: number, data: ExtendCourseData): Promise<ExtendCourseResponse>;
|
|
1642
|
+
|
|
1643
|
+
/** Resale course to a completed student. TASK-001-2 */
|
|
1644
|
+
resaleStudentCourse(studentId: number, data: ResaleCourseData): Promise<ResaleCourseResponse>;
|
|
1645
|
+
|
|
1646
|
+
/** Get list of students with resales (Admin only). TASK-001-3 */
|
|
1647
|
+
getResalesStudents(params?: ResalesStudentsParams): Promise<ResalesStudentsResponse>;
|
|
1648
|
+
|
|
1636
1649
|
// Custom request
|
|
1637
1650
|
request(method: string, path: string, data?: any): Promise<any>;
|
|
1638
1651
|
}
|
|
1639
1652
|
|
|
1653
|
+
// ===== RESALE TYPES =====
|
|
1654
|
+
|
|
1655
|
+
export interface ExtendCourseData {
|
|
1656
|
+
/** Months to add (1-12) */
|
|
1657
|
+
added_months: number;
|
|
1658
|
+
teacher_id: number;
|
|
1659
|
+
purchase_amount: number;
|
|
1660
|
+
operation_number: string;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
export interface ExtendCourseResponse {
|
|
1664
|
+
status: 'success';
|
|
1665
|
+
type: 'extension';
|
|
1666
|
+
student_id: number;
|
|
1667
|
+
previous_enrollment_months: number;
|
|
1668
|
+
new_enrollment_months: number;
|
|
1669
|
+
added_months: number;
|
|
1670
|
+
previous_total_lessons: number;
|
|
1671
|
+
new_total_lessons: number;
|
|
1672
|
+
purchase_id: number;
|
|
1673
|
+
resale_history_id: number;
|
|
1674
|
+
created_at: string;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
export interface ResaleCourseData {
|
|
1678
|
+
price_id: number;
|
|
1679
|
+
teacher_id: number;
|
|
1680
|
+
enrollment_months: number;
|
|
1681
|
+
/** Required for non-individual price formats */
|
|
1682
|
+
group_name?: string;
|
|
1683
|
+
main_course: string;
|
|
1684
|
+
bonus_languages?: string[];
|
|
1685
|
+
purchase_amount: number;
|
|
1686
|
+
operation_number: string;
|
|
1687
|
+
prepayment: boolean;
|
|
1688
|
+
/** Admin only */
|
|
1689
|
+
manager_id?: number;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
export interface ResaleCourseResponse {
|
|
1693
|
+
status: 'success';
|
|
1694
|
+
type: 'resale';
|
|
1695
|
+
student_id: number;
|
|
1696
|
+
new_student_history_id: number;
|
|
1697
|
+
enrollment_months: number;
|
|
1698
|
+
total_lessons: number;
|
|
1699
|
+
purchase_id: number;
|
|
1700
|
+
resale_history_id: number;
|
|
1701
|
+
created_at: string;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
export interface ResalesStudentsParams {
|
|
1705
|
+
type?: 'extension' | 'resale';
|
|
1706
|
+
/** Format: YYYY-MM */
|
|
1707
|
+
month?: string;
|
|
1708
|
+
page?: number;
|
|
1709
|
+
/** Max 30 */
|
|
1710
|
+
limit?: number;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
export interface ResaleStudentItem {
|
|
1714
|
+
resale_id: number;
|
|
1715
|
+
student_id: number;
|
|
1716
|
+
student_name: string;
|
|
1717
|
+
phone: string;
|
|
1718
|
+
type: 'extension' | 'resale';
|
|
1719
|
+
previous_enrollment_months: number | null;
|
|
1720
|
+
new_enrollment_months: number | null;
|
|
1721
|
+
added_months: number | null;
|
|
1722
|
+
purchase_amount: number;
|
|
1723
|
+
manager_id: number;
|
|
1724
|
+
manager_name: string;
|
|
1725
|
+
created_at: string;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
export interface ResalesStudentsResponse {
|
|
1729
|
+
status: 'success';
|
|
1730
|
+
summary: {
|
|
1731
|
+
total: number;
|
|
1732
|
+
extension_count: number;
|
|
1733
|
+
resale_count: number;
|
|
1734
|
+
};
|
|
1735
|
+
students: ResaleStudentItem[];
|
|
1736
|
+
pagination: {
|
|
1737
|
+
page: number;
|
|
1738
|
+
limit: number;
|
|
1739
|
+
total: number;
|
|
1740
|
+
total_pages: number;
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1640
1744
|
export interface TeacherExpensesForecastResponse {
|
|
1641
1745
|
status: string;
|
|
1642
1746
|
forecast_metadata: {
|
package/index.js
CHANGED
|
@@ -313,6 +313,7 @@ class SalaryAPI {
|
|
|
313
313
|
* @param {string} [params.created_from] - Filter by created date from (ISO 8601)
|
|
314
314
|
* @param {string} [params.created_to] - Filter by created date to (ISO 8601)
|
|
315
315
|
* @param {string} [params.main_course] - Filter by main course
|
|
316
|
+
* @param {boolean} [params.is_finished] - If true, returns students who have finished the course
|
|
316
317
|
* @param {number} [params.page=1] - Page number
|
|
317
318
|
* @param {number} [params.limit=30] - Items per page (max 30)
|
|
318
319
|
* @returns {Promise<{manager: object, total_students: number, current_page: number, total_pages: number, students: array}>}
|
|
@@ -1008,6 +1009,58 @@ class SalaryAPI {
|
|
|
1008
1009
|
});
|
|
1009
1010
|
}
|
|
1010
1011
|
|
|
1012
|
+
// ===== RESALE ENDPOINTS =====
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Extend active student course (Manager, Admin)
|
|
1016
|
+
* TASK-001-1: extension
|
|
1017
|
+
* @param {number} studentId - Student ID
|
|
1018
|
+
* @param {object} data - Extension data
|
|
1019
|
+
* @param {number} data.added_months - Months to add (1-12)
|
|
1020
|
+
* @param {number} data.teacher_id - Teacher ID
|
|
1021
|
+
* @param {number} data.purchase_amount - Payment amount
|
|
1022
|
+
* @param {string} data.operation_number - Unique operation number
|
|
1023
|
+
* @returns {Promise<ExtendCourseResponse>}
|
|
1024
|
+
*/
|
|
1025
|
+
async extendStudentCourse(studentId, data) {
|
|
1026
|
+
return await this.client.post(`/api/v1/students/${studentId}/extend`, data);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Resale course to a completed student (Manager, Admin)
|
|
1031
|
+
* TASK-001-2: resale
|
|
1032
|
+
* @param {number} studentId - Student ID
|
|
1033
|
+
* @param {object} data - Resale data
|
|
1034
|
+
* @param {number} data.price_id - Price plan ID
|
|
1035
|
+
* @param {number} data.teacher_id - Teacher ID
|
|
1036
|
+
* @param {number} data.enrollment_months - Enrollment months (1-12)
|
|
1037
|
+
* @param {string} [data.group_name] - Group name (required for non-individual formats)
|
|
1038
|
+
* @param {string} data.main_course - Main course name
|
|
1039
|
+
* @param {string[]} [data.bonus_languages] - Bonus languages
|
|
1040
|
+
* @param {number} data.purchase_amount - Payment amount
|
|
1041
|
+
* @param {string} data.operation_number - Unique operation number
|
|
1042
|
+
* @param {boolean} data.prepayment - Is prepayment
|
|
1043
|
+
* @param {number} [data.manager_id] - Manager ID (Admin only)
|
|
1044
|
+
* @returns {Promise<ResaleCourseResponse>}
|
|
1045
|
+
*/
|
|
1046
|
+
async resaleStudentCourse(studentId, data) {
|
|
1047
|
+
return await this.client.post(`/api/v1/students/${studentId}/resale`, data);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Get list of students with resales (Admin only)
|
|
1052
|
+
* TASK-001-3
|
|
1053
|
+
* @param {object} [params] - Query parameters
|
|
1054
|
+
* @param {'extension'|'resale'} [params.type] - Filter by resale type
|
|
1055
|
+
* @param {string} [params.month] - Filter by month (YYYY-MM)
|
|
1056
|
+
* @param {number} [params.page=1] - Page number
|
|
1057
|
+
* @param {number} [params.limit=30] - Items per page (max 30)
|
|
1058
|
+
* @returns {Promise<ResalesStudentsResponse>}
|
|
1059
|
+
*/
|
|
1060
|
+
async getResalesStudents(params = {}) {
|
|
1061
|
+
return await this.client.get('/api/v1/resales/students', { params });
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1011
1064
|
// ===== CUSTOM REQUEST =====
|
|
1012
1065
|
|
|
1013
1066
|
/**
|