@digione/node-custom-api 0.1.9-beta2 → 0.1.9-beta3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/user.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digione/node-custom-api",
3
- "version": "0.1.9-beta2",
3
+ "version": "0.1.9-beta3",
4
4
  "description": "Typescript node digione-api",
5
5
  "author": "Monchai Jirayupong <monchai.j@seven.co.th>",
6
6
  "license": "MIT",
package/utils/user.js CHANGED
@@ -277,7 +277,14 @@ const getAddressIndex = (data, { condition = {}, lang_code = "en" } = {}) => tsl
277
277
  exports.getAddressIndex = getAddressIndex;
278
278
  const getCountry = (ref, { organ_id = "", lang_code = "en", setting = {} } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
279
279
  let where = { status: 1, lang_code }, default_country;
280
- if (setting['country_id']) {
280
+ if (organ_id) {
281
+ let query = yield organ_1.UserOrganModel.schema(ref, "_").findOne({ where: { id: organ_id }, attributes: ['setting'], raw: true });
282
+ setting = query ? (query['setting'] || {}) : {};
283
+ }
284
+ if (setting['mobile_code']) {
285
+ where['mobilecode'] = setting['mobile_code'].split(",");
286
+ }
287
+ else if (setting['country_id']) {
281
288
  where['id'] = setting['country_id'].split(",");
282
289
  }
283
290
  let data = yield country_1.CountryModel.schema("core", "_").findAll({