@xuda.io/drive_module 1.1.654 → 1.1.656
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 +38 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2311,7 +2311,7 @@ const get_folder_docs = async function (dir, drive_type, app_id) {
|
|
|
2311
2311
|
|
|
2312
2312
|
exports.update_drive_file_tags = async function (req) {
|
|
2313
2313
|
try {
|
|
2314
|
-
const { drive_type, app_id, file_name_id, tags = [] } = req;
|
|
2314
|
+
const { drive_type, app_id, uid, file_name_id, tags = [] } = req;
|
|
2315
2315
|
validate_drive_type(drive_type);
|
|
2316
2316
|
|
|
2317
2317
|
let doc_ret;
|
|
@@ -2367,32 +2367,49 @@ exports.update_drive_file_tags = async function (req) {
|
|
|
2367
2367
|
default:
|
|
2368
2368
|
break;
|
|
2369
2369
|
}
|
|
2370
|
-
|
|
2370
|
+
var doc = {};
|
|
2371
2371
|
if (doc_ret.code > -1) {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2372
|
+
doc = doc_ret.data;
|
|
2373
|
+
} else {
|
|
2374
|
+
if (drive_type === "studio") {
|
|
2375
|
+
doc = {
|
|
2376
|
+
docType: `${drive_type}_drive`,
|
|
2377
|
+
stat: 3,
|
|
2378
|
+
originalname: file_name_id,
|
|
2379
|
+
uid,
|
|
2380
|
+
type: "file",
|
|
2381
|
+
date_created: Date.now(),
|
|
2382
|
+
ip: headers["cf-connecting-ip"],
|
|
2383
|
+
country: headers["cf-ipcountry"],
|
|
2384
|
+
file_ext: ext,
|
|
2385
|
+
is_archive: _conf.archive_drive_ext.includes(ext) ? true : false,
|
|
2386
|
+
drive_type,
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
doc.date_modified = Date.now();
|
|
2391
|
+
doc.tags = tags;
|
|
2392
|
+
let save_ret;
|
|
2376
2393
|
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2394
|
+
switch (drive_type) {
|
|
2395
|
+
case "workspace":
|
|
2396
|
+
case "studio":
|
|
2397
|
+
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
2398
|
+
save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
|
|
2399
|
+
break;
|
|
2383
2400
|
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2401
|
+
case "user":
|
|
2402
|
+
save_ret = await db_module.save_couch_doc("xuda_drive", doc);
|
|
2403
|
+
break;
|
|
2387
2404
|
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2405
|
+
default:
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2391
2408
|
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
}
|
|
2409
|
+
if (save_ret.code < 0) {
|
|
2410
|
+
throw new Error(save_ret.data);
|
|
2395
2411
|
}
|
|
2412
|
+
|
|
2396
2413
|
return {
|
|
2397
2414
|
code: 200,
|
|
2398
2415
|
data: tags,
|