@xuda.io/account_module 1.2.1379 → 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 +13 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1982,10 +1982,19 @@ 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
|
}
|
|
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);
|
|
1993
|
+
profile_picture = profile_picture_obj.url;
|
|
1994
|
+
account_obj.account_info.profile_picture_obj = profile_picture_obj;
|
|
1995
|
+
account_obj.account_info.profile_picture = profile_picture;
|
|
1996
|
+
const account_save_ret = await db_module.save_couch_doc('xuda_accounts', account_obj);
|
|
1997
|
+
}
|
|
1989
1998
|
} else {
|
|
1990
1999
|
// contact without use account
|
|
1991
2000
|
|
|
@@ -2003,7 +2012,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2003
2012
|
// }
|
|
2004
2013
|
// }
|
|
2005
2014
|
if (!is_spam) {
|
|
2006
|
-
profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context }, account_profile_info, job_id, headers);
|
|
2015
|
+
profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata }, account_profile_info, job_id, headers);
|
|
2007
2016
|
profile_picture = profile_picture_obj.url;
|
|
2008
2017
|
}
|
|
2009
2018
|
}
|
|
@@ -2035,7 +2044,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2035
2044
|
if (!account_info_ret?.data?.profile_avatar) {
|
|
2036
2045
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
2037
2046
|
if (account_info_ret?.data?.profile_picture) {
|
|
2038
|
-
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);
|
|
2039
2048
|
} else {
|
|
2040
2049
|
if (!doc.profile_avatar) {
|
|
2041
2050
|
// create factual avatar
|