@digione/node-custom-api 0.1.9-alpha9 → 0.1.9-beta10
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/package.json +1 -1
- package/utils/user.d.ts +2 -2
- package/utils/user.js +5 -5
package/package.json
CHANGED
package/utils/user.d.ts
CHANGED
|
@@ -40,9 +40,9 @@ export declare const convertAddress: (data: any, { lang_code, transform }?: {
|
|
|
40
40
|
lang_code?: string;
|
|
41
41
|
transform?: boolean;
|
|
42
42
|
}) => Promise<any>;
|
|
43
|
-
export declare const getAddressIndex: (data: any, { condition,
|
|
43
|
+
export declare const getAddressIndex: (data: any, { condition, where }?: {
|
|
44
44
|
condition?: {};
|
|
45
|
-
|
|
45
|
+
where?: {};
|
|
46
46
|
}) => Promise<{}>;
|
|
47
47
|
export declare const getCountry: (ref: string, { organ_id, lang_code, setting }?: {
|
|
48
48
|
organ_id?: string;
|
package/utils/user.js
CHANGED
|
@@ -229,11 +229,11 @@ const convertAddress = (data, { lang_code = "en", transform = false } = {}) => t
|
|
|
229
229
|
return data;
|
|
230
230
|
});
|
|
231
231
|
exports.convertAddress = convertAddress;
|
|
232
|
-
const getAddressIndex = (data, { condition = {},
|
|
232
|
+
const getAddressIndex = (data, { condition = {}, where = {} } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
233
233
|
let result = {}, bol = false;
|
|
234
234
|
if (!bol && data['country'] && !condition['country_id']) {
|
|
235
235
|
let country = yield country_1.CountryModel.schema("core", "_").findOne({
|
|
236
|
-
raw: true, where: { country_name: data['country'] }, attributes: ['id']
|
|
236
|
+
raw: true, where: Object.assign(Object.assign({}, where), { country_name: data['country'] }), attributes: ['id']
|
|
237
237
|
});
|
|
238
238
|
if (country) {
|
|
239
239
|
result['country_id'] = country['id'];
|
|
@@ -244,7 +244,7 @@ const getAddressIndex = (data, { condition = {}, lang_code = "en" } = {}) => tsl
|
|
|
244
244
|
if (!bol && data['state'] && !condition['state_id']) {
|
|
245
245
|
let country_id = condition['country_id'] || null;
|
|
246
246
|
let state = yield state_1.StateModel.schema("core", "_").findOne({
|
|
247
|
-
raw: true, where: { country_id, state_name: data['state'] }, attributes: ['id']
|
|
247
|
+
raw: true, where: Object.assign(Object.assign({}, where), { country_id, state_name: data['state'] }), attributes: ['id']
|
|
248
248
|
});
|
|
249
249
|
if (state) {
|
|
250
250
|
result['state_id'] = state['id'];
|
|
@@ -255,7 +255,7 @@ const getAddressIndex = (data, { condition = {}, lang_code = "en" } = {}) => tsl
|
|
|
255
255
|
if (!bol && data['city'] && !condition['city_id']) {
|
|
256
256
|
let state_id = condition['state_id'] || null;
|
|
257
257
|
let city = yield city_1.CityModel.schema("core", "_").findOne({
|
|
258
|
-
raw: true, where: { state_id, city_name: data['city'] }, attributes: ['id']
|
|
258
|
+
raw: true, where: Object.assign(Object.assign({}, where), { state_id, city_name: data['city'] }), attributes: ['id']
|
|
259
259
|
});
|
|
260
260
|
if (city) {
|
|
261
261
|
result['city_id'] = city['id'];
|
|
@@ -266,7 +266,7 @@ const getAddressIndex = (data, { condition = {}, lang_code = "en" } = {}) => tsl
|
|
|
266
266
|
if (!bol && data['district']) {
|
|
267
267
|
let city_id = condition['city_id'] || null;
|
|
268
268
|
let district = yield district_1.DistrictModel.schema("core", "_").findOne({
|
|
269
|
-
raw: true, where: { city_id, district_name: data['district'] }, attributes: ['id']
|
|
269
|
+
raw: true, where: Object.assign(Object.assign({}, where), { city_id, district_name: data['district'] }), attributes: ['id']
|
|
270
270
|
});
|
|
271
271
|
if (district)
|
|
272
272
|
result['district_id'] = district['id'];
|