@xuda.io/account_module 1.2.162 → 1.2.164

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 +19 -14
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -386,23 +386,10 @@ export const increment_account_usage = async function (req) {
386
386
 
387
387
  export const get_account_data = async function (req) {
388
388
  var { uid, enforce_usage } = req;
389
- // const get_info = async function () {
390
- // const get_stripe_subscription = async function (subscription_id) {
391
- // if (!subscription_id) {
392
- // return { code: -1, data: "subscription_id missing" };
393
- // }
394
- // try {
395
- // const ret = await stripe.subscriptions.retrieve(subscription_id);
396
-
397
- // return { code: 1, data: ret };
398
- // } catch (err) {
399
- // return { code: -400, data: err };
400
- // }
401
- // };
402
389
 
403
390
  try {
404
391
  const { data: acc_obj } = await db_module.get_couch_doc('xuda_accounts', uid);
405
- // const account_obj= account_ret.data
392
+
406
393
  var ret = { code: 1 };
407
394
  ret.data = {
408
395
  _id: acc_obj._id,
@@ -1482,3 +1469,21 @@ export const get_account_default_project_id = async function (uid) {
1482
1469
 
1483
1470
  // // console.log(await get_contact({ uid, name: "bo" }));
1484
1471
  // }, 2000);
1472
+
1473
+ export const get_user_name = async function (uid) {
1474
+ try {
1475
+ const account_info = await get_account_name(uid);
1476
+ let username = 'unknown';
1477
+ if (account_info) {
1478
+ username = account_info.first_name + ' ' + account_info.last_name;
1479
+
1480
+ if (!username) {
1481
+ username = +account_info.email;
1482
+ }
1483
+ }
1484
+
1485
+ return username;
1486
+ } catch (err) {
1487
+ return 'unknown';
1488
+ }
1489
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.162",
3
+ "version": "1.2.164",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {