@xuda.io/drive_module 1.1.506 → 1.1.508
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.
- package/index.js +10 -3
- 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
|
-
|
|
2012
|
+
let opt = {
|
|
2013
2013
|
selector: {
|
|
2014
2014
|
docType: `${drive_type}_drive`,
|
|
2015
2015
|
stat: 3,
|
|
@@ -2017,6 +2017,13 @@ const get_folder_size = async function (dir, drive_type, app_id) {
|
|
|
2017
2017
|
},
|
|
2018
2018
|
limit: 99999,
|
|
2019
2019
|
};
|
|
2020
|
+
|
|
2021
|
+
if (drive_type === "user") {
|
|
2022
|
+
opt.selector.uid = uid;
|
|
2023
|
+
} else {
|
|
2024
|
+
ret = await db_module.find_app_couch_query(app_id, opt);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2020
2027
|
const ret =
|
|
2021
2028
|
drive_type === "user"
|
|
2022
2029
|
? await db_module.find_couch_query("xuda_drive", opt)
|
|
@@ -2030,7 +2037,7 @@ const get_folder_size = async function (dir, drive_type, app_id) {
|
|
|
2030
2037
|
}
|
|
2031
2038
|
};
|
|
2032
2039
|
|
|
2033
|
-
if (["user", "workspace
|
|
2040
|
+
if (["user", "workspace"].includes(drive_type)) {
|
|
2034
2041
|
await calculateSizeDocs(dir);
|
|
2035
2042
|
} else {
|
|
2036
2043
|
await calculateSizeFs(dir);
|