@longvansoftware/service-js-client 2.6.1 → 2.6.3
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/src/graphql/auth/queries.d.ts +3 -0
- package/dist/src/graphql/auth/queries.js +52 -1
- package/dist/src/graphql/campaign/mutations.d.ts +1 -0
- package/dist/src/graphql/campaign/mutations.js +34 -0
- package/dist/src/graphql/campaign/queries.d.ts +11 -0
- package/dist/src/graphql/campaign/queries.js +496 -0
- package/dist/src/graphql/cashbook/queries.d.ts +2 -0
- package/dist/src/graphql/cashbook/queries.js +99 -0
- package/dist/src/graphql/cloudCloud/mutations.d.ts +3 -0
- package/dist/src/graphql/cloudCloud/mutations.js +41 -0
- package/dist/src/graphql/cloudCloud/queries.d.ts +5 -0
- package/dist/src/graphql/cloudCloud/queries.js +185 -0
- package/dist/src/graphql/orderCloud/mutations.d.ts +1 -0
- package/dist/src/graphql/orderCloud/mutations.js +12 -0
- package/dist/src/graphql/orderCloud/queries.d.ts +1 -0
- package/dist/src/graphql/orderCloud/queries.js +12 -0
- package/dist/src/graphql/paymentV2/mutations.d.ts +5 -0
- package/dist/src/graphql/paymentV2/mutations.js +124 -0
- package/dist/src/graphql/paymentV2/queries.d.ts +10 -0
- package/dist/src/graphql/paymentV2/queries.js +277 -0
- package/dist/src/graphql/storage_s3/mutations.d.ts +5 -0
- package/dist/src/graphql/storage_s3/mutations.js +114 -2
- package/dist/src/graphql/storage_s3/queries.d.ts +6 -0
- package/dist/src/graphql/storage_s3/queries.js +74 -2
- package/dist/src/graphql/store/mutations.d.ts +1 -0
- package/dist/src/graphql/store/mutations.js +29 -0
- package/dist/src/graphql/store/queries.d.ts +1 -0
- package/dist/src/graphql/store/queries.js +29 -0
- package/dist/src/graphql/truedoc/queries.d.ts +1 -0
- package/dist/src/graphql/truedoc/queries.js +18 -0
- package/dist/src/graphql/user/mutations.d.ts +13 -11
- package/dist/src/graphql/user/mutations.js +12 -1
- package/dist/src/lib/accounting/index.d.ts +5 -0
- package/dist/src/lib/accounting/index.js +32 -0
- package/dist/src/lib/auth/index.d.ts +11 -0
- package/dist/src/lib/auth/index.js +89 -3
- package/dist/src/lib/campaign/index.d.ts +22 -0
- package/dist/src/lib/campaign/index.js +252 -0
- package/dist/src/lib/cashbook/index.d.ts +6 -0
- package/dist/src/lib/cashbook/index.js +56 -0
- package/dist/src/lib/cloudCloud/index.d.ts +12 -0
- package/dist/src/lib/cloudCloud/index.js +142 -0
- package/dist/src/lib/comhub/index.d.ts +6 -0
- package/dist/src/lib/comhub/index.js +50 -0
- package/dist/src/lib/deepLinkVietQr/index.d.ts +7 -0
- package/dist/src/lib/deepLinkVietQr/index.js +58 -0
- package/dist/src/lib/fileService/index.d.ts +34 -0
- package/dist/src/lib/fileService/index.js +80 -0
- package/dist/src/lib/getImage/index.d.ts +4 -0
- package/dist/src/lib/getImage/index.js +10 -0
- package/dist/src/lib/image/index.d.ts +7 -0
- package/dist/src/lib/image/index.js +49 -0
- package/dist/src/lib/omnigateway/index.d.ts +7 -0
- package/dist/src/lib/omnigateway/index.js +58 -0
- package/dist/src/lib/orderCloud/index.d.ts +5 -0
- package/dist/src/lib/orderCloud/index.js +37 -0
- package/dist/src/lib/paymentV2/index.d.ts +19 -0
- package/dist/src/lib/paymentV2/index.js +264 -0
- package/dist/src/lib/portal/index.d.ts +33 -0
- package/dist/src/lib/portal/index.js +456 -0
- package/dist/src/lib/storage_s3/index.d.ts +11 -0
- package/dist/src/lib/storage_s3/index.js +201 -0
- package/dist/src/lib/store/index.d.ts +30 -0
- package/dist/src/lib/store/index.js +74 -0
- package/dist/src/lib/token/index.d.ts +5 -0
- package/dist/src/lib/token/index.js +32 -0
- package/dist/src/lib/truedoc/index.d.ts +5 -0
- package/dist/src/lib/truedoc/index.js +35 -0
- package/dist/src/lib/upload/index.d.ts +5 -0
- package/dist/src/lib/upload/index.js +35 -0
- package/dist/src/lib/user/index.d.ts +1 -0
- package/dist/src/lib/user/index.js +20 -0
- package/dist/src/lib/warehouseV2/index.d.ts +13 -0
- package/dist/src/lib/warehouseV2/index.js +54 -0
- package/dist/src/lib/zca/index.d.ts +12 -0
- package/dist/src/lib/zca/index.js +41 -0
- package/dist/src/types/campaign.d.ts +14 -0
- package/dist/src/types/campaign.js +2 -0
- package/dist/src/types/invoice.d.ts +14 -0
- package/dist/src/types/invoice.js +2 -0
- package/dist/src/types/portal.d.ts +7 -0
- package/dist/src/types/portal.js +2 -0
- package/dist/src/types/store.d.ts +158 -0
- package/dist/src/types/store.js +3 -0
- package/dist/src/utils/validatePhoneNumber.d.ts +1 -0
- package/dist/src/utils/validatePhoneNumber.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,456 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PortalService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
class PortalService extends serviceSDK_1.Service {
|
|
15
|
+
constructor(endpoint, orgId, storeId) {
|
|
16
|
+
super(endpoint, orgId, storeId);
|
|
17
|
+
}
|
|
18
|
+
// GET
|
|
19
|
+
getDynamicForm(dataRequest) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const endpoint = `/dynamic-collection/public/v2/formApi/F.diaries`;
|
|
22
|
+
const method = "POST";
|
|
23
|
+
try {
|
|
24
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequest);
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// POST
|
|
33
|
+
updateDynamicForm(dataRequest) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const endpoint = `/dynamic-collection/public/v2/formApi/F.diaries`;
|
|
36
|
+
const method = "PUT";
|
|
37
|
+
try {
|
|
38
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequest);
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// TAG-order
|
|
47
|
+
//Create- tag
|
|
48
|
+
createTag(title, createBy, partnerId) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const endpoint = `/tag-api/public/tag-core/tag/create?title=${title}&createBy=${createBy}&partnerId=${this.orgId}`;
|
|
51
|
+
const method = "POST";
|
|
52
|
+
try {
|
|
53
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
54
|
+
return response;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// search tag
|
|
62
|
+
searchTag(partnerId, title, id, search) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const endpoint = `/tag-api/public/tag-core/tag/get?partnerId=${this.orgId}&title=${title}&id=${id}&search=${search}`;
|
|
65
|
+
const method = "GET";
|
|
66
|
+
try {
|
|
67
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//
|
|
76
|
+
redirectLink(sku, id) {
|
|
77
|
+
const url = `${this.endpoint}/facility/manager/session/inventory-item-by-product.xhtml?${sku ? `sku=${sku}` : `id=${id}`}&orgId=${this.orgId}`;
|
|
78
|
+
return url;
|
|
79
|
+
}
|
|
80
|
+
imageProduct(parentId, parentType, width, height) {
|
|
81
|
+
const url = `${this.endpoint}/image-gateway/public/image/${parentType}/${parentId}${width ? `?w=${width}` : ``}${`${height ? `&h=${height}` : ``}`} `;
|
|
82
|
+
return url;
|
|
83
|
+
}
|
|
84
|
+
imagesProduct(parentId, parentType, width, height) {
|
|
85
|
+
const url = `${this.endpoint}/image-gateway/public/images/${parentType}/${parentId}?w=${width}&h=${height}`;
|
|
86
|
+
return url;
|
|
87
|
+
}
|
|
88
|
+
completeOrder(orderId, byUser) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/complete-fulfillment/${byUser}`;
|
|
91
|
+
const method = "PUT";
|
|
92
|
+
try {
|
|
93
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
pushMessage(message) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const endpoint = `/dynamic-collection/public/v2/webhook/push_message`;
|
|
104
|
+
const method = "POST";
|
|
105
|
+
console.log("endpoint", endpoint);
|
|
106
|
+
const data = message;
|
|
107
|
+
try {
|
|
108
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, message);
|
|
109
|
+
return response;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
confirmExport(orderId, updateBy) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/confirm-export/${updateBy}`;
|
|
119
|
+
const method = "PUT";
|
|
120
|
+
try {
|
|
121
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
122
|
+
return response;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
confirmPackage(orderId, packageBoxId, byUser) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/confirm-package/${packageBoxId}/${byUser}`;
|
|
132
|
+
const method = "PUT";
|
|
133
|
+
try {
|
|
134
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
135
|
+
return response;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
handlePackage(orderId, byUser) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/handle-package/${byUser}`;
|
|
145
|
+
const method = "PUT";
|
|
146
|
+
try {
|
|
147
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
148
|
+
return response;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
packageBoxes() {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/packageBoxes`;
|
|
158
|
+
const method = "GET";
|
|
159
|
+
try {
|
|
160
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
161
|
+
return response;
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
shipmentParameter(orderId) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/shipment-parameters`;
|
|
171
|
+
const method = "GET";
|
|
172
|
+
try {
|
|
173
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
174
|
+
return response;
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
connectShipment(orderId, byUser, pickupType, trackingCode) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/connect-shipment/${byUser}?pickupType=${pickupType}`;
|
|
184
|
+
const method = "POST";
|
|
185
|
+
const dataBody = {
|
|
186
|
+
trackingCode,
|
|
187
|
+
};
|
|
188
|
+
try {
|
|
189
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, dataBody);
|
|
190
|
+
return response;
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
ffmStage(orderId) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/fulfillment-stage`;
|
|
200
|
+
const method = "GET";
|
|
201
|
+
try {
|
|
202
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
203
|
+
return response;
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
completeCancelFFMOrder(orderId, note, reason) {
|
|
211
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
const endpoint = `/fulfillment-api/public/fulfillment/FOX/${orderId}/completeCancelOrder`;
|
|
213
|
+
const method = "PUT";
|
|
214
|
+
const reqData = {
|
|
215
|
+
note: note,
|
|
216
|
+
reason: reason,
|
|
217
|
+
};
|
|
218
|
+
try {
|
|
219
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, reqData);
|
|
220
|
+
return response;
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
throw error;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
// save text editor
|
|
228
|
+
saveTextEditor(saveTextEditor) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
const method = "POST";
|
|
231
|
+
const endpoint = `/content/public/rich-text-editor/save`;
|
|
232
|
+
try {
|
|
233
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, saveTextEditor);
|
|
234
|
+
return response;
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
getContent(type, relativeId) {
|
|
242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
const method = "GET";
|
|
244
|
+
const endpoint = `/content/public/rich-text-editor/contentCurrent/${type}/${relativeId}`;
|
|
245
|
+
try {
|
|
246
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
247
|
+
return response;
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
getCalendarStudent(studentId, classId, startDate, endDate) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
+
const method = "GET";
|
|
257
|
+
// Gom tất cả tham số vào object
|
|
258
|
+
const params = {
|
|
259
|
+
studentId,
|
|
260
|
+
classId,
|
|
261
|
+
startDate,
|
|
262
|
+
endDate,
|
|
263
|
+
};
|
|
264
|
+
// Lọc ra những tham số có giá trị
|
|
265
|
+
const query = Object.entries(params)
|
|
266
|
+
.filter(([_, value]) => value !== undefined && value !== null && value !== "")
|
|
267
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
268
|
+
.join("&");
|
|
269
|
+
const endpoint = `/dynamic-collection/public/v2/schedule/lesson/${this.orgId}${query ? `?${query}` : ""}`;
|
|
270
|
+
try {
|
|
271
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
272
|
+
return response;
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
getClass(studentId) {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
281
|
+
const method = "GET";
|
|
282
|
+
const baseUrl = `/dynamic-collection/public/v2/schedule/classSection/${this.orgId}`;
|
|
283
|
+
const params = new URLSearchParams();
|
|
284
|
+
if (studentId)
|
|
285
|
+
params.append("studentId", studentId);
|
|
286
|
+
const endpoint = params.toString() ? `${baseUrl}?${params}` : baseUrl;
|
|
287
|
+
try {
|
|
288
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
289
|
+
return response;
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
getMenus(menuId) {
|
|
297
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
const endpoint = `/content/public/menu/${menuId}`;
|
|
299
|
+
const method = "GET";
|
|
300
|
+
try {
|
|
301
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
302
|
+
return response;
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
throw error;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
getBooking(query) {
|
|
310
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
311
|
+
const method = "GET";
|
|
312
|
+
const baseUrl = `/dynamic-collection/public/v2/examination`;
|
|
313
|
+
const params = new URLSearchParams();
|
|
314
|
+
if (query) {
|
|
315
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
316
|
+
if (value !== undefined && value !== null) {
|
|
317
|
+
params.append(key, String(value));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
const endpoint = params.toString()
|
|
322
|
+
? `${baseUrl}?${params.toString()}`
|
|
323
|
+
: baseUrl;
|
|
324
|
+
try {
|
|
325
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
326
|
+
return response;
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
throw error;
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
bookingSchedule(data) {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
const method = "POST";
|
|
336
|
+
const endpoint = `/dynamic-collection/public/v2/schedule/actionBooking`;
|
|
337
|
+
try {
|
|
338
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, data);
|
|
339
|
+
return response;
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
getWorkSchedule(orgId, query) {
|
|
347
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
348
|
+
const method = "GET";
|
|
349
|
+
const baseUrl = `/dynamic-collection/public/v2/schedule/work/visit/${orgId}`;
|
|
350
|
+
const params = new URLSearchParams();
|
|
351
|
+
if (query) {
|
|
352
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
353
|
+
if (value !== undefined && value !== null) {
|
|
354
|
+
params.append(key, String(value));
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
const endpoint = params.toString()
|
|
359
|
+
? `${baseUrl}?${params.toString()}`
|
|
360
|
+
: baseUrl;
|
|
361
|
+
try {
|
|
362
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
363
|
+
return response;
|
|
364
|
+
}
|
|
365
|
+
catch (error) {
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
updateSchedule(orgId, data) {
|
|
371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
const method = "POST";
|
|
373
|
+
const endpoint = `/dynamic-collection/public/v2/schedule/actionBooking`;
|
|
374
|
+
try {
|
|
375
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, data);
|
|
376
|
+
return response;
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
getPosition(query) {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
const method = "GET";
|
|
386
|
+
const baseUrl = `/dynamic-collection/public/v2/records/POSITION/danh_sach_vi_tri`;
|
|
387
|
+
const params = new URLSearchParams();
|
|
388
|
+
if (query) {
|
|
389
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
390
|
+
if (value !== undefined && value !== null) {
|
|
391
|
+
params.append(key, String(value));
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
const endpoint = params.toString()
|
|
396
|
+
? `${baseUrl}?${params.toString()}`
|
|
397
|
+
: baseUrl;
|
|
398
|
+
try {
|
|
399
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
400
|
+
return response;
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
throw error;
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
getPositionForTime(query) {
|
|
408
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
409
|
+
const method = "GET";
|
|
410
|
+
const baseUrl = `/dynamic-collection/public/v2/visit/slot`;
|
|
411
|
+
const params = new URLSearchParams();
|
|
412
|
+
if (query) {
|
|
413
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
414
|
+
if (value !== undefined && value !== null) {
|
|
415
|
+
params.append(key, String(value));
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
const endpoint = params.toString()
|
|
420
|
+
? `${baseUrl}?${params.toString()}`
|
|
421
|
+
: baseUrl;
|
|
422
|
+
try {
|
|
423
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
424
|
+
return response;
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
throw error;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
getBookingCount(query) {
|
|
432
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
const method = "GET";
|
|
434
|
+
const baseUrl = `/dynamic-collection/public/v2/countBooking`;
|
|
435
|
+
const params = new URLSearchParams();
|
|
436
|
+
if (query) {
|
|
437
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
438
|
+
if (value !== undefined && value !== null) {
|
|
439
|
+
params.append(key, String(value));
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
const endpoint = params.toString()
|
|
444
|
+
? `${baseUrl}?${params.toString()}`
|
|
445
|
+
: baseUrl;
|
|
446
|
+
try {
|
|
447
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
448
|
+
return response;
|
|
449
|
+
}
|
|
450
|
+
catch (error) {
|
|
451
|
+
throw error;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
exports.PortalService = PortalService;
|
|
@@ -39,4 +39,15 @@ export declare class StorageS3Service extends Service {
|
|
|
39
39
|
chartInYear(s3UserId: string, year: number, month: number, serviceId: string, fields: string[]): Promise<any>;
|
|
40
40
|
getIPConsul(userId: string, serviceId: string): Promise<any>;
|
|
41
41
|
filterListObject(s3UserId: string, bucketId: string, maxKeys: number, key: string, prefixSearch: string, continuationToken: string, serviceId: string, fields: string[]): Promise<any>;
|
|
42
|
+
getListSubUser(serviceId: string, s3UserId: string, fields: string[]): Promise<any>;
|
|
43
|
+
createSubUser(serviceId: string, s3UserId: string, subUserName: string, subUserPermission: string, fields: string[]): Promise<any>;
|
|
44
|
+
updateSubUserPermission(serviceId: string, s3UserId: string, subUserId: string, subUserPermission: string, fields: string[]): Promise<any>;
|
|
45
|
+
removeSubUser(serviceId: string, s3UserId: string, subUserId: string, fields: string[]): Promise<any>;
|
|
46
|
+
getListPermissionSubUser(serviceId: string, s3UserId: string, fields: string[]): Promise<any>;
|
|
47
|
+
getBucketPolicy(serviceId: string, s3UserId: string, bucketId: string, fields: string[]): Promise<any>;
|
|
48
|
+
updateBucketPolicy(serviceId: string, s3UserId: string, bucketId: string, jsonPolicy: string, byUser: string, fields: string[]): Promise<any>;
|
|
49
|
+
getBucketPolicyEffect(serviceId: string, s3UserId: string, fields: string[]): Promise<any>;
|
|
50
|
+
getBucketPolicyAction(serviceId: string, s3UserId: string, fields: string[]): Promise<any>;
|
|
51
|
+
previewCreateBucketPolicyStatement(serviceId: string, s3UserId: string, bucketId: string, statement: object, fields: string[]): Promise<any>;
|
|
52
|
+
createBucketPolicyStatement(serviceId: string, s3UserId: string, bucketId: string, statement: object, byUser: string, fields: string[]): Promise<any>;
|
|
42
53
|
}
|
|
@@ -732,5 +732,206 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
732
732
|
}
|
|
733
733
|
});
|
|
734
734
|
}
|
|
735
|
+
getListSubUser(serviceId, s3UserId, fields) {
|
|
736
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
737
|
+
const query = (0, queries_1.GET_LIST_SUB_USER)(fields);
|
|
738
|
+
const variables = {
|
|
739
|
+
serviceId,
|
|
740
|
+
s3UserId
|
|
741
|
+
};
|
|
742
|
+
try {
|
|
743
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
744
|
+
return response.getListSubUser;
|
|
745
|
+
}
|
|
746
|
+
catch (error) {
|
|
747
|
+
console.log(`Error in getListSubUser: ${error}`);
|
|
748
|
+
throw error;
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
createSubUser(serviceId, s3UserId, subUserName, subUserPermission, fields) {
|
|
753
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
754
|
+
const mutation = (0, mutations_1.CREATE_SUB_USER)(fields);
|
|
755
|
+
const variables = {
|
|
756
|
+
serviceId,
|
|
757
|
+
s3UserId,
|
|
758
|
+
subUserName,
|
|
759
|
+
subUserPermission
|
|
760
|
+
};
|
|
761
|
+
try {
|
|
762
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
763
|
+
return response.createSubUser;
|
|
764
|
+
}
|
|
765
|
+
catch (error) {
|
|
766
|
+
console.log(`Error in createSubUser: ${error}`);
|
|
767
|
+
throw error;
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
updateSubUserPermission(serviceId, s3UserId, subUserId, subUserPermission, fields) {
|
|
772
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
773
|
+
const mutation = (0, mutations_1.UPDATE_SUB_USER_PERMISSION)(fields);
|
|
774
|
+
const variables = {
|
|
775
|
+
serviceId,
|
|
776
|
+
s3UserId,
|
|
777
|
+
subUserId,
|
|
778
|
+
subUserPermission
|
|
779
|
+
};
|
|
780
|
+
try {
|
|
781
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
782
|
+
return response.updateSubUserPermission;
|
|
783
|
+
}
|
|
784
|
+
catch (error) {
|
|
785
|
+
console.log(`Error in updateSubUserPermission: ${error}`);
|
|
786
|
+
throw error;
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
removeSubUser(serviceId, s3UserId, subUserId, fields) {
|
|
791
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
792
|
+
const mutation = (0, mutations_1.REMOVE_SUB_USER)(fields);
|
|
793
|
+
const variables = {
|
|
794
|
+
serviceId,
|
|
795
|
+
s3UserId,
|
|
796
|
+
subUserId
|
|
797
|
+
};
|
|
798
|
+
try {
|
|
799
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
800
|
+
return response.removeSubUser;
|
|
801
|
+
}
|
|
802
|
+
catch (error) {
|
|
803
|
+
console.log(`Error in removeSubUser: ${error}`);
|
|
804
|
+
throw error;
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
getListPermissionSubUser(serviceId, s3UserId, fields) {
|
|
809
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
810
|
+
const query = (0, queries_1.GET_LIST_PERMISSION_SUB_USER)(fields);
|
|
811
|
+
const variables = {
|
|
812
|
+
serviceId,
|
|
813
|
+
s3UserId
|
|
814
|
+
};
|
|
815
|
+
try {
|
|
816
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
817
|
+
return response.getListPermissionSubUser;
|
|
818
|
+
}
|
|
819
|
+
catch (error) {
|
|
820
|
+
console.log(`Error in getListPermissionSubUser: ${error}`);
|
|
821
|
+
throw error;
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
getBucketPolicy(serviceId, s3UserId, bucketId, fields) {
|
|
826
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
827
|
+
const query = (0, queries_1.GET_BUCKET_POLICY)(fields);
|
|
828
|
+
const variables = {
|
|
829
|
+
serviceId,
|
|
830
|
+
s3UserId,
|
|
831
|
+
bucketId
|
|
832
|
+
};
|
|
833
|
+
try {
|
|
834
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
835
|
+
return response.getBucketPolicy;
|
|
836
|
+
}
|
|
837
|
+
catch (error) {
|
|
838
|
+
console.log(`Error in getBucketPolicy: ${error}`);
|
|
839
|
+
throw error;
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
updateBucketPolicy(serviceId, s3UserId, bucketId, jsonPolicy, byUser, fields) {
|
|
844
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
845
|
+
const mutation = (0, mutations_1.UPDATE_BUCKET_POLICY)(fields);
|
|
846
|
+
const variables = {
|
|
847
|
+
serviceId,
|
|
848
|
+
s3UserId,
|
|
849
|
+
bucketId,
|
|
850
|
+
jsonPolicy,
|
|
851
|
+
byUser
|
|
852
|
+
};
|
|
853
|
+
try {
|
|
854
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
855
|
+
return response.updateBucketPolicy;
|
|
856
|
+
}
|
|
857
|
+
catch (error) {
|
|
858
|
+
console.log(`Error in updateBucketPolicy: ${error}`);
|
|
859
|
+
throw error;
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
getBucketPolicyEffect(serviceId, s3UserId, fields) {
|
|
864
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
865
|
+
const query = (0, queries_1.GET_BUCKET_POLICY_EFFECT)(fields);
|
|
866
|
+
const variables = {
|
|
867
|
+
serviceId,
|
|
868
|
+
s3UserId
|
|
869
|
+
};
|
|
870
|
+
try {
|
|
871
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
872
|
+
return response.getBucketPolicyEffect;
|
|
873
|
+
}
|
|
874
|
+
catch (error) {
|
|
875
|
+
console.log(`Error in getBucketPolicyEffect: ${error}`);
|
|
876
|
+
throw error;
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
getBucketPolicyAction(serviceId, s3UserId, fields) {
|
|
881
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
882
|
+
const query = (0, queries_1.GET_BUCKET_POLICY_ACTION)(fields);
|
|
883
|
+
const variables = {
|
|
884
|
+
serviceId,
|
|
885
|
+
s3UserId
|
|
886
|
+
};
|
|
887
|
+
try {
|
|
888
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
889
|
+
return response.getBucketPolicyAction;
|
|
890
|
+
}
|
|
891
|
+
catch (error) {
|
|
892
|
+
console.log(`Error in getBucketPolicyAction: ${error}`);
|
|
893
|
+
throw error;
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
previewCreateBucketPolicyStatement(serviceId, s3UserId, bucketId, statement, fields) {
|
|
898
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
899
|
+
const query = (0, queries_1.PREVIEW_CREATE_BUCKET_POLICY_STATEMENT)(fields);
|
|
900
|
+
const variables = {
|
|
901
|
+
serviceId,
|
|
902
|
+
s3UserId,
|
|
903
|
+
bucketId,
|
|
904
|
+
statement
|
|
905
|
+
};
|
|
906
|
+
try {
|
|
907
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
908
|
+
return response.previewCreateBucketPolicyStatement;
|
|
909
|
+
}
|
|
910
|
+
catch (error) {
|
|
911
|
+
console.log(`Error in previewCreateBucketPolicyStatement: ${error}`);
|
|
912
|
+
throw error;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
createBucketPolicyStatement(serviceId, s3UserId, bucketId, statement, byUser, fields) {
|
|
917
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
918
|
+
const mutation = (0, mutations_1.CREATE_BUCKET_POLICY_STATEMENT)(fields);
|
|
919
|
+
const variables = {
|
|
920
|
+
serviceId,
|
|
921
|
+
s3UserId,
|
|
922
|
+
bucketId,
|
|
923
|
+
statement,
|
|
924
|
+
byUser
|
|
925
|
+
};
|
|
926
|
+
try {
|
|
927
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
928
|
+
return response.createBucketPolicyStatement;
|
|
929
|
+
}
|
|
930
|
+
catch (error) {
|
|
931
|
+
console.log(`Error in createBucketPolicyStatement: ${error}`);
|
|
932
|
+
throw error;
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
}
|
|
735
936
|
}
|
|
736
937
|
exports.StorageS3Service = StorageS3Service;
|