washday-sdk 0.0.173 → 0.0.175
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/dist/api/axiosInstance.js +2 -2
- package/dist/api/index.js +17 -0
- package/dist/api/outsourcedOrders/delete.js +25 -0
- package/dist/api/outsourcedOrders/get.js +61 -0
- package/dist/api/outsourcedOrders/index.js +4 -0
- package/dist/api/outsourcedOrders/post.js +25 -0
- package/dist/api/outsourcedOrders/put.js +25 -0
- package/dist/api/partners/delete.js +25 -0
- package/dist/api/partners/get.js +40 -0
- package/dist/api/partners/index.js +4 -0
- package/dist/api/partners/post.js +25 -0
- package/dist/api/partners/put.js +25 -0
- package/package.json +1 -1
- package/src/api/axiosInstance.ts +2 -2
- package/src/api/index.ts +17 -0
- package/src/api/outsourcedOrders/delete.ts +15 -0
- package/src/api/outsourcedOrders/get.ts +52 -0
- package/src/api/outsourcedOrders/index.ts +4 -0
- package/src/api/outsourcedOrders/post.ts +24 -0
- package/src/api/outsourcedOrders/put.ts +21 -0
- package/src/api/partners/delete.ts +15 -0
- package/src/api/partners/get.ts +28 -0
- package/src/api/partners/index.ts +4 -0
- package/src/api/partners/post.ts +21 -0
- package/src/api/partners/put.ts +21 -0
- package/src/interfaces/Api.ts +15 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
// Define the type for the Axios instance
|
|
3
3
|
let axiosInstance = null;
|
|
4
|
-
const BASE_URL = 'http://localhost:5555/';
|
|
5
|
-
|
|
4
|
+
// const BASE_URL: string = 'http://localhost:5555/';
|
|
5
|
+
const BASE_URL = 'https://washday-backend.herokuapp.com/';
|
|
6
6
|
// Function to create or return the singleton instance
|
|
7
7
|
const getAxiosInstance = () => {
|
|
8
8
|
if (!axiosInstance) {
|
package/dist/api/index.js
CHANGED
|
@@ -36,6 +36,8 @@ import * as reviewsEndpoints from './reviews';
|
|
|
36
36
|
import * as cfdiEndpoints from './cfdi';
|
|
37
37
|
import * as cashupsEndpoints from './cashups';
|
|
38
38
|
import { deleteUserById } from "./users/delete";
|
|
39
|
+
import * as partnersEndpoints from './partners';
|
|
40
|
+
import * as outsourcedOrdersEndpoints from './outsourcedOrders';
|
|
39
41
|
function bindMethods(instance, methods) {
|
|
40
42
|
const boundMethods = {};
|
|
41
43
|
for (const key in methods) {
|
|
@@ -275,5 +277,20 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
275
277
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
276
278
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
277
279
|
});
|
|
280
|
+
this.partners = bindMethods(this, {
|
|
281
|
+
getPartners: partnersEndpoints.getModule.getPartners,
|
|
282
|
+
getPartnerById: partnersEndpoints.getModule.getPartnerById,
|
|
283
|
+
createPartner: partnersEndpoints.postModule.createPartner,
|
|
284
|
+
updatePartnerById: partnersEndpoints.putModule.updatePartnerById,
|
|
285
|
+
deletePartnerById: partnersEndpoints.deleteModule.deletePartnerById,
|
|
286
|
+
});
|
|
287
|
+
this.outsourcedOrders = bindMethods(this, {
|
|
288
|
+
getOutsourcedOrdersByOrder: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder,
|
|
289
|
+
getOutsourcedOrdersByStore: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore,
|
|
290
|
+
getOutsourcedOrderById: outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById,
|
|
291
|
+
createOutsourcedOrder: outsourcedOrdersEndpoints.postModule.createOutsourcedOrder,
|
|
292
|
+
updateOutsourcedOrderById: outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById,
|
|
293
|
+
deleteOutsourcedOrderById: outsourcedOrdersEndpoints.deleteModule.deleteOutsourcedOrderById,
|
|
294
|
+
});
|
|
278
295
|
};
|
|
279
296
|
export default WashdayClient;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
12
|
+
export const deleteOutsourcedOrderById = function (id) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.delete(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching deleteOutsourcedOrderById:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
+
import axiosInstance from "../axiosInstance";
|
|
12
|
+
const GET_OUTSOURCED_ORDERS_BY_STORE = 'api/store/:storeId/outsourced-orders';
|
|
13
|
+
const GET_OUTSOURCED_ORDERS_BY_ORDER = 'api/orders/:orderId/outsourced-orders';
|
|
14
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
15
|
+
export const getOutsourcedOrdersByOrder = function (orderId) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const config = {
|
|
19
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
20
|
+
};
|
|
21
|
+
return yield axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_ORDER.replace(':orderId', orderId)}`, config);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error('Error fetching getOutsourcedOrdersByOrder:', error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export const getOutsourcedOrdersByStore = function (params) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
try {
|
|
32
|
+
const config = {
|
|
33
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
34
|
+
};
|
|
35
|
+
const queryParams = generateQueryParamsStr([
|
|
36
|
+
'statuses',
|
|
37
|
+
'page',
|
|
38
|
+
'limit'
|
|
39
|
+
], params);
|
|
40
|
+
return yield axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error fetching getOutsourcedOrdersByStore:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export const getOutsourcedOrderById = function (id) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
try {
|
|
51
|
+
const config = {
|
|
52
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
53
|
+
};
|
|
54
|
+
return yield axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.error('Error fetching getOutsourcedOrderById:', error);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
12
|
+
export const createOutsourcedOrder = function (data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.post(GET_SET_OUTSOURCED_ORDERS, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching createOutsourcedOrder:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
12
|
+
export const updateOutsourcedOrderById = function (id, data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.put(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching updateOutsourcedOrderById:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
12
|
+
export const deletePartnerById = function (id) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.delete(`${GET_SET_PARTNERS}/${id}`, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching deletePartnerById:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
12
|
+
export const getPartners = function () {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
//THIS WILL FETCH ALL COMPANY PARTNERS
|
|
16
|
+
const config = {
|
|
17
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
|
+
};
|
|
19
|
+
return yield axiosInstance.get(`${GET_SET_PARTNERS}`, config);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('Error fetching getPartners:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const getPartnerById = function (id) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
const config = {
|
|
31
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
|
+
};
|
|
33
|
+
return yield axiosInstance.get(`${GET_SET_PARTNERS}/${id}`, config);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error fetching getPartnerById:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
12
|
+
export const createPartner = function (data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.post(GET_SET_PARTNERS, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching createPartner:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
12
|
+
export const updatePartnerById = function (id, data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.put(`${GET_SET_PARTNERS}/${id}`, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching updatePartnerById:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
package/package.json
CHANGED
package/src/api/axiosInstance.ts
CHANGED
|
@@ -3,8 +3,8 @@ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
|
3
3
|
// Define the type for the Axios instance
|
|
4
4
|
let axiosInstance: AxiosInstance | null = null;
|
|
5
5
|
|
|
6
|
-
const BASE_URL: string = 'http://localhost:5555/';
|
|
7
|
-
|
|
6
|
+
// const BASE_URL: string = 'http://localhost:5555/';
|
|
7
|
+
const BASE_URL: string = 'https://washday-backend.herokuapp.com/';
|
|
8
8
|
|
|
9
9
|
// Function to create or return the singleton instance
|
|
10
10
|
const getAxiosInstance = (): AxiosInstance => {
|
package/src/api/index.ts
CHANGED
|
@@ -38,6 +38,8 @@ import * as cfdiEndpoints from './cfdi';
|
|
|
38
38
|
import * as cashupsEndpoints from './cashups';
|
|
39
39
|
import { deleteUserById } from "./users/delete";
|
|
40
40
|
import { customersAppChangePassword } from './auth/post';
|
|
41
|
+
import * as partnersEndpoints from './partners';
|
|
42
|
+
import * as outsourcedOrdersEndpoints from './outsourcedOrders';
|
|
41
43
|
|
|
42
44
|
type WashdayClientConstructor = {
|
|
43
45
|
new(apiToken: string): WashdayClientInstance
|
|
@@ -282,6 +284,21 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
282
284
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
283
285
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
284
286
|
});
|
|
287
|
+
this.partners = bindMethods(this, {
|
|
288
|
+
getPartners: partnersEndpoints.getModule.getPartners,
|
|
289
|
+
getPartnerById: partnersEndpoints.getModule.getPartnerById,
|
|
290
|
+
createPartner: partnersEndpoints.postModule.createPartner,
|
|
291
|
+
updatePartnerById: partnersEndpoints.putModule.updatePartnerById,
|
|
292
|
+
deletePartnerById: partnersEndpoints.deleteModule.deletePartnerById,
|
|
293
|
+
});
|
|
294
|
+
this.outsourcedOrders = bindMethods(this, {
|
|
295
|
+
getOutsourcedOrdersByOrder: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder,
|
|
296
|
+
getOutsourcedOrdersByStore: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore,
|
|
297
|
+
getOutsourcedOrderById: outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById,
|
|
298
|
+
createOutsourcedOrder: outsourcedOrdersEndpoints.postModule.createOutsourcedOrder,
|
|
299
|
+
updateOutsourcedOrderById: outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById,
|
|
300
|
+
deleteOutsourcedOrderById: outsourcedOrdersEndpoints.deleteModule.deleteOutsourcedOrderById,
|
|
301
|
+
});
|
|
285
302
|
} as any;
|
|
286
303
|
|
|
287
304
|
export default WashdayClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
|
+
|
|
5
|
+
export const deleteOutsourcedOrderById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
return await axiosInstance.delete(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error('Error fetching deleteOutsourcedOrderById:', error);
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_OUTSOURCED_ORDERS_BY_STORE = 'api/store/:storeId/outsourced-orders'
|
|
5
|
+
const GET_OUTSOURCED_ORDERS_BY_ORDER = 'api/orders/:orderId/outsourced-orders';
|
|
6
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
7
|
+
|
|
8
|
+
export const getOutsourcedOrdersByOrder = async function (this: WashdayClientInstance, orderId: string): Promise<any> {
|
|
9
|
+
try {
|
|
10
|
+
const config = {
|
|
11
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
12
|
+
};
|
|
13
|
+
return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_ORDER.replace(':orderId', orderId)}`, config);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error fetching getOutsourcedOrdersByOrder:', error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const getOutsourcedOrdersByStore = async function (this: WashdayClientInstance, params: {
|
|
21
|
+
storeId: string,
|
|
22
|
+
statuses?: string[],
|
|
23
|
+
page?: number,
|
|
24
|
+
limit?: number,
|
|
25
|
+
}): Promise<any> {
|
|
26
|
+
try {
|
|
27
|
+
const config = {
|
|
28
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
29
|
+
};
|
|
30
|
+
const queryParams = generateQueryParamsStr([
|
|
31
|
+
'statuses',
|
|
32
|
+
'page',
|
|
33
|
+
'limit'
|
|
34
|
+
], params);
|
|
35
|
+
return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Error fetching getOutsourcedOrdersByStore:', error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const getOutsourcedOrderById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
43
|
+
try {
|
|
44
|
+
const config = {
|
|
45
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
46
|
+
};
|
|
47
|
+
return await axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('Error fetching getOutsourcedOrderById:', error);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
|
+
|
|
5
|
+
export const createOutsourcedOrder = async function (this: WashdayClientInstance, data: {
|
|
6
|
+
partner?: string;
|
|
7
|
+
outsourcedStatus?: "pending" | "in_process" | "returned";
|
|
8
|
+
sentDate?: Date;
|
|
9
|
+
receivedDate?: Date;
|
|
10
|
+
externalOrderId?: string;
|
|
11
|
+
order: string;
|
|
12
|
+
orderProduct?: string;
|
|
13
|
+
store: string;
|
|
14
|
+
}): Promise<any> {
|
|
15
|
+
try {
|
|
16
|
+
const config = {
|
|
17
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
|
+
};
|
|
19
|
+
return await axiosInstance.post(GET_SET_OUTSOURCED_ORDERS, data, config);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error('Error fetching createOutsourcedOrder:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
|
+
|
|
5
|
+
export const updateOutsourcedOrderById = async function (this: WashdayClientInstance, id: string, data: {
|
|
6
|
+
partner?: string,
|
|
7
|
+
outsourcedStatus?: "pending" | "in_process" | "returned",
|
|
8
|
+
sentDate?: Date,
|
|
9
|
+
receivedDate?: Date,
|
|
10
|
+
externalOrderId?: string,
|
|
11
|
+
}): Promise<any> {
|
|
12
|
+
try {
|
|
13
|
+
const config = {
|
|
14
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
15
|
+
};
|
|
16
|
+
return await axiosInstance.put(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, data, config);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error fetching updateOutsourcedOrderById:', error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
4
|
+
|
|
5
|
+
export const deletePartnerById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
return await axiosInstance.delete(`${GET_SET_PARTNERS}/${id}`, config);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error('Error fetching deletePartnerById:', error);
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
4
|
+
|
|
5
|
+
export const getPartners = async function (this: WashdayClientInstance): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
//THIS WILL FETCH ALL COMPANY PARTNERS
|
|
8
|
+
const config = {
|
|
9
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
|
+
};
|
|
11
|
+
return await axiosInstance.get(`${GET_SET_PARTNERS}`, config);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching getPartners:', error);
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const getPartnerById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
19
|
+
try {
|
|
20
|
+
const config = {
|
|
21
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
22
|
+
};
|
|
23
|
+
return await axiosInstance.get(`${GET_SET_PARTNERS}/${id}`, config);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error fetching getPartnerById:', error);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { IAddress } from "../../interfaces/Customer";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
5
|
+
|
|
6
|
+
export const createPartner = async function (this: WashdayClientInstance, data: {
|
|
7
|
+
name: string,
|
|
8
|
+
contactEmail?: string,
|
|
9
|
+
contactPhone?: string,
|
|
10
|
+
address?: IAddress
|
|
11
|
+
}): Promise<any> {
|
|
12
|
+
try {
|
|
13
|
+
const config = {
|
|
14
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
15
|
+
};
|
|
16
|
+
return await axiosInstance.post(GET_SET_PARTNERS, data, config);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error fetching createPartner:', error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { IAddress } from "../../interfaces/Customer";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
5
|
+
|
|
6
|
+
export const updatePartnerById = async function (this: WashdayClientInstance, id: string, data: {
|
|
7
|
+
name: string,
|
|
8
|
+
contactEmail?: string,
|
|
9
|
+
contactPhone?: string,
|
|
10
|
+
address?: IAddress
|
|
11
|
+
}): Promise<any> {
|
|
12
|
+
try {
|
|
13
|
+
const config = {
|
|
14
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
15
|
+
};
|
|
16
|
+
return await axiosInstance.put(`${GET_SET_PARTNERS}/${id}`, data, config);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error fetching updatePartnerById:', error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -36,6 +36,8 @@ import * as cfdiEndpoints from '../api/cfdi';
|
|
|
36
36
|
import * as cashupsEndpoints from '../api/cashups';
|
|
37
37
|
import * as authEndpoints from '../api/auth';
|
|
38
38
|
import { deleteUserById } from "../api/users/delete";
|
|
39
|
+
import * as partnersEndpoints from '../api/partners';
|
|
40
|
+
import * as outsourcedOrdersEndpoints from '../api/outsourcedOrders';
|
|
39
41
|
|
|
40
42
|
export interface WashdayClientInstance {
|
|
41
43
|
apiToken: string;
|
|
@@ -263,4 +265,17 @@ export interface WashdayClientInstance {
|
|
|
263
265
|
getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
|
|
264
266
|
getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
|
|
265
267
|
};
|
|
268
|
+
partners: {
|
|
269
|
+
getPartners: typeof partnersEndpoints.getModule.getPartners;
|
|
270
|
+
getPartnerById: typeof partnersEndpoints.getModule.getPartnerById;
|
|
271
|
+
createPartner: typeof partnersEndpoints.postModule.createPartner;
|
|
272
|
+
updatePartnerById: typeof partnersEndpoints.putModule.updatePartnerById;
|
|
273
|
+
};
|
|
274
|
+
outsourcedOrders: {
|
|
275
|
+
getOutsourcedOrdersByOrder: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder;
|
|
276
|
+
getOutsourcedOrdersByStore: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore;
|
|
277
|
+
getOutsourcedOrderById: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById;
|
|
278
|
+
createOutsourcedOrder: typeof outsourcedOrdersEndpoints.postModule.createOutsourcedOrder;
|
|
279
|
+
updateOutsourcedOrderById: typeof outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById;
|
|
280
|
+
};
|
|
266
281
|
}
|