@digione/node-custom-api 0.1.2 → 0.1.4
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.js +7 -4
package/package.json
CHANGED
package/utils/user.js
CHANGED
|
@@ -225,18 +225,20 @@ const getAddressIndex = (data, { condition = {}, lang_code = "en" } = {}) => tsl
|
|
|
225
225
|
bol = (typeof result['country_id'] == "undefined");
|
|
226
226
|
}
|
|
227
227
|
if (!bol && data['state'] && !condition['state_id']) {
|
|
228
|
+
let country_id = condition['country_id'] || null;
|
|
228
229
|
let state = yield state_1.StateModel.schema("core", "_").findOne({
|
|
229
|
-
raw: true, where: Object.assign(Object.assign(
|
|
230
|
+
raw: true, where: Object.assign(Object.assign({}, where), { country_id, state_name: data['state'] }), attributes: ['id'], order
|
|
230
231
|
});
|
|
231
232
|
if (state) {
|
|
232
233
|
result['state_id'] = state['id'];
|
|
233
|
-
condition['
|
|
234
|
+
condition['state_id'] = result['state_id'];
|
|
234
235
|
}
|
|
235
236
|
bol = (typeof result['state_id'] == "undefined");
|
|
236
237
|
}
|
|
237
238
|
if (!bol && data['city'] && !condition['city_id']) {
|
|
239
|
+
let state_id = condition['state_id'] || null;
|
|
238
240
|
let city = yield city_1.CityModel.schema("core", "_").findOne({
|
|
239
|
-
raw: true, where: Object.assign(Object.assign(
|
|
241
|
+
raw: true, where: Object.assign(Object.assign({}, where), { state_id, city_name: data['city'] }), attributes: ['id'], order
|
|
240
242
|
});
|
|
241
243
|
if (city) {
|
|
242
244
|
result['city_id'] = city['id'];
|
|
@@ -245,8 +247,9 @@ const getAddressIndex = (data, { condition = {}, lang_code = "en" } = {}) => tsl
|
|
|
245
247
|
bol = (typeof result['city_id'] == "undefined");
|
|
246
248
|
}
|
|
247
249
|
if (!bol && data['district']) {
|
|
250
|
+
let city_id = condition['city_id'] || null;
|
|
248
251
|
let district = yield district_1.DistrictModel.schema("core", "_").findOne({
|
|
249
|
-
raw: true, where: Object.assign(Object.assign(
|
|
252
|
+
raw: true, where: Object.assign(Object.assign({}, where), { city_id, district_name: data['district'] }), attributes: ['id'], order
|
|
250
253
|
});
|
|
251
254
|
if (district)
|
|
252
255
|
result['district_id'] = district['id'];
|