@xuda.io/drive_module 1.1.507 → 1.1.509

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.js +10 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1991,7 +1991,7 @@ exports.copy_file_to_another_bucket = async function (
1991
1991
  }
1992
1992
  };
1993
1993
 
1994
- const get_folder_size = async function (dir, drive_type, app_id) {
1994
+ const get_folder_size = async function (dir, drive_type, app_id, uid) {
1995
1995
  let totalSize = 0;
1996
1996
 
1997
1997
  const calculateSizeFs = async function (dirPath) {
@@ -2009,7 +2009,7 @@ const get_folder_size = async function (dir, drive_type, app_id) {
2009
2009
  };
2010
2010
 
2011
2011
  const calculateSizeDocs = async function (dirPath) {
2012
- const opt = {
2012
+ let opt = {
2013
2013
  selector: {
2014
2014
  docType: `${drive_type}_drive`,
2015
2015
  stat: 3,
@@ -2017,10 +2017,14 @@ const get_folder_size = async function (dir, drive_type, app_id) {
2017
2017
  },
2018
2018
  limit: 99999,
2019
2019
  };
2020
- const ret =
2021
- drive_type === "user"
2022
- ? await db_module.find_couch_query("xuda_drive", opt)
2023
- : await db_module.find_app_couch_query(app_id, opt);
2020
+
2021
+ if (drive_type === "user") {
2022
+ opt.selector.uid = uid;
2023
+ ret = await db_module.find_couch_query("xuda_drive", opt);
2024
+ } else {
2025
+ ret = await db_module.find_app_couch_query(app_id, opt);
2026
+ }
2027
+
2024
2028
  for await (let doc of ret.docs) {
2025
2029
  if (doc.type === "directory") {
2026
2030
  await calculateSizeDocs(path.join("/", doc._id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.507",
3
+ "version": "1.1.509",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {