washday-sdk 0.0.65 → 0.0.67
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/index.js +37 -27
- package/dist/api/products/delete.js +48 -0
- package/dist/api/products/get.js +29 -4
- package/dist/api/products/index.js +30 -0
- package/dist/api/products/post.js +47 -4
- package/dist/api/products/put.js +16 -4
- package/dist/api/sections/delete.js +31 -15
- package/dist/api/sections/get.js +18 -3
- package/dist/api/sections/index.js +30 -0
- package/dist/api/sections/post.js +32 -15
- package/dist/api/sections/put.js +31 -15
- package/package.json +1 -1
- package/src/api/index.ts +17 -7
- package/src/api/products/delete.ts +28 -0
- package/src/api/products/get.ts +12 -5
- package/src/api/products/index.ts +4 -0
- package/src/api/products/post.ts +44 -6
- package/src/api/products/put.ts +30 -5
- package/src/api/sections/delete.ts +14 -15
- package/src/api/sections/get.ts +14 -1
- package/src/api/sections/index.ts +4 -0
- package/src/api/sections/post.ts +20 -15
- package/src/api/sections/put.ts +22 -15
- package/src/api/staff/put.ts +1 -1
package/dist/api/index.js
CHANGED
|
@@ -35,22 +35,22 @@ const get_4 = require("./customers/get");
|
|
|
35
35
|
const get_5 = require("./discounts/get");
|
|
36
36
|
const post_3 = require("./discounts/post");
|
|
37
37
|
const put_3 = require("./discounts/put");
|
|
38
|
-
const put_4 = require("./products/put");
|
|
39
|
-
const get_6 = require("./sections/get");
|
|
40
38
|
const delete_2 = require("./staff/delete");
|
|
41
|
-
const
|
|
39
|
+
const get_6 = require("./staff/get");
|
|
42
40
|
const post_4 = require("./staff/post");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
41
|
+
const put_4 = require("./staff/put");
|
|
42
|
+
const get_7 = require("./stores/get");
|
|
45
43
|
const post_5 = require("./stores/post");
|
|
46
|
-
const
|
|
44
|
+
const put_5 = require("./stores/put");
|
|
47
45
|
const post_6 = require("./stripe/post");
|
|
48
46
|
const delete_3 = require("./supplies/delete");
|
|
49
|
-
const
|
|
47
|
+
const get_8 = require("./supplies/get");
|
|
50
48
|
const post_7 = require("./supplies/post");
|
|
51
|
-
const
|
|
52
|
-
const
|
|
49
|
+
const put_6 = require("./supplies/put");
|
|
50
|
+
const put_7 = require("./users/put");
|
|
53
51
|
const inventoryEndpoints = __importStar(require("./inventory"));
|
|
52
|
+
const sectionsEndpoints = __importStar(require("./sections"));
|
|
53
|
+
const productsEndpoints = __importStar(require("./products"));
|
|
54
54
|
const WashdayClient = function WashdayClient(apiToken) {
|
|
55
55
|
this.apiToken = apiToken;
|
|
56
56
|
WashdayClient.prototype.customers.apiToken = apiToken;
|
|
@@ -68,41 +68,51 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
68
68
|
WashdayClient.prototype.supplies.apiToken = apiToken;
|
|
69
69
|
WashdayClient.prototype.inventory.apiToken = apiToken;
|
|
70
70
|
};
|
|
71
|
-
WashdayClient.prototype.sections = {
|
|
72
|
-
getSections: get_6.getSections,
|
|
73
|
-
};
|
|
74
71
|
WashdayClient.prototype.customers = {
|
|
75
72
|
getCustomerById: get_4.getCustomerById,
|
|
76
73
|
getCustomerHighlightsById: get_4.getCustomerHighlightsById
|
|
77
74
|
};
|
|
78
75
|
WashdayClient.prototype.stores = {
|
|
79
|
-
getStores:
|
|
80
|
-
getStoreById:
|
|
76
|
+
getStores: get_7.getStores,
|
|
77
|
+
getStoreById: get_7.getStoreById,
|
|
81
78
|
createStore: post_5.createStore,
|
|
82
79
|
copyStore: post_5.copyStore,
|
|
83
|
-
updateStoreById:
|
|
80
|
+
updateStoreById: put_5.updateStoreById,
|
|
84
81
|
createStoreImage: post_5.createStoreImage,
|
|
85
|
-
getStoreReviewLink:
|
|
86
|
-
deleteStoreById:
|
|
82
|
+
getStoreReviewLink: get_7.getStoreReviewLink,
|
|
83
|
+
deleteStoreById: put_5.deleteStoreById,
|
|
87
84
|
};
|
|
88
85
|
WashdayClient.prototype.products = {
|
|
89
|
-
|
|
86
|
+
getById: productsEndpoints.getModule.getById,
|
|
87
|
+
create: productsEndpoints.postModule.create,
|
|
88
|
+
createProductSupply: productsEndpoints.postModule.createProductSupply,
|
|
89
|
+
deleteById: productsEndpoints.deleteModule.deleteById,
|
|
90
|
+
deleteProductSupplyById: productsEndpoints.deleteModule.deleteProductSupplyById,
|
|
91
|
+
updateById: productsEndpoints.putModule.updateById,
|
|
92
|
+
bulkUpdate: productsEndpoints.putModule.bulkUpdate
|
|
90
93
|
};
|
|
91
94
|
WashdayClient.prototype.users = {
|
|
92
|
-
updateUserById:
|
|
95
|
+
updateUserById: put_7.updateUserById,
|
|
93
96
|
};
|
|
94
97
|
WashdayClient.prototype.countries = {
|
|
95
98
|
getCountries: get_3.getCountries,
|
|
96
99
|
};
|
|
97
100
|
WashdayClient.prototype.supplies = {
|
|
98
|
-
getSupplies:
|
|
99
|
-
getSupplyById:
|
|
100
|
-
getSupplyHistory:
|
|
101
|
+
getSupplies: get_8.getSupplies,
|
|
102
|
+
getSupplyById: get_8.getSupplyById,
|
|
103
|
+
getSupplyHistory: get_8.getSupplyHistory,
|
|
101
104
|
createSupply: post_7.createSupply,
|
|
102
|
-
updateSupplyById:
|
|
103
|
-
addSupplyStock:
|
|
105
|
+
updateSupplyById: put_6.updateSupplyById,
|
|
106
|
+
addSupplyStock: put_6.addSupplyStock,
|
|
104
107
|
deleteSupplyById: delete_3.deleteSupplyById,
|
|
105
108
|
};
|
|
109
|
+
WashdayClient.prototype.sections = {
|
|
110
|
+
getSections: sectionsEndpoints.getModule.getList,
|
|
111
|
+
getById: sectionsEndpoints.getModule.getById,
|
|
112
|
+
create: sectionsEndpoints.postModule.create,
|
|
113
|
+
deleteById: sectionsEndpoints.deleteModule.deleteById,
|
|
114
|
+
updateById: sectionsEndpoints.putModule.updateById,
|
|
115
|
+
};
|
|
106
116
|
WashdayClient.prototype.inventory = {
|
|
107
117
|
getInventory: inventoryEndpoints.getModule.getInventory,
|
|
108
118
|
getById: inventoryEndpoints.getModule.getInventoryById,
|
|
@@ -135,9 +145,9 @@ WashdayClient.prototype.stripe = {
|
|
|
135
145
|
createCustomerPortalSession: post_6.createCustomerPortalSession
|
|
136
146
|
};
|
|
137
147
|
WashdayClient.prototype.staff = {
|
|
138
|
-
getStoreStaff:
|
|
139
|
-
getStoreStaffById:
|
|
140
|
-
updateStoreStaffById:
|
|
148
|
+
getStoreStaff: get_6.getStoreStaff,
|
|
149
|
+
getStoreStaffById: get_6.getStoreStaffById,
|
|
150
|
+
updateStoreStaffById: put_4.updateStoreStaffById,
|
|
141
151
|
createStoreStaff: post_4.createStoreStaff,
|
|
142
152
|
deleteStoreStaffById: delete_2.deleteStoreStaffById,
|
|
143
153
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.deleteProductSupplyById = exports.deleteById = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
18
|
+
const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
|
|
19
|
+
const deleteById = function (id) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const config = {
|
|
23
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
24
|
+
};
|
|
25
|
+
return yield axiosInstance_1.default.delete(`${GET_SET_PRODUCTS}/${id}`, config);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Error fetching deleteById:', error);
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.deleteById = deleteById;
|
|
34
|
+
const deleteProductSupplyById = function (id, productSupplyId) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
|
+
};
|
|
40
|
+
return yield axiosInstance_1.default.delete(`${GET_SET_PRODUCTS_SUPPLY}/${id}/${productSupplyId}`, config);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error fetching deleteProductSupplyById:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.deleteProductSupplyById = deleteProductSupplyById;
|
package/dist/api/products/get.js
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
15
|
+
exports.getById = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
18
|
+
const getById = function (id) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
|
+
};
|
|
24
|
+
return yield axiosInstance_1.default.get(`${GET_SET_PRODUCTS}/${id}`, config);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Error fetching getById:', error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
7
31
|
};
|
|
32
|
+
exports.getById = getById;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.putModule = exports.postModule = exports.getModule = exports.deleteModule = void 0;
|
|
27
|
+
exports.deleteModule = __importStar(require("./delete"));
|
|
28
|
+
exports.getModule = __importStar(require("./get"));
|
|
29
|
+
exports.postModule = __importStar(require("./post"));
|
|
30
|
+
exports.putModule = __importStar(require("./put"));
|
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
15
|
+
exports.createProductSupply = exports.create = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
|
|
18
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
19
|
+
const create = function (data) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const config = {
|
|
23
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
24
|
+
};
|
|
25
|
+
const response = yield axiosInstance_1.default.post(`${GET_SET_PRODUCTS}`, data, config);
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching create:', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
exports.create = create;
|
|
35
|
+
const createProductSupply = function (id, data) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
try {
|
|
38
|
+
const config = {
|
|
39
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
40
|
+
};
|
|
41
|
+
const response = yield axiosInstance_1.default.post(`${GET_SET_PRODUCTS_SUPPLY}/${id}`, data, config);
|
|
42
|
+
return response;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('Error fetching createProductSupply:', error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
7
49
|
};
|
|
50
|
+
exports.createProductSupply = createProductSupply;
|
package/dist/api/products/put.js
CHANGED
|
@@ -12,12 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.bulkUpdate = void 0;
|
|
15
|
+
exports.updateById = exports.bulkUpdate = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
17
|
const GET_SET_PRODUCTS = 'api/product';
|
|
18
|
-
const REQUEST_PARAMS = {
|
|
19
|
-
token: 'LOGGED_USER_TOKEN',
|
|
20
|
-
};
|
|
21
18
|
const bulkUpdate = function (storeId, data) {
|
|
22
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
20
|
try {
|
|
@@ -34,3 +31,18 @@ const bulkUpdate = function (storeId, data) {
|
|
|
34
31
|
});
|
|
35
32
|
};
|
|
36
33
|
exports.bulkUpdate = bulkUpdate;
|
|
34
|
+
const updateById = function (id, data) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
|
+
};
|
|
40
|
+
return yield axiosInstance_1.default.put(`${GET_SET_PRODUCTS}/${id}`, data, config);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error fetching updateById:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.updateById = updateById;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.deleteById = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_SECTIONS = 'api/section';
|
|
18
|
+
const deleteById = function (id) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
|
+
};
|
|
24
|
+
return yield axiosInstance_1.default.delete(`${GET_SET_SECTIONS}/${id}`, config);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Error fetching deleteById:', error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.deleteById = deleteById;
|
package/dist/api/sections/get.js
CHANGED
|
@@ -12,10 +12,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.getById = exports.getList = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
17
|
const GET_SET_SECTIONS = 'api/section';
|
|
18
|
-
const
|
|
18
|
+
const getList = function (params) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
try {
|
|
21
21
|
const config = {
|
|
@@ -42,4 +42,19 @@ const getSections = function (params) {
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
exports.
|
|
45
|
+
exports.getList = getList;
|
|
46
|
+
const getById = function (id) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
try {
|
|
49
|
+
const config = {
|
|
50
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
51
|
+
};
|
|
52
|
+
return yield axiosInstance_1.default.get(`${GET_SET_SECTIONS}/${id}`, config);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.error('Error fetching getSectionById:', error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
exports.getById = getById;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.putModule = exports.postModule = exports.getModule = exports.deleteModule = void 0;
|
|
27
|
+
exports.deleteModule = __importStar(require("./delete"));
|
|
28
|
+
exports.getModule = __importStar(require("./get"));
|
|
29
|
+
exports.postModule = __importStar(require("./post"));
|
|
30
|
+
exports.putModule = __importStar(require("./put"));
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.create = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_SECTIONS = 'api/section';
|
|
18
|
+
const create = function (data) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
|
+
};
|
|
24
|
+
const response = yield axiosInstance_1.default.post(`${GET_SET_SECTIONS}`, data, config);
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Error fetching create:', error);
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.create = create;
|
package/dist/api/sections/put.js
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.updateById = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_SECTIONS = 'api/section';
|
|
18
|
+
const updateById = function (id, data) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
|
+
};
|
|
24
|
+
return yield axiosInstance_1.default.put(`${GET_SET_SECTIONS}/${id}`, data, config);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Error fetching updateById:', error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.updateById = updateById;
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -11,8 +11,6 @@ import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
|
|
|
11
11
|
import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
|
|
12
12
|
import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
|
|
13
13
|
import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
|
|
14
|
-
import { bulkUpdate } from "./products/put";
|
|
15
|
-
import { getSections } from "./sections/get";
|
|
16
14
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
17
15
|
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
18
16
|
import { createStoreStaff } from "./staff/post";
|
|
@@ -27,6 +25,8 @@ import { createSupply } from "./supplies/post";
|
|
|
27
25
|
import { addSupplyStock, updateSupplyById } from "./supplies/put";
|
|
28
26
|
import { updateUserById } from "./users/put";
|
|
29
27
|
import * as inventoryEndpoints from './inventory';
|
|
28
|
+
import * as sectionsEndpoints from './sections';
|
|
29
|
+
import * as productsEndpoints from './products';
|
|
30
30
|
|
|
31
31
|
type WashdayClientConstructor = {
|
|
32
32
|
new(apiToken: string): {
|
|
@@ -52,10 +52,6 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
52
52
|
WashdayClient.prototype.inventory.apiToken = apiToken;
|
|
53
53
|
} as any;
|
|
54
54
|
|
|
55
|
-
WashdayClient.prototype.sections = {
|
|
56
|
-
getSections: getSections,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
55
|
WashdayClient.prototype.customers = {
|
|
60
56
|
getCustomerById: getCustomerById,
|
|
61
57
|
getCustomerHighlightsById: getCustomerHighlightsById
|
|
@@ -74,7 +70,13 @@ WashdayClient.prototype.stores = {
|
|
|
74
70
|
|
|
75
71
|
|
|
76
72
|
WashdayClient.prototype.products = {
|
|
77
|
-
|
|
73
|
+
getById: productsEndpoints.getModule.getById,
|
|
74
|
+
create: productsEndpoints.postModule.create,
|
|
75
|
+
createProductSupply: productsEndpoints.postModule.createProductSupply,
|
|
76
|
+
deleteById: productsEndpoints.deleteModule.deleteById,
|
|
77
|
+
deleteProductSupplyById: productsEndpoints.deleteModule.deleteProductSupplyById,
|
|
78
|
+
updateById: productsEndpoints.putModule.updateById,
|
|
79
|
+
bulkUpdate: productsEndpoints.putModule.bulkUpdate
|
|
78
80
|
};
|
|
79
81
|
|
|
80
82
|
WashdayClient.prototype.users = {
|
|
@@ -95,6 +97,14 @@ WashdayClient.prototype.supplies = {
|
|
|
95
97
|
deleteSupplyById: deleteSupplyById,
|
|
96
98
|
};
|
|
97
99
|
|
|
100
|
+
WashdayClient.prototype.sections = {
|
|
101
|
+
getSections: sectionsEndpoints.getModule.getList,
|
|
102
|
+
getById: sectionsEndpoints.getModule.getById,
|
|
103
|
+
create: sectionsEndpoints.postModule.create,
|
|
104
|
+
deleteById: sectionsEndpoints.deleteModule.deleteById,
|
|
105
|
+
updateById: sectionsEndpoints.putModule.updateById,
|
|
106
|
+
};
|
|
107
|
+
|
|
98
108
|
WashdayClient.prototype.inventory = {
|
|
99
109
|
getInventory: inventoryEndpoints.getModule.getInventory,
|
|
100
110
|
getById: inventoryEndpoints.getModule.getInventoryById,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
4
|
+
const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
|
|
5
|
+
|
|
6
|
+
export const deleteById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
7
|
+
try {
|
|
8
|
+
const config = {
|
|
9
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
|
+
};
|
|
11
|
+
return await axiosInstance.delete(`${GET_SET_PRODUCTS}/${id}`, config);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching deleteById:', error);
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const deleteProductSupplyById = async function (this: WashdayClientInstance, id: string, productSupplyId: string): Promise<any> {
|
|
19
|
+
try {
|
|
20
|
+
const config = {
|
|
21
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
22
|
+
};
|
|
23
|
+
return await axiosInstance.delete(`${GET_SET_PRODUCTS_SUPPLY}/${id}/${productSupplyId}`, config);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error fetching deleteProductSupplyById:', error);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
};
|
package/src/api/products/get.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import { IStore } from "../../interfaces/Store";
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
6
|
+
export const getById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
7
|
+
try {
|
|
8
|
+
const config = {
|
|
9
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
|
+
};
|
|
11
|
+
return await axiosInstance.get(`${GET_SET_PRODUCTS}/${id}`, config);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching getById:', error);
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
package/src/api/products/post.ts
CHANGED
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
-
import { IStore } from "../../interfaces/Store";
|
|
3
2
|
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
|
|
4
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export const create = async function (this: WashdayClientInstance, data: {
|
|
7
|
+
name: string;
|
|
8
|
+
price: number;
|
|
9
|
+
expressPrice: number;
|
|
10
|
+
type: 'normal' | 'weight';
|
|
11
|
+
pieces: number;
|
|
12
|
+
sku?: string;
|
|
13
|
+
overlayText: string;
|
|
14
|
+
order: number;
|
|
15
|
+
taxExemptOne: boolean;
|
|
16
|
+
taxExemptTwo: boolean;
|
|
17
|
+
taxExemptThree: boolean;
|
|
18
|
+
showInApp: boolean;
|
|
19
|
+
image: string;
|
|
20
|
+
store: string; //this is used to valdate product limit creation of store(we might remove it later and validate by token getting company and store id using section id)
|
|
21
|
+
section: string;
|
|
22
|
+
}): Promise<any> {
|
|
23
|
+
try {
|
|
24
|
+
const config = {
|
|
25
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
26
|
+
};
|
|
27
|
+
const response = await axiosInstance.post(`${GET_SET_PRODUCTS}`, data, config);
|
|
28
|
+
return response;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error('Error fetching create:', error);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
10
33
|
};
|
|
11
34
|
|
|
35
|
+
export const createProductSupply = async function (this: WashdayClientInstance, id: string, data: {
|
|
36
|
+
supplyId: string;
|
|
37
|
+
usageAmount: number;
|
|
38
|
+
}): Promise<any> {
|
|
39
|
+
try {
|
|
40
|
+
const config = {
|
|
41
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
42
|
+
};
|
|
43
|
+
const response = await axiosInstance.post(`${GET_SET_PRODUCTS_SUPPLY}/${id}`, data, config);
|
|
44
|
+
return response;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Error fetching createProductSupply:', error);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
};
|
package/src/api/products/put.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
-
import { IStore } from "../../interfaces/Store";
|
|
3
2
|
import axiosInstance from "../axiosInstance";
|
|
4
3
|
const GET_SET_PRODUCTS = 'api/product';
|
|
5
|
-
const REQUEST_PARAMS = {
|
|
6
|
-
token: 'LOGGED_USER_TOKEN',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
4
|
|
|
10
5
|
export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
11
6
|
try {
|
|
@@ -19,3 +14,33 @@ export const bulkUpdate = async function (this: WashdayClientInstance, storeId:
|
|
|
19
14
|
throw error;
|
|
20
15
|
}
|
|
21
16
|
};
|
|
17
|
+
|
|
18
|
+
export const updateById = async function (this: WashdayClientInstance, id: string, data: {
|
|
19
|
+
name?: string;
|
|
20
|
+
price?: number;
|
|
21
|
+
expressPrice?: number;
|
|
22
|
+
type?: 'normal' | 'weight';
|
|
23
|
+
pieces?: number;
|
|
24
|
+
sku?: string;
|
|
25
|
+
overlayText?: string;
|
|
26
|
+
order?: number;
|
|
27
|
+
taxExemptOne?: boolean;
|
|
28
|
+
taxExemptTwo?: boolean;
|
|
29
|
+
taxExemptThree?: boolean;
|
|
30
|
+
showInApp?: boolean;
|
|
31
|
+
image?: string;
|
|
32
|
+
invoice_product_key?: string,
|
|
33
|
+
invoice_description?: string,
|
|
34
|
+
invoice_product_unit_key?: string
|
|
35
|
+
invoice_product_unit_name?: string
|
|
36
|
+
}): Promise<any> {
|
|
37
|
+
try {
|
|
38
|
+
const config = {
|
|
39
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
40
|
+
};
|
|
41
|
+
return await axiosInstance.put(`${GET_SET_PRODUCTS}/${id}`, data, config);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Error fetching updateById:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_SECTIONS = 'api/section';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// };
|
|
5
|
+
export const deleteById = 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_SECTIONS}/${id}`, config);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error('Error fetching deleteById:', error);
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|
package/src/api/sections/get.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { ISection } from "../../interfaces/Section";
|
|
2
3
|
import axiosInstance from "../axiosInstance";
|
|
3
4
|
|
|
4
5
|
const GET_SET_SECTIONS = 'api/section';
|
|
5
6
|
|
|
6
|
-
export const
|
|
7
|
+
export const getList = async function (this: WashdayClientInstance, params?: {
|
|
7
8
|
storeId?: string
|
|
8
9
|
isActive?: string
|
|
9
10
|
products?: boolean
|
|
@@ -30,4 +31,16 @@ export const getSections = async function (this: WashdayClientInstance, params?:
|
|
|
30
31
|
console.error('Error fetching getStoreStaff:', error);
|
|
31
32
|
throw error;
|
|
32
33
|
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const getById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
37
|
+
try {
|
|
38
|
+
const config = {
|
|
39
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
40
|
+
};
|
|
41
|
+
return await axiosInstance.get(`${GET_SET_SECTIONS}/${id}`, config);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Error fetching getSectionById:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
33
46
|
};
|
package/src/api/sections/post.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const GET_SET_SECTIONS = 'api/section';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
export const create = async function (this: WashdayClientInstance, data: {
|
|
7
|
+
name: string;
|
|
8
|
+
order: number;
|
|
9
|
+
boxColor: string;
|
|
10
|
+
store: string;
|
|
11
|
+
}): Promise<any> {
|
|
12
|
+
try {
|
|
13
|
+
const config = {
|
|
14
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
15
|
+
};
|
|
16
|
+
const response = await axiosInstance.post(`${GET_SET_SECTIONS}`, data, config);
|
|
17
|
+
return response;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error('Error fetching create:', error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
};
|
package/src/api/sections/put.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
|
|
4
|
+
const GET_SET_SECTIONS = 'api/section';
|
|
5
|
+
|
|
6
|
+
export const updateById = async function (this: WashdayClientInstance, id: string, data: {
|
|
7
|
+
name?: string;
|
|
8
|
+
order?: number;
|
|
9
|
+
boxColor?: string;
|
|
10
|
+
showInApp?: boolean,
|
|
11
|
+
product?: any
|
|
12
|
+
}): Promise<any> {
|
|
13
|
+
try {
|
|
14
|
+
const config = {
|
|
15
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
16
|
+
};
|
|
17
|
+
return await axiosInstance.put(`${GET_SET_SECTIONS}/${id}`, data, config);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error('Error fetching updateById:', error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
4
23
|
|
|
5
|
-
// export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string, data: IStore): Promise<any> {
|
|
6
|
-
// try {
|
|
7
|
-
// const config = {
|
|
8
|
-
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
-
// };
|
|
10
|
-
// const response = await axiosInstance.put(`api/store/${storeId}/staff/${staffId}`, data, config);
|
|
11
|
-
// return response;
|
|
12
|
-
// } catch (error) {
|
|
13
|
-
// console.error('Error fetching getStoreById:', error);
|
|
14
|
-
// throw error;
|
|
15
|
-
// }
|
|
16
|
-
// };
|
package/src/api/staff/put.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IStore } from "../../interfaces/Store";
|
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
4
|
const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
|
|
5
5
|
|
|
6
|
-
export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string, data:
|
|
6
|
+
export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string, data: any): Promise<any> {
|
|
7
7
|
try {
|
|
8
8
|
const config = {
|
|
9
9
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|