@xuda.io/account_module 1.2.218 → 1.2.220

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 +10 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1161,6 +1161,13 @@ export const delete_contact = async function (req) {
1161
1161
  // );
1162
1162
 
1163
1163
  export const add_contact = async function (req, job_id, headers) {
1164
+ try {
1165
+ if (contact_ret.rows.length) {
1166
+ throw new Error('contact already exist active or deleted');
1167
+ }
1168
+ } catch (err) {
1169
+ return { code: -1, data: err.message };
1170
+ }
1164
1171
  const { uid, email, name, stat, contact_uid, req_id, profile_picture, context } = req;
1165
1172
  const contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_email_address', { key: [uid, email] });
1166
1173
 
@@ -1191,7 +1198,6 @@ export const add_contact = async function (req, job_id, headers) {
1191
1198
 
1192
1199
  return ret;
1193
1200
  }
1194
- return { code: -1, data: 'contact already exist active or deleted' };
1195
1201
  };
1196
1202
  export const update_contact = async function (req) {
1197
1203
  const { uid, email, contact_uid, stat, req_id } = req;
@@ -1488,8 +1494,9 @@ setTimeout(async () => {
1488
1494
  // }
1489
1495
 
1490
1496
  // // console.log(await get_contact({ uid, name: "bo" }));
1491
- debugger;
1492
- await add_contact({ uid: 'd39126e0e2c51ffbd1aad10709fc8335', name: 'Boaz Avrahami', email: 'ishai054@gmail.com', context: {} }, null, { 'accept-language': 'en-US,en;q=0.9,he;q=0.8' });
1497
+
1498
+ let ret = await add_contact({ uid: 'd39126e0e2c51ffbd1aad10709fc8335', name: 'Ishai Avrahami', email: 'ishai054@gmail.com', context: {} }, null, { 'accept-language': 'en-US,en;q=0.9,he;q=0.8' });
1499
+ console.log(ret);
1493
1500
  }, 2000);
1494
1501
 
1495
1502
  export const get_user_name = async function (uid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.218",
3
+ "version": "1.2.220",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {