@xuda.io/account_module 1.2.232 → 1.2.234

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/index.mjs +8 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1165,15 +1165,20 @@ export const delete_contact = async function (req) {
1165
1165
  export const add_contact = async function (req, job_id, headers) {
1166
1166
  try {
1167
1167
  debugger;
1168
- const { uid, email, name, stat, contact_uid, req_id, profile_picture, context } = req;
1168
+ const { uid, email, name, stat, contact_uid, req_id, context } = req;
1169
1169
  const contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_email_address', { key: [uid, email] });
1170
1170
 
1171
1171
  if (contact_ret.rows.length) {
1172
1172
  throw new Error('contact already exist active or deleted');
1173
1173
  }
1174
1174
 
1175
- const account_abj = await get_account_name({ uid_query: contact_uid });
1176
-
1175
+ let profile_picture;
1176
+ if (contact_uid) {
1177
+ const account_ret = await get_account_name({ uid_query: contact_uid });
1178
+ if (account_ret.code < 0) {
1179
+ throw new Error(`account ${contact_uid} not found`);
1180
+ }
1181
+ }
1177
1182
  const d = Date.now();
1178
1183
  const doc = {
1179
1184
  _id: await _common.xuda_get_uuid('contact'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.232",
3
+ "version": "1.2.234",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {