nazar-salary 3.4.1 → 3.4.4
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 +16 -2
- package/index.js +9 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -708,6 +708,8 @@ declare module 'nazar-salary' {
|
|
|
708
708
|
id: number;
|
|
709
709
|
name: string;
|
|
710
710
|
};
|
|
711
|
+
/** ID of the newly created student_history row (active course with the new teacher) */
|
|
712
|
+
new_history_id: number;
|
|
711
713
|
lesson_group_id: number | null;
|
|
712
714
|
changed_at: number;
|
|
713
715
|
}
|
|
@@ -816,7 +818,10 @@ declare module 'nazar-salary' {
|
|
|
816
818
|
|
|
817
819
|
export interface DashboardKpi {
|
|
818
820
|
students: {
|
|
821
|
+
/** Students whose latest course record is active (excludes deleted students) */
|
|
819
822
|
active: number;
|
|
823
|
+
/** Students whose latest course record is closed — finished, stopped or refunded (excludes deleted students) */
|
|
824
|
+
inactive: number;
|
|
820
825
|
new_this_month: number;
|
|
821
826
|
finished_this_month: number;
|
|
822
827
|
};
|
|
@@ -1125,6 +1130,7 @@ declare module 'nazar-salary' {
|
|
|
1125
1130
|
teacher_name: string;
|
|
1126
1131
|
enrollment_months: number;
|
|
1127
1132
|
total_lessons: number;
|
|
1133
|
+
/** Lessons completed by THIS teacher in this segment (rows after a teacher change start from 0) */
|
|
1128
1134
|
completed_lessons: number;
|
|
1129
1135
|
main_course: string;
|
|
1130
1136
|
group_name: string;
|
|
@@ -1133,6 +1139,8 @@ declare module 'nazar-salary' {
|
|
|
1133
1139
|
rate_per_lesson: number;
|
|
1134
1140
|
lesson_group_id: number | null;
|
|
1135
1141
|
created_at: number;
|
|
1142
|
+
/** Why this course row was closed: 'teacher_change' marks a teacher handoff; null for the active row */
|
|
1143
|
+
stop_reason: string | null;
|
|
1136
1144
|
}
|
|
1137
1145
|
|
|
1138
1146
|
export interface PaymentInfo {
|
|
@@ -1722,9 +1730,10 @@ declare module 'nazar-salary' {
|
|
|
1722
1730
|
// Forecast endpoints
|
|
1723
1731
|
/**
|
|
1724
1732
|
* Get teacher salary forecast for upcoming months (Admin only)
|
|
1725
|
-
* @param monthsAhead Number of months
|
|
1733
|
+
* @param monthsAhead Number of forecast months (1–12). Default: 6
|
|
1734
|
+
* @param monthsBefore Number of past months prepended to monthly_data (0–12). Default: 4
|
|
1726
1735
|
*/
|
|
1727
|
-
getTeacherExpensesForecast(monthsAhead?: number): Promise<TeacherExpensesForecastResponse>;
|
|
1736
|
+
getTeacherExpensesForecast(monthsAhead?: number, monthsBefore?: number): Promise<TeacherExpensesForecastResponse>;
|
|
1728
1737
|
|
|
1729
1738
|
// Export endpoints
|
|
1730
1739
|
/**
|
|
@@ -1849,6 +1858,10 @@ declare module 'nazar-salary' {
|
|
|
1849
1858
|
forecast_metadata: {
|
|
1850
1859
|
generated_at: string;
|
|
1851
1860
|
current_month: string;
|
|
1861
|
+
/** How many past months are prepended to monthly_data */
|
|
1862
|
+
previous_months: number;
|
|
1863
|
+
/** Earliest month present in monthly_data (current_month minus previous_months) */
|
|
1864
|
+
data_from: string;
|
|
1852
1865
|
forecast_period_months: number;
|
|
1853
1866
|
forecast_from: string;
|
|
1854
1867
|
forecast_to: string;
|
|
@@ -1862,6 +1875,7 @@ declare module 'nazar-salary' {
|
|
|
1862
1875
|
min_month: string | null;
|
|
1863
1876
|
max_month: string | null;
|
|
1864
1877
|
};
|
|
1878
|
+
/** First entry is the previous month (see forecast_metadata.previous_month), then the forecast window from current_month onward. summary/risk_analysis cover the forecast window only. */
|
|
1865
1879
|
monthly_data: Array<{
|
|
1866
1880
|
month: string;
|
|
1867
1881
|
month_display: string;
|
package/index.js
CHANGED
|
@@ -604,13 +604,15 @@ class SalaryAPI {
|
|
|
604
604
|
}
|
|
605
605
|
|
|
606
606
|
/**
|
|
607
|
-
* Change student's teacher
|
|
608
|
-
*
|
|
607
|
+
* Change student's teacher (requireAuth: admin or owner).
|
|
608
|
+
* Closes the current course row and opens a new active row with the same total_lessons
|
|
609
|
+
* and carried-over progress, but the new teacher — so the previous teacher stays visible
|
|
610
|
+
* in the course history. Does NOT recalculate lessons (unlike transfer).
|
|
609
611
|
* For group lessons, changes the teacher for the whole group.
|
|
610
612
|
* @param {number} studentId - Student ID
|
|
611
613
|
* @param {object} data - Change teacher data
|
|
612
614
|
* @param {number} data.new_teacher_id - New teacher ID
|
|
613
|
-
* @returns {Promise<{student_id: number, old_teacher: {id: number|null, name: string|null}, new_teacher: {id: number, name: string}, lesson_group_id: number|null, changed_at: number}>}
|
|
615
|
+
* @returns {Promise<{student_id: number, old_teacher: {id: number|null, name: string|null}, new_teacher: {id: number, name: string}, new_history_id: number, lesson_group_id: number|null, changed_at: number}>}
|
|
614
616
|
*/
|
|
615
617
|
async changeStudentTeacher(studentId, data) {
|
|
616
618
|
return await this.client.patch(
|
|
@@ -1031,12 +1033,13 @@ class SalaryAPI {
|
|
|
1031
1033
|
|
|
1032
1034
|
/**
|
|
1033
1035
|
* Get teacher salary forecast for upcoming months (Admin only)
|
|
1034
|
-
* @param {number} [monthsAhead=6] - Number of months
|
|
1036
|
+
* @param {number} [monthsAhead=6] - Number of forecast months (1-12)
|
|
1037
|
+
* @param {number} [monthsBefore=4] - Number of past months to prepend to monthly_data (0-12)
|
|
1035
1038
|
* @returns {Promise<object>}
|
|
1036
1039
|
*/
|
|
1037
|
-
async getTeacherExpensesForecast(monthsAhead = 6) {
|
|
1040
|
+
async getTeacherExpensesForecast(monthsAhead = 6, monthsBefore = 4) {
|
|
1038
1041
|
return await this.client.get("/api/v1/forecast/teacher-expenses", {
|
|
1039
|
-
params: { months_ahead: monthsAhead },
|
|
1042
|
+
params: { months_ahead: monthsAhead, months_before: monthsBefore },
|
|
1040
1043
|
});
|
|
1041
1044
|
}
|
|
1042
1045
|
|