@xuda.io/account_module 1.2.1282 → 1.2.1284

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 +18 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2107,6 +2107,23 @@ export const add_contact = async function (req, job_id, headers) {
2107
2107
  throw new Error('contact already exist active or deleted');
2108
2108
  }
2109
2109
 
2110
+ //////////////////
2111
+ const opt = {
2112
+ selector: {
2113
+ docType: 'contact',
2114
+ stat: 3,
2115
+ email,
2116
+ },
2117
+ limit: 1,
2118
+ fields: ['_id'],
2119
+ };
2120
+ const user_contacts = await find_contact_query(uid, opt);
2121
+ if (user_contacts.docs.length) {
2122
+ throw new Error('contact already exist active or deleted');
2123
+ }
2124
+
2125
+ /////////////////
2126
+
2110
2127
  let is_spam = false;
2111
2128
  let profile_avatar, profile_avatar_obj;
2112
2129
  let account_info_ret;
@@ -2138,7 +2155,7 @@ export const add_contact = async function (req, job_id, headers) {
2138
2155
  const d = Date.now();
2139
2156
  const doc = {
2140
2157
  _id: await _common.xuda_get_uuid('contact'),
2141
- email: [email],
2158
+ email,
2142
2159
  name,
2143
2160
  stat: stat || 1,
2144
2161
  date_created: d,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1282",
3
+ "version": "1.2.1284",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {