@xuda.io/account_module 1.2.1380 → 1.2.1381
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 +9 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1982,15 +1982,17 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
1982
1982
|
let account_info_ret;
|
|
1983
1983
|
let account_type;
|
|
1984
1984
|
if (contact_uid) {
|
|
1985
|
-
|
|
1986
|
-
|
|
1985
|
+
let { code: account_code, data: account_obj } = await db_module.get_couch_doc('xuda_accounts', contact_uid);
|
|
1986
|
+
|
|
1987
|
+
// account_info_ret = await get_account_name({ uid_query: contact_uid });
|
|
1988
|
+
if (account_code < 0) {
|
|
1987
1989
|
throw new Error(`account ${contact_uid} not found`);
|
|
1988
1990
|
}
|
|
1989
|
-
if (!
|
|
1990
|
-
profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata, account_info:
|
|
1991
|
+
if (!account_obj.account_info.profile_picture) {
|
|
1992
|
+
profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata, account_info: account_obj.account_info }, account_profile_info, job_id, headers);
|
|
1991
1993
|
profile_picture = profile_picture_obj.url;
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
+
account_obj.account_info.profile_picture_obj = profile_picture_obj;
|
|
1995
|
+
account_obj.account_info.profile_picture = profile_picture;
|
|
1994
1996
|
const account_save_ret = await db_module.save_couch_doc('xuda_accounts', account_obj);
|
|
1995
1997
|
}
|
|
1996
1998
|
} else {
|
|
@@ -2042,7 +2044,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2042
2044
|
if (!account_info_ret?.data?.profile_avatar) {
|
|
2043
2045
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
2044
2046
|
if (account_info_ret?.data?.profile_picture) {
|
|
2045
|
-
ai_module.create_profile_avatar({ url:
|
|
2047
|
+
ai_module.create_profile_avatar({ url: account_obj.profile_picture, uid, account_obj: { _id: contact_uid, account_info: account_info_ret.data }, account_profile_info }, job_id, headers);
|
|
2046
2048
|
} else {
|
|
2047
2049
|
if (!doc.profile_avatar) {
|
|
2048
2050
|
// create factual avatar
|