@xuda.io/account_module 1.2.1025 → 1.2.1027

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 +6 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2384,7 +2384,7 @@ export const onboarding_completed = async function (req, job_id, headers) {
2384
2384
  }
2385
2385
 
2386
2386
  const account_profile_ret = await create_account_profile({ uid });
2387
- account_doc.active_profile_id = account_profile_ret.data.id;
2387
+ account_doc.active_account_profile_id = account_profile_ret.data.id;
2388
2388
  account_doc.boarded_info = { headers, date_ts: Date.now() };
2389
2389
  account_doc.isBoarded = true;
2390
2390
  const save_ret = await db_module.save_couch_doc('xuda_accounts', account_doc);
@@ -2406,18 +2406,18 @@ export const ts_contact = async function (contact_id) {
2406
2406
  };
2407
2407
 
2408
2408
  export const get_account_ai_usage = async function (req, job_id, headers) {
2409
- const { uid } = req;
2409
+ const { uid, year, month, day } = req;
2410
2410
  try {
2411
2411
  const app_id = await get_account_default_project_id(uid);
2412
2412
  const { data: acc_obj } = await db_module.get_couch_doc('xuda_accounts', uid);
2413
2413
 
2414
2414
  const d = new Date();
2415
- const month = Number(String(d.getMonth() + 1).padStart(2, '0')); // months are 0-based
2416
- const year = d.getFullYear();
2415
+ const curr_month = Number(String(d.getMonth() + 1).padStart(2, '0')); // months are 0-based
2416
+ const curr_year = d.getFullYear();
2417
2417
 
2418
2418
  const ai_usage = await db_module.get_app_couch_view(app_id, 'ai_chat_usage', {
2419
- startkey: [year, month, 0],
2420
- endkey: [year, month, 99],
2419
+ startkey: [year || curr_year, month || curr_month, day || 0],
2420
+ endkey: [year || curr_year, month || curr_month, day || 99],
2421
2421
  reduce: true,
2422
2422
  group_level: 999,
2423
2423
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1025",
3
+ "version": "1.2.1027",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {