nazar-salary 3.3.0 → 3.3.2
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 +110 -0
- package/index.js +67 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1625,10 +1625,120 @@ declare module 'nazar-salary' {
|
|
|
1625
1625
|
*/
|
|
1626
1626
|
getTeacherExpensesForecast(monthsAhead?: number): Promise<TeacherExpensesForecastResponse>;
|
|
1627
1627
|
|
|
1628
|
+
// Export endpoints
|
|
1629
|
+
/**
|
|
1630
|
+
* Export students by manager as Excel file (Admin only)
|
|
1631
|
+
* @param managerId Manager (МЗК) ID (required)
|
|
1632
|
+
* @param month Period filter in YYYY-MM format (optional). If omitted, all students are exported.
|
|
1633
|
+
*/
|
|
1634
|
+
exportStudentsByManager(managerId: number, month?: string): Promise<ArrayBuffer>;
|
|
1635
|
+
|
|
1636
|
+
// ===== RESALE ENDPOINTS =====
|
|
1637
|
+
|
|
1638
|
+
/** Extend active student course. TASK-001-1 */
|
|
1639
|
+
extendStudentCourse(studentId: number, data: ExtendCourseData): Promise<ExtendCourseResponse>;
|
|
1640
|
+
|
|
1641
|
+
/** Resale course to a completed student. TASK-001-2 */
|
|
1642
|
+
resaleStudentCourse(studentId: number, data: ResaleCourseData): Promise<ResaleCourseResponse>;
|
|
1643
|
+
|
|
1644
|
+
/** Get list of students with resales (Admin only). TASK-001-3 */
|
|
1645
|
+
getResalesStudents(params?: ResalesStudentsParams): Promise<ResalesStudentsResponse>;
|
|
1646
|
+
|
|
1628
1647
|
// Custom request
|
|
1629
1648
|
request(method: string, path: string, data?: any): Promise<any>;
|
|
1630
1649
|
}
|
|
1631
1650
|
|
|
1651
|
+
// ===== RESALE TYPES =====
|
|
1652
|
+
|
|
1653
|
+
export interface ExtendCourseData {
|
|
1654
|
+
/** Months to add (1-12) */
|
|
1655
|
+
added_months: number;
|
|
1656
|
+
teacher_id: number;
|
|
1657
|
+
purchase_amount: number;
|
|
1658
|
+
operation_number: string;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
export interface ExtendCourseResponse {
|
|
1662
|
+
status: 'success';
|
|
1663
|
+
type: 'extension';
|
|
1664
|
+
student_id: number;
|
|
1665
|
+
previous_enrollment_months: number;
|
|
1666
|
+
new_enrollment_months: number;
|
|
1667
|
+
added_months: number;
|
|
1668
|
+
previous_total_lessons: number;
|
|
1669
|
+
new_total_lessons: number;
|
|
1670
|
+
purchase_id: number;
|
|
1671
|
+
resale_history_id: number;
|
|
1672
|
+
created_at: string;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
export interface ResaleCourseData {
|
|
1676
|
+
price_id: number;
|
|
1677
|
+
teacher_id: number;
|
|
1678
|
+
enrollment_months: number;
|
|
1679
|
+
/** Required for non-individual price formats */
|
|
1680
|
+
group_name?: string;
|
|
1681
|
+
main_course: string;
|
|
1682
|
+
bonus_languages?: string[];
|
|
1683
|
+
purchase_amount: number;
|
|
1684
|
+
operation_number: string;
|
|
1685
|
+
prepayment: boolean;
|
|
1686
|
+
/** Admin only */
|
|
1687
|
+
manager_id?: number;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
export interface ResaleCourseResponse {
|
|
1691
|
+
status: 'success';
|
|
1692
|
+
type: 'resale';
|
|
1693
|
+
student_id: number;
|
|
1694
|
+
new_student_history_id: number;
|
|
1695
|
+
enrollment_months: number;
|
|
1696
|
+
total_lessons: number;
|
|
1697
|
+
purchase_id: number;
|
|
1698
|
+
resale_history_id: number;
|
|
1699
|
+
created_at: string;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
export interface ResalesStudentsParams {
|
|
1703
|
+
type?: 'extension' | 'resale';
|
|
1704
|
+
/** Format: YYYY-MM */
|
|
1705
|
+
month?: string;
|
|
1706
|
+
page?: number;
|
|
1707
|
+
/** Max 30 */
|
|
1708
|
+
limit?: number;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
export interface ResaleStudentItem {
|
|
1712
|
+
resale_id: number;
|
|
1713
|
+
student_id: number;
|
|
1714
|
+
student_name: string;
|
|
1715
|
+
phone: string;
|
|
1716
|
+
type: 'extension' | 'resale';
|
|
1717
|
+
previous_enrollment_months: number | null;
|
|
1718
|
+
new_enrollment_months: number | null;
|
|
1719
|
+
added_months: number | null;
|
|
1720
|
+
purchase_amount: number;
|
|
1721
|
+
manager_id: number;
|
|
1722
|
+
manager_name: string;
|
|
1723
|
+
created_at: string;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
export interface ResalesStudentsResponse {
|
|
1727
|
+
status: 'success';
|
|
1728
|
+
summary: {
|
|
1729
|
+
total: number;
|
|
1730
|
+
extension_count: number;
|
|
1731
|
+
resale_count: number;
|
|
1732
|
+
};
|
|
1733
|
+
students: ResaleStudentItem[];
|
|
1734
|
+
pagination: {
|
|
1735
|
+
page: number;
|
|
1736
|
+
limit: number;
|
|
1737
|
+
total: number;
|
|
1738
|
+
total_pages: number;
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1632
1742
|
export interface TeacherExpensesForecastResponse {
|
|
1633
1743
|
status: string;
|
|
1634
1744
|
forecast_metadata: {
|
package/index.js
CHANGED
|
@@ -993,6 +993,73 @@ class SalaryAPI {
|
|
|
993
993
|
});
|
|
994
994
|
}
|
|
995
995
|
|
|
996
|
+
/**
|
|
997
|
+
* Export students by manager as Excel file (Admin only)
|
|
998
|
+
* @param {number} managerId - Manager (МЗК) ID (required)
|
|
999
|
+
* @param {string} [month] - Period filter in YYYY-MM format (optional)
|
|
1000
|
+
* @returns {Promise<Buffer>} Excel file buffer
|
|
1001
|
+
*/
|
|
1002
|
+
async exportStudentsByManager(managerId, month) {
|
|
1003
|
+
const params = { manager_id: managerId };
|
|
1004
|
+
if (month !== undefined) params.month = month;
|
|
1005
|
+
return await this.client.get("/api/v1/students/export", {
|
|
1006
|
+
params,
|
|
1007
|
+
responseType: "arraybuffer",
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// ===== RESALE ENDPOINTS =====
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Extend active student course (Manager, Admin)
|
|
1015
|
+
* TASK-001-1: extension
|
|
1016
|
+
* @param {number} studentId - Student ID
|
|
1017
|
+
* @param {object} data - Extension data
|
|
1018
|
+
* @param {number} data.added_months - Months to add (1-12)
|
|
1019
|
+
* @param {number} data.teacher_id - Teacher ID
|
|
1020
|
+
* @param {number} data.purchase_amount - Payment amount
|
|
1021
|
+
* @param {string} data.operation_number - Unique operation number
|
|
1022
|
+
* @returns {Promise<ExtendCourseResponse>}
|
|
1023
|
+
*/
|
|
1024
|
+
async extendStudentCourse(studentId, data) {
|
|
1025
|
+
return await this.client.post(`/api/v1/students/${studentId}/extend`, data);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Resale course to a completed student (Manager, Admin)
|
|
1030
|
+
* TASK-001-2: resale
|
|
1031
|
+
* @param {number} studentId - Student ID
|
|
1032
|
+
* @param {object} data - Resale data
|
|
1033
|
+
* @param {number} data.price_id - Price plan ID
|
|
1034
|
+
* @param {number} data.teacher_id - Teacher ID
|
|
1035
|
+
* @param {number} data.enrollment_months - Enrollment months (1-12)
|
|
1036
|
+
* @param {string} [data.group_name] - Group name (required for non-individual formats)
|
|
1037
|
+
* @param {string} data.main_course - Main course name
|
|
1038
|
+
* @param {string[]} [data.bonus_languages] - Bonus languages
|
|
1039
|
+
* @param {number} data.purchase_amount - Payment amount
|
|
1040
|
+
* @param {string} data.operation_number - Unique operation number
|
|
1041
|
+
* @param {boolean} data.prepayment - Is prepayment
|
|
1042
|
+
* @param {number} [data.manager_id] - Manager ID (Admin only)
|
|
1043
|
+
* @returns {Promise<ResaleCourseResponse>}
|
|
1044
|
+
*/
|
|
1045
|
+
async resaleStudentCourse(studentId, data) {
|
|
1046
|
+
return await this.client.post(`/api/v1/students/${studentId}/resale`, data);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Get list of students with resales (Admin only)
|
|
1051
|
+
* TASK-001-3
|
|
1052
|
+
* @param {object} [params] - Query parameters
|
|
1053
|
+
* @param {'extension'|'resale'} [params.type] - Filter by resale type
|
|
1054
|
+
* @param {string} [params.month] - Filter by month (YYYY-MM)
|
|
1055
|
+
* @param {number} [params.page=1] - Page number
|
|
1056
|
+
* @param {number} [params.limit=30] - Items per page (max 30)
|
|
1057
|
+
* @returns {Promise<ResalesStudentsResponse>}
|
|
1058
|
+
*/
|
|
1059
|
+
async getResalesStudents(params = {}) {
|
|
1060
|
+
return await this.client.get('/api/v1/resales/students', { params });
|
|
1061
|
+
}
|
|
1062
|
+
|
|
996
1063
|
// ===== CUSTOM REQUEST =====
|
|
997
1064
|
|
|
998
1065
|
/**
|