washday-sdk 1.1.0 → 1.1.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/README.md +1 -0
- package/dist/api/attendance/get.js +37 -1
- package/dist/api/csv/get.js +29 -4
- package/dist/api/index.js +2 -0
- package/docs/README.md +1 -0
- package/package.json +1 -1
- package/src/api/attendance/get.ts +42 -3
- package/src/api/attendance/post.ts +1 -2
- package/src/api/csv/get.ts +31 -6
- package/src/api/index.ts +2 -0
- package/src/interfaces/Api.ts +2 -0
package/README.md
CHANGED
|
@@ -112,6 +112,7 @@ npm test
|
|
|
112
112
|
|
|
113
113
|
## 🆕 What's New
|
|
114
114
|
|
|
115
|
+
- **v1.1.1**: 🐛 Fixed missing parameters in attendance endpoints (`userId` in getHistory/getStatus, `storeId` in clockOut)
|
|
115
116
|
- **v1.1.0**: ✨ Added Attendance module with clock-in/out functionality
|
|
116
117
|
- **v1.0.2**: 🔧 Enhanced order management features
|
|
117
118
|
|
|
@@ -16,6 +16,8 @@ export const getHistory = function (params) {
|
|
|
16
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
17
|
};
|
|
18
18
|
let queryParams = '';
|
|
19
|
+
if (params.userId)
|
|
20
|
+
queryParams += `userId=${params.userId}&`; // ✅ AÑADIDO
|
|
19
21
|
if (params.storeId)
|
|
20
22
|
queryParams += `storeId=${params.storeId}&`;
|
|
21
23
|
if (params.startDate)
|
|
@@ -45,7 +47,11 @@ export const getStatus = function (params) {
|
|
|
45
47
|
};
|
|
46
48
|
let queryParams = '';
|
|
47
49
|
if (params === null || params === void 0 ? void 0 : params.storeId)
|
|
48
|
-
queryParams += `storeId=${params.storeId}
|
|
50
|
+
queryParams += `storeId=${params.storeId}&`;
|
|
51
|
+
if (params === null || params === void 0 ? void 0 : params.userId)
|
|
52
|
+
queryParams += `userId=${params.userId}&`; // ✅ ARREGLADO - añadir &
|
|
53
|
+
// Remove trailing '&'
|
|
54
|
+
queryParams = queryParams.slice(0, -1);
|
|
49
55
|
const url = queryParams ? `${ATTENDANCE_API}/status?${queryParams}` : `${ATTENDANCE_API}/status`;
|
|
50
56
|
return yield axiosInstance.get(url, config);
|
|
51
57
|
}
|
|
@@ -66,6 +72,8 @@ export const getStoreReport = function (storeId, params) {
|
|
|
66
72
|
queryParams += `startDate=${params.startDate}&`;
|
|
67
73
|
if (params === null || params === void 0 ? void 0 : params.endDate)
|
|
68
74
|
queryParams += `endDate=${params.endDate}&`;
|
|
75
|
+
if (params === null || params === void 0 ? void 0 : params.employeeId)
|
|
76
|
+
queryParams += `employeeId=${params.employeeId}&`;
|
|
69
77
|
if (params === null || params === void 0 ? void 0 : params.pageNum)
|
|
70
78
|
queryParams += `pageNum=${params.pageNum}&`;
|
|
71
79
|
if (params === null || params === void 0 ? void 0 : params.limit)
|
|
@@ -81,3 +89,31 @@ export const getStoreReport = function (storeId, params) {
|
|
|
81
89
|
}
|
|
82
90
|
});
|
|
83
91
|
};
|
|
92
|
+
export const exportStoreReport = function (storeId, params) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
try {
|
|
95
|
+
const config = {
|
|
96
|
+
headers: {
|
|
97
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
98
|
+
'Content-Type': 'text/csv'
|
|
99
|
+
},
|
|
100
|
+
responseType: 'blob'
|
|
101
|
+
};
|
|
102
|
+
let queryParams = '';
|
|
103
|
+
if (params === null || params === void 0 ? void 0 : params.startDate)
|
|
104
|
+
queryParams += `startDate=${params.startDate}&`;
|
|
105
|
+
if (params === null || params === void 0 ? void 0 : params.endDate)
|
|
106
|
+
queryParams += `endDate=${params.endDate}&`;
|
|
107
|
+
if (params === null || params === void 0 ? void 0 : params.employeeId)
|
|
108
|
+
queryParams += `employeeId=${params.employeeId}&`;
|
|
109
|
+
// Remove trailing '&'
|
|
110
|
+
queryParams = queryParams.slice(0, -1);
|
|
111
|
+
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report/export`;
|
|
112
|
+
return yield axiosInstance.get(url, config);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error('Error exporting store attendance report:', error);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
package/dist/api/csv/get.js
CHANGED
|
@@ -11,6 +11,7 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
|
11
11
|
import axiosInstance from "../axiosInstance";
|
|
12
12
|
const GENERATE_EXPORT = 'api/export';
|
|
13
13
|
const GET_SET_REPORTS = 'api/reports';
|
|
14
|
+
const ATTENDANCE_API = 'api/attendance';
|
|
14
15
|
export const exportCustomersList = function (params) {
|
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
17
|
try {
|
|
@@ -310,15 +311,39 @@ export const exportUnpaidOrdersReportCSV = function (storeId, params) {
|
|
|
310
311
|
const queryParams = generateQueryParamsStr([
|
|
311
312
|
'fromDate',
|
|
312
313
|
'toDate',
|
|
313
|
-
'pageNum',
|
|
314
|
-
'limit',
|
|
315
314
|
'timezone',
|
|
316
315
|
'customerName'
|
|
317
316
|
], params);
|
|
318
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export
|
|
317
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export?${queryParams}`, config);
|
|
319
318
|
}
|
|
320
319
|
catch (error) {
|
|
321
|
-
console.error('Error fetching
|
|
320
|
+
console.error('Error fetching exportUnpaidOrdersReportCSV:', error);
|
|
321
|
+
throw error;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
export const exportAttendanceReport = function (storeId, params) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
try {
|
|
328
|
+
const config = {
|
|
329
|
+
headers: {
|
|
330
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
331
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
332
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
333
|
+
},
|
|
334
|
+
params: {
|
|
335
|
+
responseType: 'blob'
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
const queryParams = generateQueryParamsStr([
|
|
339
|
+
'fromDate',
|
|
340
|
+
'toDate',
|
|
341
|
+
'employeeId'
|
|
342
|
+
], params);
|
|
343
|
+
return yield axiosInstance.get(`${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}`, config);
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
console.error('Error fetching exportAttendanceReport:', error);
|
|
322
347
|
throw error;
|
|
323
348
|
}
|
|
324
349
|
});
|
package/dist/api/index.js
CHANGED
|
@@ -271,6 +271,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
271
271
|
exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
|
|
272
272
|
exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
|
|
273
273
|
exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
|
|
274
|
+
exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
|
|
274
275
|
});
|
|
275
276
|
this.pdf = bindMethods(this, {
|
|
276
277
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
@@ -311,6 +312,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
311
312
|
getHistory: attendanceEndpoints.getModule.getHistory,
|
|
312
313
|
getStatus: attendanceEndpoints.getModule.getStatus,
|
|
313
314
|
getStoreReport: attendanceEndpoints.getModule.getStoreReport,
|
|
315
|
+
exportStoreReport: attendanceEndpoints.getModule.exportStoreReport,
|
|
314
316
|
clockIn: attendanceEndpoints.postModule.clockIn,
|
|
315
317
|
clockOut: attendanceEndpoints.postModule.clockOut,
|
|
316
318
|
updateById: attendanceEndpoints.putModule.updateById,
|
package/docs/README.md
CHANGED
|
@@ -46,6 +46,7 @@ Welcome to the Washday SDK documentation! This folder contains comprehensive gui
|
|
|
46
46
|
|
|
47
47
|
## 🆕 What's New
|
|
48
48
|
|
|
49
|
+
- **v1.1.1**: 🐛 Fixed missing parameters in attendance endpoints (`userId` in getHistory/getStatus, `storeId` in clockOut)
|
|
49
50
|
- **v1.1.0**: Added Attendance module with clock-in/out functionality
|
|
50
51
|
- **v1.0.2**: Enhanced order management features
|
|
51
52
|
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import axiosInstance from "../axiosInstance";
|
|
|
4
4
|
const ATTENDANCE_API = 'api/attendance';
|
|
5
5
|
|
|
6
6
|
export const getHistory = async function (this: WashdayClientInstance, params: {
|
|
7
|
+
userId?: string; // ✅ AÑADIDO - requerido por backend
|
|
7
8
|
storeId?: string;
|
|
8
9
|
startDate?: string;
|
|
9
10
|
endDate?: string;
|
|
@@ -16,6 +17,7 @@ export const getHistory = async function (this: WashdayClientInstance, params: {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
let queryParams = '';
|
|
20
|
+
if (params.userId) queryParams += `userId=${params.userId}&`; // ✅ AÑADIDO
|
|
19
21
|
if (params.storeId) queryParams += `storeId=${params.storeId}&`;
|
|
20
22
|
if (params.startDate) queryParams += `startDate=${params.startDate}&`;
|
|
21
23
|
if (params.endDate) queryParams += `endDate=${params.endDate}&`;
|
|
@@ -35,6 +37,7 @@ export const getHistory = async function (this: WashdayClientInstance, params: {
|
|
|
35
37
|
|
|
36
38
|
export const getStatus = async function (this: WashdayClientInstance, params?: {
|
|
37
39
|
storeId?: string;
|
|
40
|
+
userId?: string;
|
|
38
41
|
}): Promise<any> {
|
|
39
42
|
try {
|
|
40
43
|
const config = {
|
|
@@ -42,7 +45,11 @@ export const getStatus = async function (this: WashdayClientInstance, params?: {
|
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
let queryParams = '';
|
|
45
|
-
if (params?.storeId) queryParams += `storeId=${params.storeId}
|
|
48
|
+
if (params?.storeId) queryParams += `storeId=${params.storeId}&`;
|
|
49
|
+
if (params?.userId) queryParams += `userId=${params.userId}&`; // ✅ ARREGLADO - añadir &
|
|
50
|
+
|
|
51
|
+
// Remove trailing '&'
|
|
52
|
+
queryParams = queryParams.slice(0, -1);
|
|
46
53
|
|
|
47
54
|
const url = queryParams ? `${ATTENDANCE_API}/status?${queryParams}` : `${ATTENDANCE_API}/status`;
|
|
48
55
|
return await axiosInstance.get(url, config);
|
|
@@ -55,8 +62,9 @@ export const getStatus = async function (this: WashdayClientInstance, params?: {
|
|
|
55
62
|
export const getStoreReport = async function (this: WashdayClientInstance, storeId: string, params?: {
|
|
56
63
|
startDate?: string;
|
|
57
64
|
endDate?: string;
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
employeeId?: string;
|
|
66
|
+
pageNum?: string | number;
|
|
67
|
+
limit?: string | number;
|
|
60
68
|
}): Promise<any> {
|
|
61
69
|
try {
|
|
62
70
|
const config = {
|
|
@@ -66,6 +74,7 @@ export const getStoreReport = async function (this: WashdayClientInstance, store
|
|
|
66
74
|
let queryParams = '';
|
|
67
75
|
if (params?.startDate) queryParams += `startDate=${params.startDate}&`;
|
|
68
76
|
if (params?.endDate) queryParams += `endDate=${params.endDate}&`;
|
|
77
|
+
if (params?.employeeId) queryParams += `employeeId=${params.employeeId}&`;
|
|
69
78
|
if (params?.pageNum) queryParams += `pageNum=${params.pageNum}&`;
|
|
70
79
|
if (params?.limit) queryParams += `limit=${params.limit}&`;
|
|
71
80
|
|
|
@@ -78,4 +87,34 @@ export const getStoreReport = async function (this: WashdayClientInstance, store
|
|
|
78
87
|
console.error('Error fetching store attendance report:', error);
|
|
79
88
|
throw error;
|
|
80
89
|
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const exportStoreReport = async function (this: WashdayClientInstance, storeId: string, params?: {
|
|
93
|
+
startDate?: string;
|
|
94
|
+
endDate?: string;
|
|
95
|
+
employeeId?: string;
|
|
96
|
+
}): Promise<any> {
|
|
97
|
+
try {
|
|
98
|
+
const config = {
|
|
99
|
+
headers: {
|
|
100
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
101
|
+
'Content-Type': 'text/csv'
|
|
102
|
+
},
|
|
103
|
+
responseType: 'blob' as const
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
let queryParams = '';
|
|
107
|
+
if (params?.startDate) queryParams += `startDate=${params.startDate}&`;
|
|
108
|
+
if (params?.endDate) queryParams += `endDate=${params.endDate}&`;
|
|
109
|
+
if (params?.employeeId) queryParams += `employeeId=${params.employeeId}&`;
|
|
110
|
+
|
|
111
|
+
// Remove trailing '&'
|
|
112
|
+
queryParams = queryParams.slice(0, -1);
|
|
113
|
+
|
|
114
|
+
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report/export`;
|
|
115
|
+
return await axiosInstance.get(url, config);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('Error exporting store attendance report:', error);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
81
120
|
};
|
|
@@ -6,7 +6,6 @@ const ATTENDANCE_API = 'api/attendance';
|
|
|
6
6
|
export const clockIn = async function (this: WashdayClientInstance, data: {
|
|
7
7
|
storeId: string;
|
|
8
8
|
userId?: string;
|
|
9
|
-
ipAddress?: string;
|
|
10
9
|
notes?: string;
|
|
11
10
|
}): Promise<any> {
|
|
12
11
|
try {
|
|
@@ -22,7 +21,7 @@ export const clockIn = async function (this: WashdayClientInstance, data: {
|
|
|
22
21
|
|
|
23
22
|
export const clockOut = async function (this: WashdayClientInstance, data: {
|
|
24
23
|
userId?: string;
|
|
25
|
-
|
|
24
|
+
storeId?: string; // ✅ AÑADIDO - requerido por backend
|
|
26
25
|
notes?: string;
|
|
27
26
|
}): Promise<any> {
|
|
28
27
|
try {
|
package/src/api/csv/get.ts
CHANGED
|
@@ -4,6 +4,7 @@ import axiosInstance from "../axiosInstance";
|
|
|
4
4
|
|
|
5
5
|
const GENERATE_EXPORT = 'api/export';
|
|
6
6
|
const GET_SET_REPORTS = 'api/reports';
|
|
7
|
+
const ATTENDANCE_API = 'api/attendance';
|
|
7
8
|
|
|
8
9
|
export const exportCustomersList = async function (this: WashdayClientInstance, params: {
|
|
9
10
|
searchTerm?: string
|
|
@@ -323,8 +324,6 @@ export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientIn
|
|
|
323
324
|
fromDate?: string
|
|
324
325
|
toDate?: string
|
|
325
326
|
timezone?: string
|
|
326
|
-
pageNum?: string
|
|
327
|
-
limit?: string
|
|
328
327
|
customerName?: string
|
|
329
328
|
}): Promise<any> {
|
|
330
329
|
try {
|
|
@@ -341,14 +340,40 @@ export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientIn
|
|
|
341
340
|
const queryParams = generateQueryParamsStr([
|
|
342
341
|
'fromDate',
|
|
343
342
|
'toDate',
|
|
344
|
-
'pageNum',
|
|
345
|
-
'limit',
|
|
346
343
|
'timezone',
|
|
347
344
|
'customerName'
|
|
348
345
|
], params);
|
|
349
|
-
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export
|
|
346
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export?${queryParams}`, config);
|
|
350
347
|
} catch (error) {
|
|
351
|
-
console.error('Error fetching
|
|
348
|
+
console.error('Error fetching exportUnpaidOrdersReportCSV:', error);
|
|
349
|
+
throw error;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
export const exportAttendanceReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
354
|
+
fromDate?: string
|
|
355
|
+
toDate?: string
|
|
356
|
+
employeeId?: string
|
|
357
|
+
}): Promise<any> {
|
|
358
|
+
try {
|
|
359
|
+
const config = {
|
|
360
|
+
headers: {
|
|
361
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
362
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
363
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
364
|
+
},
|
|
365
|
+
params: {
|
|
366
|
+
responseType: 'blob'
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const queryParams = generateQueryParamsStr([
|
|
370
|
+
'fromDate',
|
|
371
|
+
'toDate',
|
|
372
|
+
'employeeId'
|
|
373
|
+
], params);
|
|
374
|
+
return await axiosInstance.get(`${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}`, config);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
console.error('Error fetching exportAttendanceReport:', error);
|
|
352
377
|
throw error;
|
|
353
378
|
}
|
|
354
379
|
};
|
package/src/api/index.ts
CHANGED
|
@@ -278,6 +278,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
278
278
|
exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
|
|
279
279
|
exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
|
|
280
280
|
exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
|
|
281
|
+
exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
|
|
281
282
|
});
|
|
282
283
|
this.pdf = bindMethods(this, {
|
|
283
284
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
@@ -318,6 +319,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
318
319
|
getHistory: attendanceEndpoints.getModule.getHistory,
|
|
319
320
|
getStatus: attendanceEndpoints.getModule.getStatus,
|
|
320
321
|
getStoreReport: attendanceEndpoints.getModule.getStoreReport,
|
|
322
|
+
exportStoreReport: attendanceEndpoints.getModule.exportStoreReport,
|
|
321
323
|
clockIn: attendanceEndpoints.postModule.clockIn,
|
|
322
324
|
clockOut: attendanceEndpoints.postModule.clockOut,
|
|
323
325
|
updateById: attendanceEndpoints.putModule.updateById,
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -263,6 +263,7 @@ export interface WashdayClientInstance {
|
|
|
263
263
|
exportCleanedOrdersReport: typeof csvExportEndpoints.getModule.exportCleanedOrdersReport,
|
|
264
264
|
exportSalesReport: typeof csvExportEndpoints.getModule.exportSalesReport,
|
|
265
265
|
exportStaffReport: typeof csvExportEndpoints.getModule.exportStaffReport,
|
|
266
|
+
exportAttendanceReport: typeof csvExportEndpoints.getModule.exportAttendanceReport,
|
|
266
267
|
};
|
|
267
268
|
pdf: {
|
|
268
269
|
exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
|
|
@@ -301,6 +302,7 @@ export interface WashdayClientInstance {
|
|
|
301
302
|
getHistory: typeof attendanceEndpoints.getModule.getHistory;
|
|
302
303
|
getStatus: typeof attendanceEndpoints.getModule.getStatus;
|
|
303
304
|
getStoreReport: typeof attendanceEndpoints.getModule.getStoreReport;
|
|
305
|
+
exportStoreReport: typeof attendanceEndpoints.getModule.exportStoreReport;
|
|
304
306
|
clockIn: typeof attendanceEndpoints.postModule.clockIn;
|
|
305
307
|
clockOut: typeof attendanceEndpoints.postModule.clockOut;
|
|
306
308
|
updateById: typeof attendanceEndpoints.putModule.updateById;
|