@xuda.io/account_module 1.2.1011 → 1.2.1013

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 +35 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2438,7 +2438,41 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
2438
2438
 
2439
2439
  let data = { credits: { membership_plan, ai_workspace_plan, contact_connection }, usage: { profile, projects: [] } };
2440
2440
 
2441
- return { code: -55, data };
2441
+ return { code: 55, data };
2442
+ } catch (err) {
2443
+ return { code: -55, data: err.message };
2444
+ }
2445
+ };
2446
+
2447
+ export const create_account_profile = async function (req, job_id, headers) {
2448
+ const { uid } = req;
2449
+ try {
2450
+ const app_id = await get_account_default_project_id(uid);
2451
+ const { data: acc_obj } = await db_module.get_couch_doc('xuda_accounts', uid);
2452
+
2453
+ const d = Date.now();
2454
+ const doc = {
2455
+ _id: await _common.xuda_get_uuid('contact'),
2456
+ email: [email],
2457
+ name,
2458
+ stat: stat || 1,
2459
+ date_created: d,
2460
+ ts: d,
2461
+ docType: 'contact',
2462
+ contact_uid,
2463
+ uid,
2464
+ context,
2465
+ headers,
2466
+ source,
2467
+ team_req_id,
2468
+ metadata,
2469
+ is_spam,
2470
+ profile_avatar,
2471
+ profile_avatar_obj,
2472
+ };
2473
+ const save_ret = await db_module.save_couch_doc('xuda_accounts', doc);
2474
+
2475
+ return { code: 55, data: save_ret };
2442
2476
  } catch (err) {
2443
2477
  return { code: -55, data: err.message };
2444
2478
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1011",
3
+ "version": "1.2.1013",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {