nazar-salary 1.2.1 → 1.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 +76 -0
- package/index.js +78 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -70,6 +70,17 @@ declare module 'nazar-salary' {
|
|
|
70
70
|
monthly_salary_percent: number;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export interface TeacherLanguage {
|
|
74
|
+
code: string;
|
|
75
|
+
name: string;
|
|
76
|
+
name_en: string;
|
|
77
|
+
name_ru: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface TeacherLanguagesResponse {
|
|
81
|
+
languages: TeacherLanguage[];
|
|
82
|
+
}
|
|
83
|
+
|
|
73
84
|
export interface Teacher {
|
|
74
85
|
id: number;
|
|
75
86
|
first_name: string;
|
|
@@ -127,6 +138,62 @@ declare module 'nazar-salary' {
|
|
|
127
138
|
pagination: Pagination;
|
|
128
139
|
}
|
|
129
140
|
|
|
141
|
+
export type PriceFormat = 'individual' | 'duet' | 'trio' | 'group';
|
|
142
|
+
export type LessonType = 'online' | 'offline';
|
|
143
|
+
|
|
144
|
+
export interface Price {
|
|
145
|
+
id: number;
|
|
146
|
+
name: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
format: PriceFormat;
|
|
149
|
+
lesson_type: LessonType;
|
|
150
|
+
lessons_per_month: 8 | 12;
|
|
151
|
+
duration_minutes: number;
|
|
152
|
+
rate_per_lesson: number;
|
|
153
|
+
created_at: number;
|
|
154
|
+
updated_at?: number;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface CreatePriceData {
|
|
158
|
+
name: string;
|
|
159
|
+
description?: string;
|
|
160
|
+
format: PriceFormat;
|
|
161
|
+
lesson_type: LessonType;
|
|
162
|
+
lessons_per_month: 8 | 12;
|
|
163
|
+
duration_minutes: number;
|
|
164
|
+
rate_per_lesson: number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface UpdatePriceData {
|
|
168
|
+
name?: string;
|
|
169
|
+
description?: string;
|
|
170
|
+
format?: PriceFormat;
|
|
171
|
+
lesson_type?: LessonType;
|
|
172
|
+
lessons_per_month?: 8 | 12;
|
|
173
|
+
rate_per_lesson?: number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface PricesResponse {
|
|
177
|
+
prices: Price[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface PriceHistoryItem {
|
|
181
|
+
id: number;
|
|
182
|
+
format: PriceFormat;
|
|
183
|
+
lesson_type: LessonType;
|
|
184
|
+
lessons_per_month: 8 | 12;
|
|
185
|
+
duration_minutes: number;
|
|
186
|
+
rate_per_lesson: number;
|
|
187
|
+
created_at: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface PriceHistoryResponse {
|
|
191
|
+
id: number;
|
|
192
|
+
name: string;
|
|
193
|
+
description?: string;
|
|
194
|
+
history: PriceHistoryItem[];
|
|
195
|
+
}
|
|
196
|
+
|
|
130
197
|
export default class SalaryAPI {
|
|
131
198
|
constructor(options?: SalaryAPIOptions);
|
|
132
199
|
|
|
@@ -150,11 +217,20 @@ declare module 'nazar-salary' {
|
|
|
150
217
|
deleteManager(managerId: number): Promise<void>;
|
|
151
218
|
|
|
152
219
|
// Teacher endpoints
|
|
220
|
+
getTeacherLanguages(): Promise<TeacherLanguagesResponse>;
|
|
153
221
|
createTeacher(data: CreateTeacherData): Promise<TeacherResponse>;
|
|
154
222
|
getTeachers(params?: TeachersListParams): Promise<TeachersResponse>;
|
|
155
223
|
updateTeacher(teacherId: number, data: UpdateTeacherData): Promise<TeacherResponse>;
|
|
156
224
|
deleteTeacher(teacherId: number): Promise<void>;
|
|
157
225
|
|
|
226
|
+
// Price endpoints
|
|
227
|
+
createPrice(data: CreatePriceData): Promise<Price>;
|
|
228
|
+
getPrices(): Promise<PricesResponse>;
|
|
229
|
+
getPrice(priceId: number): Promise<Price>;
|
|
230
|
+
updatePrice(priceId: number, data: UpdatePriceData): Promise<Price>;
|
|
231
|
+
getPriceHistory(priceId: number): Promise<PriceHistoryResponse>;
|
|
232
|
+
deletePrice(priceId: number): Promise<void>;
|
|
233
|
+
|
|
158
234
|
// Custom request
|
|
159
235
|
request(method: string, path: string, data?: any): Promise<any>;
|
|
160
236
|
}
|
package/index.js
CHANGED
|
@@ -179,6 +179,14 @@ class SalaryAPI {
|
|
|
179
179
|
|
|
180
180
|
// ===== TEACHER ENDPOINTS =====
|
|
181
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Get available teacher languages
|
|
184
|
+
* @returns {Promise<{languages: array}>}
|
|
185
|
+
*/
|
|
186
|
+
async getTeacherLanguages() {
|
|
187
|
+
return await this.client.get("/api/v1/teacher/languages");
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
/**
|
|
183
191
|
* Create new teacher
|
|
184
192
|
* @param {object} data - Teacher data
|
|
@@ -234,6 +242,76 @@ class SalaryAPI {
|
|
|
234
242
|
return await this.client.delete(`/api/v1/teacher/${teacherId}`);
|
|
235
243
|
}
|
|
236
244
|
|
|
245
|
+
// ===== PRICE ENDPOINTS =====
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Create new price (Admin only)
|
|
249
|
+
* @param {object} data - Price data
|
|
250
|
+
* @param {string} data.name - Price name
|
|
251
|
+
* @param {string} [data.description] - Description
|
|
252
|
+
* @param {string} data.format - Format: individual, duet, trio, group
|
|
253
|
+
* @param {string} data.lesson_type - Lesson type: online, offline
|
|
254
|
+
* @param {number} data.lessons_per_month - Lessons per month: 8 or 12
|
|
255
|
+
* @param {number} data.duration_minutes - Duration in minutes
|
|
256
|
+
* @param {number} data.rate_per_lesson - Rate per lesson in tenge
|
|
257
|
+
* @returns {Promise<object>}
|
|
258
|
+
*/
|
|
259
|
+
async createPrice(data) {
|
|
260
|
+
return await this.client.post("/api/v1/admin/prices/", data);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get all prices (Admin only)
|
|
265
|
+
* @returns {Promise<{prices: array}>}
|
|
266
|
+
*/
|
|
267
|
+
async getPrices() {
|
|
268
|
+
return await this.client.get("/api/v1/admin/prices/");
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Get single price by ID (Admin only)
|
|
273
|
+
* @param {number} priceId - Price ID
|
|
274
|
+
* @returns {Promise<object>}
|
|
275
|
+
*/
|
|
276
|
+
async getPrice(priceId) {
|
|
277
|
+
return await this.client.get(`/api/v1/admin/prices/${priceId}`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Update price (Admin only)
|
|
282
|
+
* Note: duration_minutes cannot be changed
|
|
283
|
+
* @param {number} priceId - Price ID
|
|
284
|
+
* @param {object} data - Price data to update
|
|
285
|
+
* @param {string} [data.name] - Price name
|
|
286
|
+
* @param {string} [data.description] - Description
|
|
287
|
+
* @param {string} [data.format] - Format: individual, duet, trio, group
|
|
288
|
+
* @param {string} [data.lesson_type] - Lesson type: online, offline
|
|
289
|
+
* @param {number} [data.lessons_per_month] - Lessons per month: 8 or 12
|
|
290
|
+
* @param {number} [data.rate_per_lesson] - Rate per lesson in tenge
|
|
291
|
+
* @returns {Promise<object>}
|
|
292
|
+
*/
|
|
293
|
+
async updatePrice(priceId, data) {
|
|
294
|
+
return await this.client.put(`/api/v1/admin/prices/${priceId}`, data);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Get price history (Admin only)
|
|
299
|
+
* @param {number} priceId - Price ID
|
|
300
|
+
* @returns {Promise<{history: array}>}
|
|
301
|
+
*/
|
|
302
|
+
async getPriceHistory(priceId) {
|
|
303
|
+
return await this.client.get(`/api/v1/admin/prices/${priceId}/history`);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Delete price (soft delete, Admin only)
|
|
308
|
+
* @param {number} priceId - Price ID
|
|
309
|
+
* @returns {Promise<void>}
|
|
310
|
+
*/
|
|
311
|
+
async deletePrice(priceId) {
|
|
312
|
+
return await this.client.delete(`/api/v1/admin/prices/${priceId}`);
|
|
313
|
+
}
|
|
314
|
+
|
|
237
315
|
// ===== CUSTOM REQUEST =====
|
|
238
316
|
|
|
239
317
|
/**
|