@xuda.io/account_module 1.2.2036 → 1.2.2037

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 +12 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -43,11 +43,13 @@ const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi
43
43
  const module_path = path.join(process.env.XUDA_HOME, 'cpi') + (!_conf.is_debug ? '/node_modules/@xuda.io' : '');
44
44
  const db_module = await import(`${module_path}/db_module/index.mjs`);
45
45
  const ai_ms = await import(`${module_path}/ai_module/index_ms.mjs`);
46
+ const drive_ms = await import(`${module_path}/drive_module/index_ms.mjs`);
47
+ const jobs_ms = await import(`${module_path}/jobs_module/index_ms.mjs`);
48
+ const team_ms = await import(`${module_path}/team_module/index_ms.mjs`);
49
+ const email_ms = await import(`${module_path}/email_module/index_ms.mjs`);
50
+ const marketplace_ms = await import(`${module_path}/marketplace_module/index_ms.mjs`);
46
51
 
47
52
  export const update_account_info = async function (req, job_id, headers) {
48
- const marketplace_module = await import(`${module_path}/marketplace_module/index.mjs`);
49
- const drive_module = await import(`${module_path}/drive_module/index.mjs`);
50
-
51
53
  const { uid } = req;
52
54
  const data = req;
53
55
 
@@ -76,7 +78,7 @@ export const update_account_info = async function (req, job_id, headers) {
76
78
  var account_info_changes_arr = [];
77
79
  var error = {};
78
80
 
79
- await marketplace_module.marketplace_save_user({ uid });
81
+ await marketplace_ms.marketplace_save_user({ uid });
80
82
 
81
83
  for (const key of account_info_properties) {
82
84
  let val = data[key];
@@ -100,7 +102,7 @@ export const update_account_info = async function (req, job_id, headers) {
100
102
 
101
103
  const profile_avatar_obj = account_obj?.account_info?.profile_avatar_obj || '';
102
104
  if (profile_avatar_obj) {
103
- drive_module.delete_drive_files({ uid, drive_type: 'user', files_arr: [{ type: 'file', file_path: path.join(profile_avatar_obj.file_path, profile_avatar_obj.filename) }] });
105
+ drive_ms.delete_drive_files({ uid, drive_type: 'user', files_arr: [{ type: 'file', file_path: path.join(profile_avatar_obj.file_path, profile_avatar_obj.filename) }] });
104
106
  }
105
107
  }
106
108
 
@@ -265,7 +267,6 @@ export const increment_account_usage = async function (req) {
265
267
  opt.key = uid;
266
268
  }
267
269
  const accounts_ret = await db_module.get_couch_view_raw('xuda_accounts', 'all_accounts', opt);
268
- const drive_module = await import(`${module_path}/drive_module/index.mjs`);
269
270
 
270
271
  function bytesToGB(bytes) {
271
272
  return bytes / 1073741824; // or bytes / (1024 ** 3)
@@ -330,25 +331,25 @@ export const increment_account_usage = async function (req) {
330
331
  try {
331
332
  for await (let app of apps_ret.data.rows) {
332
333
  if (app.value.app_type === 'master') {
333
- let size_ret = await drive_module.get_drive_size({
334
+ let size_ret = await drive_ms.get_drive_size({
334
335
  drive_type: 'studio',
335
336
  app_id: app.id,
336
337
  });
337
338
  if (size_ret.code > -1) account_data.studio_drive_size += size_ret.data;
338
339
 
339
- size_ret = await drive_module.get_drive_size({
340
+ size_ret = await drive_ms.get_drive_size({
340
341
  drive_type: 'workspace',
341
342
  app_id: app.id,
342
343
  });
343
344
  if (size_ret.code > -1) account_data.workspace_drive_size += size_ret.data;
344
345
 
345
- size_ret = await drive_module.get_drive_size({
346
+ size_ret = await drive_ms.get_drive_size({
346
347
  drive_type: 'builds',
347
348
  app_id: app.id,
348
349
  });
349
350
  if (size_ret.code > -1) account_data.builds_drive_size += size_ret.data;
350
351
 
351
- size_ret = await drive_module.get_drive_size({
352
+ size_ret = await drive_ms.get_drive_size({
352
353
  drive_type: 'plugins',
353
354
  app_id: app.id,
354
355
  });
@@ -465,7 +466,7 @@ export const increment_account_usage = async function (req) {
465
466
  for await (let val of accounts_ret.rows) {
466
467
  var account_data = val.value;
467
468
 
468
- const size_ret = await drive_module.get_drive_size({
469
+ const size_ret = await drive_ms.get_drive_size({
469
470
  uid: account_data._id,
470
471
  drive_type: 'user',
471
472
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2036",
3
+ "version": "1.2.2037",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {