@xuda.io/drive_module 1.1.691 → 1.1.693
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 +33 -27
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -948,7 +948,10 @@ exports.rename_drive_file = async function (req) {
|
|
|
948
948
|
doc_ret.data._id = file_name_to;
|
|
949
949
|
delete doc_ret.data._rev;
|
|
950
950
|
}
|
|
951
|
-
|
|
951
|
+
misc_module.rsync_drive_resources_to_remote_servers(
|
|
952
|
+
"studio",
|
|
953
|
+
app_id_master
|
|
954
|
+
);
|
|
952
955
|
break;
|
|
953
956
|
}
|
|
954
957
|
case "workspace": {
|
|
@@ -2345,44 +2348,50 @@ const get_folder_docs = async function (dir, drive_type, app_id) {
|
|
|
2345
2348
|
|
|
2346
2349
|
exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
2347
2350
|
try {
|
|
2348
|
-
const { drive_type, app_id, uid,
|
|
2351
|
+
const { drive_type, app_id, uid, file_path, file_name, tags = [] } = req;
|
|
2349
2352
|
validate_drive_type(drive_type);
|
|
2350
2353
|
|
|
2354
|
+
const check_existing_file_ret = await module.exports.check_drive_file(
|
|
2355
|
+
check_req
|
|
2356
|
+
);
|
|
2357
|
+
|
|
2358
|
+
var target_file = path.join(file_path, file_name);
|
|
2359
|
+
const master_id = await _common.get_project_app_id(app_id, true);
|
|
2360
|
+
const tempPath = file_obj.path;
|
|
2361
|
+
if (drive_type === "studio") {
|
|
2362
|
+
const target_dir = path.join(
|
|
2363
|
+
_conf[`studio_drive_path`],
|
|
2364
|
+
master_id,
|
|
2365
|
+
target_file
|
|
2366
|
+
);
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2351
2369
|
let doc_ret;
|
|
2352
2370
|
|
|
2353
2371
|
switch (drive_type) {
|
|
2354
2372
|
case "studio": {
|
|
2355
2373
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
2356
|
-
doc_ret = await db_module.get_app_couch_doc(
|
|
2357
|
-
app_id_master,
|
|
2358
|
-
file_name_id
|
|
2359
|
-
);
|
|
2374
|
+
doc_ret = await db_module.get_app_couch_doc(app_id_master, target_file);
|
|
2360
2375
|
|
|
2361
|
-
if (doc_ret.code > -1) {
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2376
|
+
// if (doc_ret.code > -1) {
|
|
2377
|
+
// doc_ret.data._delete = true;
|
|
2378
|
+
// save_ret = await db_module.save_app_couch_doc(
|
|
2379
|
+
// app_id_master,
|
|
2380
|
+
// doc_ret.data
|
|
2381
|
+
// );
|
|
2382
|
+
|
|
2383
|
+
// doc_ret.data._id = file_name_id;
|
|
2384
|
+
// delete doc_ret.data._rev;
|
|
2385
|
+
// }
|
|
2367
2386
|
|
|
2368
|
-
doc_ret.data._id = file_name_id;
|
|
2369
|
-
delete doc_ret.data._rev;
|
|
2370
|
-
}
|
|
2371
|
-
misc_module.rsync_drive_resources_to_remote_servers(
|
|
2372
|
-
"studio",
|
|
2373
|
-
app_id_master
|
|
2374
|
-
);
|
|
2375
2387
|
break;
|
|
2376
2388
|
}
|
|
2377
2389
|
case "workspace": {
|
|
2378
2390
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
2379
2391
|
doc_ret = await db_module.get_app_couch_doc(
|
|
2380
2392
|
app_id_reference,
|
|
2381
|
-
|
|
2393
|
+
check_existing_file_ret.duplicates[0]._id
|
|
2382
2394
|
);
|
|
2383
|
-
if (doc_ret.code < 0) {
|
|
2384
|
-
throw new Error(doc_ret.data);
|
|
2385
|
-
}
|
|
2386
2395
|
|
|
2387
2396
|
break;
|
|
2388
2397
|
}
|
|
@@ -2390,11 +2399,8 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
2390
2399
|
case "user":
|
|
2391
2400
|
doc_ret = await db_module.get_couch_doc(
|
|
2392
2401
|
"xuda_drive",
|
|
2393
|
-
|
|
2402
|
+
check_existing_file_ret.duplicates[0]._id
|
|
2394
2403
|
);
|
|
2395
|
-
if (doc_ret.code < 0) {
|
|
2396
|
-
throw new Error(doc_ret.data);
|
|
2397
|
-
}
|
|
2398
2404
|
|
|
2399
2405
|
break;
|
|
2400
2406
|
|