@xuda.io/account_module 1.2.1810 → 1.2.1812
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/index.mjs +14 -11
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2316,10 +2316,17 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
2318
|
let file_ret = { code: 1, data: cache };
|
|
2319
|
-
|
|
2319
|
+
|
|
2320
2320
|
if (!cache) {
|
|
2321
2321
|
// if personal, return profile pic, if business return logo
|
|
2322
2322
|
file_ret = await ai_module.get_profile_picture(uid, contact_obj.account_type, contact_obj?.business_info?.business_domain || contact_obj.name, { email: contact_obj.email, metadata: contact_obj }, account_profile_info, job_id, headers);
|
|
2323
|
+
|
|
2324
|
+
if (file_ret.code < 0) {
|
|
2325
|
+
throw new Error(file_ret.data);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
if (!_.isObject(file_ret.data)) throw new Error('file_ret not an object');
|
|
2329
|
+
|
|
2323
2330
|
if (contact_obj?.business_info?.business_domain) {
|
|
2324
2331
|
if (!identifyPersonalProvider(contact_obj.business_info.business_domain)) {
|
|
2325
2332
|
save_xuda_cache(uid, 'profile_picture', contact_obj.business_info.business_domain, file_ret.data, { account_type: contact_obj.account_type, type: 'contact' });
|
|
@@ -2329,11 +2336,6 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2329
2336
|
}
|
|
2330
2337
|
save_xuda_cache(uid, 'profile_picture', contact_obj.email, file_ret.data, { account_type: contact_obj.account_type, type: 'contact' });
|
|
2331
2338
|
}
|
|
2332
|
-
if (file_ret.code < 0) {
|
|
2333
|
-
throw new Error(file_ret.data);
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
if (!_.isObject(file_ret.data)) throw new Error('file_ret not an object');
|
|
2337
2339
|
|
|
2338
2340
|
let { code: contact_code, data: contact_obj2 } = await db_module.get_app_couch_doc(account_profile_info.app_id, contact_id);
|
|
2339
2341
|
contact_obj = contact_obj2;
|
|
@@ -2391,6 +2393,12 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2391
2393
|
headers,
|
|
2392
2394
|
);
|
|
2393
2395
|
|
|
2396
|
+
if (file_ret.code < 0) {
|
|
2397
|
+
throw new Error(file_ret.data);
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
if (!_.isObject(file_ret.data)) throw new Error('file_ret not an object');
|
|
2401
|
+
|
|
2394
2402
|
if (contact_obj?.account_type === 'business') {
|
|
2395
2403
|
if (contact_obj?.business_has_person && contact_obj?.person_info?.person_full_name !== 'Not available') {
|
|
2396
2404
|
cache = await save_xuda_cache(uid, 'profile_avatar', contact_obj.email, file_ret.data, { account_type: contact_obj.account_type, type: 'contact' });
|
|
@@ -2412,11 +2420,6 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2412
2420
|
// }
|
|
2413
2421
|
// save_xuda_cache(uid, 'profile_avatar', contact_obj.email, file_ret.data, { account_type: contact_obj.account_type, type: 'contact' });
|
|
2414
2422
|
}
|
|
2415
|
-
if (file_ret.code < 0) {
|
|
2416
|
-
throw new Error(file_ret.data);
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
if (!_.isObject(file_ret.data)) throw new Error('file_ret not an object');
|
|
2420
2423
|
|
|
2421
2424
|
let { code: contact_code, data: contact_obj3 } = await db_module.get_app_couch_doc(account_profile_info.app_id, contact_id);
|
|
2422
2425
|
contact_obj = contact_obj3;
|