nazar-salary 3.5.4 → 3.5.5
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 +49 -1
- package/index.js +15 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -912,13 +912,60 @@ declare module 'nazar-salary' {
|
|
|
912
912
|
logo_url: string | null;
|
|
913
913
|
phone: string | null;
|
|
914
914
|
courses: AkcentCourse[];
|
|
915
|
+
/** certificates for offline courses, newest first */
|
|
916
|
+
offline_certificates: AkcentOfflineCertificate[];
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
export interface AkcentOfflineCertificate {
|
|
920
|
+
number: string;
|
|
921
|
+
/** given_date, epoch ms */
|
|
922
|
+
issuedAt: number;
|
|
923
|
+
course_name: string;
|
|
924
|
+
teacher_full_name: string;
|
|
925
|
+
languageLevel: AkcentLanguageLevel | string;
|
|
926
|
+
lessonsDone: number;
|
|
927
|
+
lessonsTotal: number;
|
|
928
|
+
totalGrade: number;
|
|
929
|
+
verifyUrl: string;
|
|
930
|
+
downloadUrl: string;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/** Latest course of the student in Salary (defaults for forms) */
|
|
934
|
+
export interface CertificatesSalaryCourse {
|
|
935
|
+
completed_lessons: number;
|
|
936
|
+
total_lessons: number;
|
|
915
937
|
}
|
|
916
938
|
|
|
917
939
|
export interface StudentCertificatesResponse {
|
|
918
|
-
/** false —
|
|
940
|
+
/** false — the student could not be loaded from Akcent */
|
|
919
941
|
found: boolean;
|
|
942
|
+
/** true — the student was just created in Akcent by this request */
|
|
943
|
+
created: boolean;
|
|
920
944
|
student: AkcentStudent | null;
|
|
921
945
|
salary_teacher: CertificatesSalaryTeacher | null;
|
|
946
|
+
salary_course: CertificatesSalaryCourse | null;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
export interface CreateOfflineCertificateData {
|
|
950
|
+
/** up to 255 characters */
|
|
951
|
+
course_name: string;
|
|
952
|
+
/** up to 201 characters */
|
|
953
|
+
teacher_full_name: string;
|
|
954
|
+
languageLevel: AkcentLanguageLevel;
|
|
955
|
+
/** 0–1000, not more than lessonsTotal */
|
|
956
|
+
lessonsDone: number;
|
|
957
|
+
/** 1–1000 */
|
|
958
|
+
lessonsTotal: number;
|
|
959
|
+
/** "YYYY-MM-DD" (Almaty day), ISO date-time or epoch ms; today by default; not later than tomorrow */
|
|
960
|
+
given_date?: string | number;
|
|
961
|
+
/** 0–100, 95 by default */
|
|
962
|
+
totalGrade?: number;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
export interface CreateOfflineCertificateResponse {
|
|
966
|
+
/** false — the certificate given before for this student, course and day (updated) */
|
|
967
|
+
created: boolean;
|
|
968
|
+
certificate: AkcentOfflineCertificate;
|
|
922
969
|
}
|
|
923
970
|
|
|
924
971
|
export type StopReason = 'student_quit' | 'moved_away' | 'health_issues' | 'financial' | 'other' | 'refund';
|
|
@@ -1890,6 +1937,7 @@ declare module 'nazar-salary' {
|
|
|
1890
1937
|
getStudent(studentId: number): Promise<StudentDetail>;
|
|
1891
1938
|
getStudentCertificates(studentId: number): Promise<StudentCertificatesResponse>;
|
|
1892
1939
|
updateStudentCertificateCourse(studentId: number, courseId: number, data: UpdateAkcentCourseData): Promise<UpdateAkcentCourseResponse>;
|
|
1940
|
+
createStudentOfflineCertificate(studentId: number, data: CreateOfflineCertificateData): Promise<CreateOfflineCertificateResponse>;
|
|
1893
1941
|
searchStudents(params: SearchStudentsParams): Promise<SearchStudentsResponse>;
|
|
1894
1942
|
getStoppedStudents(params?: StoppedStudentsParams): Promise<StoppedStudentsResponse>;
|
|
1895
1943
|
getMyStoppedStudents(params?: MyStoppedStudentsParams): Promise<MyStoppedStudentsResponse>;
|
package/index.js
CHANGED
|
@@ -757,7 +757,7 @@ class SalaryAPI {
|
|
|
757
757
|
|
|
758
758
|
/**
|
|
759
759
|
* Get student's Akcent Online courses and certificates (requireAuth: admin or owner manager)
|
|
760
|
-
* The backend finds the student in Akcent by phone.
|
|
760
|
+
* The backend finds the student in Akcent by phone and creates them there if missing.
|
|
761
761
|
* @param {number} studentId - Student ID
|
|
762
762
|
* @returns {Promise<StudentCertificatesResponse>}
|
|
763
763
|
*/
|
|
@@ -780,6 +780,20 @@ class SalaryAPI {
|
|
|
780
780
|
);
|
|
781
781
|
}
|
|
782
782
|
|
|
783
|
+
/**
|
|
784
|
+
* Give an Akcent certificate for an offline course (requireAuth: admin or owner manager)
|
|
785
|
+
* Same student, course_name and day again updates the certificate given before.
|
|
786
|
+
* @param {number} studentId - Student ID
|
|
787
|
+
* @param {object} data - { course_name, teacher_full_name, languageLevel, lessonsDone, lessonsTotal, given_date?, totalGrade? }
|
|
788
|
+
* @returns {Promise<CreateOfflineCertificateResponse>}
|
|
789
|
+
*/
|
|
790
|
+
async createStudentOfflineCertificate(studentId, data) {
|
|
791
|
+
return await this.client.post(
|
|
792
|
+
`/api/v1/student/${studentId}/certificates`,
|
|
793
|
+
data,
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
|
|
783
797
|
/**
|
|
784
798
|
* Search students globally (Admin only)
|
|
785
799
|
* By default returns only active records; pass is_active=false for stopped.
|